This libgo patch fixes the go tool to use Solaris assembler syntax for the buildid file. The Solaris assembler uses a different syntax for section directives. This is https://golang.org/cl/109140 ported over to gccgo. This fixes PR 85429. Bootstrapped and ran Go tests on x86_64-pc-linux-gnu and SPARC/Solaris 11 (there are other unrelated failures on SPARC Solaris). Committed to mainline.
Release managers: OK for GCC 8 branch? Ian
Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 259531) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -7b37b9c3f9338a1387ee1e2301de89c3d2d87d2b +32861fd0acb0f3232f66be4791388b27e71c9990 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: libgo/go/cmd/go/internal/work/buildid.go =================================================================== --- libgo/go/cmd/go/internal/work/buildid.go (revision 259359) +++ libgo/go/cmd/go/internal/work/buildid.go (working copy) @@ -309,7 +309,11 @@ func (b *Builder) gccgoBuildIDELFFile(a sfile := a.Objdir + "_buildid.s" var buf bytes.Buffer - fmt.Fprintf(&buf, "\t"+`.section .go.buildid,"e"`+"\n") + if cfg.Goos != "solaris" { + fmt.Fprintf(&buf, "\t"+`.section .go.buildid,"e"`+"\n") + } else { + fmt.Fprintf(&buf, "\t"+`.section ".go.buildid",#exclude`+"\n") + } fmt.Fprintf(&buf, "\t.byte ") for i := 0; i < len(a.buildID); i++ { if i > 0 { @@ -322,8 +326,10 @@ func (b *Builder) gccgoBuildIDELFFile(a fmt.Fprintf(&buf, "%#02x", a.buildID[i]) } fmt.Fprintf(&buf, "\n") - fmt.Fprintf(&buf, "\t"+`.section .note.GNU-stack,"",@progbits`+"\n") - fmt.Fprintf(&buf, "\t"+`.section .note.GNU-split-stack,"",@progbits`+"\n") + if cfg.Goos != "solaris" { + fmt.Fprintf(&buf, "\t"+`.section .note.GNU-stack,"",@progbits`+"\n") + fmt.Fprintf(&buf, "\t"+`.section .note.GNU-split-stack,"",@progbits`+"\n") + } if cfg.BuildN || cfg.BuildX { for _, line := range bytes.Split(buf.Bytes(), []byte("\n")) {