aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2023-02-15 14:05:22 -0800
committerGopher Robot <gobot@golang.org>2023-02-16 23:57:39 +0000
commitcd77738198ffe0c4a1db58352c89f9b2d2a4e85e (patch)
tree39d07c3eb576740f18057d50ab8fccf77e9754cc /src
parent3ad6393f8676b1b408673bf40b8a876f29561eef (diff)
downloadgo-cd77738198ffe0c4a1db58352c89f9b2d2a4e85e.tar.xz
cmd/link: don't switch to gold on ARM Linux
The bug in GNU ld appears to have been fixed in GNU binutils 2.28 by GNU binutils revision 5522f910cb539905d6adfdceab208ddfa5e84557. (This may have been accidental as the ChangeLog for the fix makes no reference to it; the fix is from https://sourceware.org/bugzilla/show_bug.cgi?id=19962). Continue using gold on arm64, at least for now, because as reported in issue #22040 GNU ld still fails there. For #15696 For #22040 Change-Id: I5534bb8b5680daf536a7941aba5c701e8a4138ab Reviewed-on: https://go-review.googlesource.com/c/go/+/468655 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Than McIntosh <thanm@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/link/internal/ld/lib.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
index baca7cd65f..d96f132256 100644
--- a/src/cmd/link/internal/ld/lib.go
+++ b/src/cmd/link/internal/ld/lib.go
@@ -1551,15 +1551,12 @@ func (ctxt *Link) hostlink() {
altLinker = "lld"
}
- if ctxt.Arch.InFamily(sys.ARM, sys.ARM64) && buildcfg.GOOS == "linux" {
- // On ARM, the GNU linker will generate COPY relocations
- // even with -znocopyreloc set.
+ if ctxt.Arch.InFamily(sys.ARM64) && buildcfg.GOOS == "linux" {
+ // On ARM64, the GNU linker will fail with
+ // -znocopyreloc if it thinks a COPY relocation is
+ // required. Switch to gold.
// https://sourceware.org/bugzilla/show_bug.cgi?id=19962
- //
- // On ARM64, the GNU linker will fail instead of
- // generating COPY relocations.
- //
- // In both cases, switch to gold.
+ // https://go.dev/issue/22040
altLinker = "gold"
// If gold is not installed, gcc will silently switch
@@ -1570,7 +1567,7 @@ func (ctxt *Link) hostlink() {
cmd := exec.Command(name, args...)
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)
+ log.Fatalf("ARM64 external linker must be gold (issue #15696, 22040), but is not: %s", out)
}
}
}