cmd: disable DWARF with old ld on aix/ppc64

DWARF relocations isn't working with some older ld, because of
-Wl,-bnoobjreorder which is needed on Go.
This commit checks ld's version and disable DWARF generation in cmd/link
if it's too old. Some tests must therefore be skipped.

Change-Id: I2e794c263eb0dfe0b42e7062fb80c26f086b44d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/164007
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Clément Chigot 2019-02-20 16:39:09 +01:00 committed by Ian Lance Taylor
parent bea58ef352
commit 0ff9df6b53
5 changed files with 89 additions and 10 deletions

View file

@ -322,18 +322,24 @@ func loadinternal(ctxt *Link, name string) *sym.Library {
return nil
}
// findLibPathCmd uses cmd command to find gcc library libname.
// It returns library full path if found, or "none" if not found.
func (ctxt *Link) findLibPathCmd(cmd, libname string) string {
// extld returns the current external linker.
func (ctxt *Link) extld() string {
if *flagExtld == "" {
*flagExtld = "gcc"
}
return *flagExtld
}
// findLibPathCmd uses cmd command to find gcc library libname.
// It returns library full path if found, or "none" if not found.
func (ctxt *Link) findLibPathCmd(cmd, libname string) string {
extld := ctxt.extld()
args := hostlinkArchArgs(ctxt.Arch)
args = append(args, cmd)
if ctxt.Debugvlog != 0 {
ctxt.Logf("%s %v\n", *flagExtld, args)
ctxt.Logf("%s %v\n", extld, args)
}
out, err := exec.Command(*flagExtld, args...).Output()
out, err := exec.Command(extld, args...).Output()
if err != nil {
if ctxt.Debugvlog != 0 {
ctxt.Logf("not using a %s file because compiler failed\n%v\n%s\n", libname, err, out)
@ -1111,12 +1117,8 @@ func (ctxt *Link) hostlink() {
return
}
if *flagExtld == "" {
*flagExtld = "gcc"
}
var argv []string
argv = append(argv, *flagExtld)
argv = append(argv, ctxt.extld())
argv = append(argv, hostlinkArchArgs(ctxt.Arch)...)
if *FlagS || debug_s {