mirror of git://gcc.gnu.org/git/gcc.git
re PR go/85429 (Several gotools tests FAIL with Solaris as)
PR go/85429
cmd/go: support more Solaris assembler syntaxes
Patch by Rainer Orth.
Reviewed-on: https://go-review.googlesource.com/110563
From-SVN: r259797
This commit is contained in:
parent
38dff92114
commit
8c2e1d6ca5
|
|
@ -1,4 +1,4 @@
|
||||||
32861fd0acb0f3232f66be4791388b27e71c9990
|
380527c032f02446438c71b0ac0026bcab416be5
|
||||||
|
|
||||||
The first line of this file holds the git revision number of the last
|
The first line of this file holds the git revision number of the last
|
||||||
merge done from the gofrontend repository.
|
merge done from the gofrontend repository.
|
||||||
|
|
|
||||||
|
|
@ -303,16 +303,35 @@ func (b *Builder) gccgoToolID(name, language string) (string, error) {
|
||||||
return id, nil
|
return id, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if assembler used by gccgo is GNU as.
|
||||||
|
func assemblerIsGas() bool {
|
||||||
|
cmd := exec.Command(BuildToolchain.compiler(), "-print-prog-name=as")
|
||||||
|
assembler, err := cmd.Output()
|
||||||
|
if err == nil {
|
||||||
|
cmd := exec.Command(strings.TrimSpace(string(assembler)), "--version")
|
||||||
|
out, err := cmd.Output()
|
||||||
|
if err == nil && strings.Contains(string(out), "GNU") {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// gccgoBuildIDELFFile creates an assembler file that records the
|
// gccgoBuildIDELFFile creates an assembler file that records the
|
||||||
// action's build ID in an SHF_EXCLUDE section.
|
// action's build ID in an SHF_EXCLUDE section.
|
||||||
func (b *Builder) gccgoBuildIDELFFile(a *Action) (string, error) {
|
func (b *Builder) gccgoBuildIDELFFile(a *Action) (string, error) {
|
||||||
sfile := a.Objdir + "_buildid.s"
|
sfile := a.Objdir + "_buildid.s"
|
||||||
|
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
if cfg.Goos != "solaris" {
|
if cfg.Goos != "solaris" || assemblerIsGas() {
|
||||||
fmt.Fprintf(&buf, "\t"+`.section .go.buildid,"e"`+"\n")
|
fmt.Fprintf(&buf, "\t"+`.section .go.buildid,"e"`+"\n")
|
||||||
} else {
|
} else if cfg.Goarch == "sparc" || cfg.Goarch == "sparc64" {
|
||||||
fmt.Fprintf(&buf, "\t"+`.section ".go.buildid",#exclude`+"\n")
|
fmt.Fprintf(&buf, "\t"+`.section ".go.buildid",#exclude`+"\n")
|
||||||
|
} else { // cfg.Goarch == "386" || cfg.Goarch == "amd64"
|
||||||
|
fmt.Fprintf(&buf, "\t"+`.section .go.buildid,#exclude`+"\n")
|
||||||
}
|
}
|
||||||
fmt.Fprintf(&buf, "\t.byte ")
|
fmt.Fprintf(&buf, "\t.byte ")
|
||||||
for i := 0; i < len(a.buildID); i++ {
|
for i := 0; i < len(a.buildID); i++ {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue