1
0
mirror of https://github.com/golang/go synced 2024-11-27 04:31:21 -07:00

cmd/link: ensure -fuse-ld=gold uses gold

Fixes #15696

Change-Id: I134e918dc56f79a72a04aa54f415371884113d2a
Reviewed-on: https://go-review.googlesource.com/23400
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
David Crawshaw 2016-05-24 13:40:02 -04:00
parent 7b9d3ff4cb
commit a0abecf102

View File

@ -1137,6 +1137,16 @@ func hostlink() {
//
// In both cases, switch to gold.
argv = append(argv, "-fuse-ld=gold")
// If gold is not installed, gcc will silently switch
// back to ld.bfd. So we parse the version information
// and provide a useful error if gold is missing.
cmd := exec.Command(extld, "-fuse-ld=gold", "-Wl,--version")
if out, err := cmd.CombinedOutput(); err != nil {
if !bytes.Contains(out, []byte("GNU gold")) {
log.Fatalf("ARM external linker must be gold (issue #15696), but is not: %s", out)
}
}
}
}