If we remove gold from binutils, go-runtime fails to build. There was a workaround in go to use gold as the nfd linker had a bug. The issue was fixed so backport dropping the workaround fmr upstream.
Signed-off-by: Richard Purdie <richard.pur...@linuxfoundation.org> --- meta/recipes-devtools/go/go-1.22.11.inc | 1 + ...5b008e3d106b2706645e5a88cd8e2fb98953.patch | 70 +++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 meta/recipes-devtools/go/go/6d265b008e3d106b2706645e5a88cd8e2fb98953.patch diff --git a/meta/recipes-devtools/go/go-1.22.11.inc b/meta/recipes-devtools/go/go-1.22.11.inc index 21222bea4ec..2dca7be9eb4 100644 --- a/meta/recipes-devtools/go/go-1.22.11.inc +++ b/meta/recipes-devtools/go/go-1.22.11.inc @@ -14,5 +14,6 @@ SRC_URI += "\ file://0007-exec.go-filter-out-build-specific-paths-from-linker-.patch \ file://0008-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch \ file://0009-go-Filter-build-paths-on-staticly-linked-arches.patch \ + file://6d265b008e3d106b2706645e5a88cd8e2fb98953.patch \ " SRC_URI[main.sha256sum] = "a60c23dec95d10a2576265ce580f57869d5ac2471c4f4aca805addc9ea0fc9fe" diff --git a/meta/recipes-devtools/go/go/6d265b008e3d106b2706645e5a88cd8e2fb98953.patch b/meta/recipes-devtools/go/go/6d265b008e3d106b2706645e5a88cd8e2fb98953.patch new file mode 100644 index 00000000000..2f394d17914 --- /dev/null +++ b/meta/recipes-devtools/go/go/6d265b008e3d106b2706645e5a88cd8e2fb98953.patch @@ -0,0 +1,70 @@ +From 6d265b008e3d106b2706645e5a88cd8e2fb98953 Mon Sep 17 00:00:00 2001 +From: Dirk Müller <d...@dmllr.de> +Date: Wed, 09 Mar 2022 17:47:23 +0100 +Subject: [PATCH] cmd/link: stop forcing binutils-gold dependency on aarch64 + +The bfd linker appears to be working just fine at least in version +2.41 or above. Reject the known broken one instead, which +avoids an architecture specific linker dependency that +is cumbersome for distributions. + +Fixes #22040. + +Change-Id: I9f377e47c22ef20497479c0978c053ed5de46a38 + +Upstream-Status: Backport [https://go.googlesource.com/go/+/6d265b008e3d106b2706645e5a88cd8e2fb98953] +--- + +diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go +index 2d8f964..fcf0bc7 100644 +--- a/src/cmd/link/internal/ld/lib.go ++++ b/src/cmd/link/internal/ld/lib.go +@@ -1670,27 +1670,6 @@ + // Use lld to avoid errors from default linker (issue #38838) + altLinker = "lld" + } +- +- 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 +- // https://go.dev/issue/22040 +- altLinker = "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. +- name, args := flagExtld[0], flagExtld[1:] +- args = append(args, "-fuse-ld=gold", "-Wl,--version") +- cmd := exec.Command(name, args...) +- if out, err := cmd.CombinedOutput(); err == nil { +- if !bytes.Contains(out, []byte("GNU gold")) { +- log.Fatalf("ARM64 external linker must be gold (issue #15696, 22040), but is not: %s", out) +- } +- } +- } + } + if ctxt.Arch.Family == sys.ARM64 && buildcfg.GOOS == "freebsd" { + // Switch to ld.bfd on freebsd/arm64. +diff --git a/src/make.bash b/src/make.bash +index b67ae15..7df4910 100755 +--- a/src/make.bash ++++ b/src/make.bash +@@ -94,6 +94,16 @@ + ;; + esac + ++# Test for bad bfd.ld ++if test "$(uname -m)" = "aarch64" && ld -v | grep -E "GNU ld.* 2\.([0-3]|40)"; then ++ echo 'ERROR: Your system uses bfd.LD 2.40 or older which has issues with dynamic linking on aarch64' ++ echo 'Consider upgrading or switching to binutils-gold.' ++ echo ++ echo 'See https://sourceware.org/bugzilla/show_bug.cgi?id=30437' ++ ++ exit 1 ++fi ++ + # Test for bad ld. + if ld --version 2>&1 | grep 'gold.* 2\.20' >/dev/null; then + echo 'ERROR: Your system has gold 2.20 installed.'
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#210994): https://lists.openembedded.org/g/openembedded-core/message/210994 Mute This Topic: https://lists.openembedded.org/mt/111056439/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-