@@ -35,7 +35,7 @@ var ASM_DEFINES = []string{
3535// by the compiler. This is only needed in go1.12+ when there is at least one
3636// .s file. If the symabis file is not needed, no file will be generated,
3737// and "", nil will be returned.
38- func buildSymabisFile (goenv * env , sFiles , hFiles []fileInfo , asmhdr string ) (string , error ) {
38+ func buildSymabisFile (goenv * env , packagePath string , sFiles , hFiles []fileInfo , asmhdr string ) (string , error ) {
3939 if len (sFiles ) == 0 {
4040 return "" , nil
4141 }
@@ -94,6 +94,13 @@ func buildSymabisFile(goenv *env, sFiles, hFiles []fileInfo, asmhdr string) (str
9494 seenHdrDirs [hdrDir ] = true
9595 }
9696 }
97+ // The package path has to be specified as of Go 1.22 or the resulting
98+ // object will be unlinkable, but the -p flag is only required in
99+ // preparing symabis since Go1.22, however, go build has been
100+ // emitting -p for both symabi and actual assembly since at least Go1.19
101+ if packagePath != "" && isGo119OrHigher () {
102+ asmargs = append (asmargs , "-p" , packagePath )
103+ }
97104 asmargs = append (asmargs , ASM_DEFINES ... )
98105 asmargs = append (asmargs , "-gensymabis" , "-o" , symabisName , "--" )
99106 for _ , sFile := range sFiles {
0 commit comments