Skip to content

Commit a0abecf

Browse files
committed
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 <[email protected]>
1 parent 7b9d3ff commit a0abecf

File tree

1 file changed

+10
-0
lines changed
  • src/cmd/link/internal/ld

1 file changed

+10
-0
lines changed

src/cmd/link/internal/ld/lib.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,16 @@ func hostlink() {
11371137
//
11381138
// In both cases, switch to gold.
11391139
argv = append(argv, "-fuse-ld=gold")
1140+
1141+
// If gold is not installed, gcc will silently switch
1142+
// back to ld.bfd. So we parse the version information
1143+
// and provide a useful error if gold is missing.
1144+
cmd := exec.Command(extld, "-fuse-ld=gold", "-Wl,--version")
1145+
if out, err := cmd.CombinedOutput(); err != nil {
1146+
if !bytes.Contains(out, []byte("GNU gold")) {
1147+
log.Fatalf("ARM external linker must be gold (issue #15696), but is not: %s", out)
1148+
}
1149+
}
11401150
}
11411151
}
11421152

0 commit comments

Comments
 (0)