diff --git a/go/tools/builders/asm.go b/go/tools/builders/asm.go index 1e3a8ba58d..e142aabc03 100644 --- a/go/tools/builders/asm.go +++ b/go/tools/builders/asm.go @@ -60,7 +60,10 @@ func asm(args []string) error { } // Build source with the assembler. - return asmFile(goenv, source, asmFlags, outPath) + // Note: As of Go 1.19, this would require a valid package path to work. + // But since this functionality is only used by the deprecated action API, + // we won't fix this. + return asmFile(goenv, source, "", asmFlags, outPath) } // buildSymabisFile generates a file from assembly files that is consumed @@ -137,9 +140,12 @@ func buildSymabisFile(goenv *env, sFiles, hFiles []fileInfo, asmhdr string) (str return symabisName, err } -func asmFile(goenv *env, srcPath string, asmFlags []string, outPath string) error { +func asmFile(goenv *env, srcPath, packagePath string, asmFlags []string, outPath string) error { args := goenv.goTool("asm") args = append(args, asmFlags...) + if packagePath != "" { + args = append(args, "-p", packagePath) + } args = append(args, "-trimpath", ".") args = append(args, "-o", outPath) args = append(args, "--", srcPath) diff --git a/go/tools/builders/compilepkg.go b/go/tools/builders/compilepkg.go index 6104bb8feb..bc2fc2954f 100644 --- a/go/tools/builders/compilepkg.go +++ b/go/tools/builders/compilepkg.go @@ -474,7 +474,7 @@ func compileArchive( } for i, sSrc := range srcs.sSrcs { obj := filepath.Join(workDir, fmt.Sprintf("s%d.o", i)) - if err := asmFile(goenv, sSrc.filename, asmFlags, obj); err != nil { + if err := asmFile(goenv, sSrc.filename, packagePath, asmFlags, obj); err != nil { return err } objFiles = append(objFiles, obj)