diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-02-07 16:23:29 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-02-10 13:03:57 +0000 |
| commit | f91a2072c956968e8131c360c307c7a07c2f05c2 (patch) | |
| tree | cd92a414843e299ad2ba1300b7e15c56bfd7b961 | |
| parent | 9f3127060027a24995c3c361cbda964d2c59d039 (diff) | |
| download | poky-f91a2072c956968e8131c360c307c7a07c2f05c2.tar.gz | |
go: Fix to work without gold on aarch64
If we remove gold from binutils, go-runtime fails to build. There was a
workaround in go to use gold as the bfd linker had a bug. The issue was
fixed so backport dropping the workaround fmr upstream.
(From OE-Core rev: 4636b7206b2e4247835d60956e62f5a2efea9e81)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-devtools/go/go-1.22.11.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/go/go/6d265b008e3d106b2706645e5a88cd8e2fb98953.patch | 49 |
2 files changed, 50 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-1.22.11.inc b/meta/recipes-devtools/go/go-1.22.11.inc index 21222bea4e..2dca7be9eb 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 += "\ | |||
| 14 | file://0007-exec.go-filter-out-build-specific-paths-from-linker-.patch \ | 14 | file://0007-exec.go-filter-out-build-specific-paths-from-linker-.patch \ |
| 15 | file://0008-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch \ | 15 | file://0008-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch \ |
| 16 | file://0009-go-Filter-build-paths-on-staticly-linked-arches.patch \ | 16 | file://0009-go-Filter-build-paths-on-staticly-linked-arches.patch \ |
| 17 | file://6d265b008e3d106b2706645e5a88cd8e2fb98953.patch \ | ||
| 17 | " | 18 | " |
| 18 | SRC_URI[main.sha256sum] = "a60c23dec95d10a2576265ce580f57869d5ac2471c4f4aca805addc9ea0fc9fe" | 19 | 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 0000000000..d858cc6408 --- /dev/null +++ b/meta/recipes-devtools/go/go/6d265b008e3d106b2706645e5a88cd8e2fb98953.patch | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | From 6d265b008e3d106b2706645e5a88cd8e2fb98953 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Dirk Müller <dirk@dmllr.de> | ||
| 3 | Date: Wed, 09 Mar 2022 17:47:23 +0100 | ||
| 4 | Subject: [PATCH] cmd/link: stop forcing binutils-gold dependency on aarch64 | ||
| 5 | |||
| 6 | The bfd linker appears to be working just fine at least in version | ||
| 7 | 2.41 or above. Reject the known broken one instead, which | ||
| 8 | avoids an architecture specific linker dependency that | ||
| 9 | is cumbersome for distributions. | ||
| 10 | |||
| 11 | Fixes #22040. | ||
| 12 | |||
| 13 | Change-Id: I9f377e47c22ef20497479c0978c053ed5de46a38 | ||
| 14 | |||
| 15 | Upstream-Status: Submitted [https://go-review.googlesource.com/c/go/+/391115] | ||
| 16 | --- | ||
| 17 | |||
| 18 | diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go | ||
| 19 | index 2d8f964..fcf0bc7 100644 | ||
| 20 | --- a/src/cmd/link/internal/ld/lib.go | ||
| 21 | +++ b/src/cmd/link/internal/ld/lib.go | ||
| 22 | @@ -1670,27 +1670,6 @@ | ||
| 23 | // Use lld to avoid errors from default linker (issue #38838) | ||
| 24 | altLinker = "lld" | ||
| 25 | } | ||
| 26 | - | ||
| 27 | - if ctxt.Arch.InFamily(sys.ARM64) && buildcfg.GOOS == "linux" { | ||
| 28 | - // On ARM64, the GNU linker will fail with | ||
| 29 | - // -znocopyreloc if it thinks a COPY relocation is | ||
| 30 | - // required. Switch to gold. | ||
| 31 | - // https://sourceware.org/bugzilla/show_bug.cgi?id=19962 | ||
| 32 | - // https://go.dev/issue/22040 | ||
| 33 | - altLinker = "gold" | ||
| 34 | - | ||
| 35 | - // If gold is not installed, gcc will silently switch | ||
| 36 | - // back to ld.bfd. So we parse the version information | ||
| 37 | - // and provide a useful error if gold is missing. | ||
| 38 | - name, args := flagExtld[0], flagExtld[1:] | ||
| 39 | - args = append(args, "-fuse-ld=gold", "-Wl,--version") | ||
| 40 | - cmd := exec.Command(name, args...) | ||
| 41 | - if out, err := cmd.CombinedOutput(); err == nil { | ||
| 42 | - if !bytes.Contains(out, []byte("GNU gold")) { | ||
| 43 | - log.Fatalf("ARM64 external linker must be gold (issue #15696, 22040), but is not: %s", out) | ||
| 44 | - } | ||
| 45 | - } | ||
| 46 | - } | ||
| 47 | } | ||
| 48 | if ctxt.Arch.Family == sys.ARM64 && buildcfg.GOOS == "freebsd" { | ||
| 49 | // Switch to ld.bfd on freebsd/arm64. | ||
