Skip to content

Commit 6693c94

Browse files
committed
Remove hard dependency on ld.gold on aarch64. Fixes #22040
1 parent 5a56d88 commit 6693c94

File tree

1 file changed

+1
-20
lines changed
  • src/cmd/link/internal/ld

1 file changed

+1
-20
lines changed

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

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,27 +1675,8 @@ func (ctxt *Link) hostlink() {
16751675
altLinker = "lld"
16761676
}
16771677

1678-
if ctxt.Arch.InFamily(sys.ARM64) && buildcfg.GOOS == "linux" {
1679-
// On ARM64, the GNU linker will fail with
1680-
// -znocopyreloc if it thinks a COPY relocation is
1681-
// required. Switch to gold.
1682-
// https://sourceware.org/bugzilla/show_bug.cgi?id=19962
1683-
// https://go.dev/issue/22040
1684-
altLinker = "gold"
1685-
1686-
// If gold is not installed, gcc will silently switch
1687-
// back to ld.bfd. So we parse the version information
1688-
// and provide a useful error if gold is missing.
1689-
name, args := flagExtld[0], flagExtld[1:]
1690-
args = append(args, "-fuse-ld=gold", "-Wl,--version")
1691-
cmd := exec.Command(name, args...)
1692-
if out, err := cmd.CombinedOutput(); err == nil {
1693-
if !bytes.Contains(out, []byte("GNU gold")) {
1694-
log.Fatalf("ARM64 external linker must be gold (issue #15696, 22040), but is not: %s", out)
1695-
}
1696-
}
1697-
}
16981678
}
1679+
16991680
if ctxt.Arch.Family == sys.ARM64 && buildcfg.GOOS == "freebsd" {
17001681
// Switch to ld.bfd on freebsd/arm64.
17011682
altLinker = "bfd"

0 commit comments

Comments
 (0)