* [Buildroot] [PATCH 1/1] package/go/go-src: stop forcing binutils-gold dependency on aarch64 @ 2025-02-03 12:01 Fiona Klute via buildroot 2025-02-03 12:48 ` Arnout Vandecappelle via buildroot 2025-02-04 6:26 ` yann.morin 0 siblings, 2 replies; 17+ messages in thread From: Fiona Klute via buildroot @ 2025-02-03 12:01 UTC (permalink / raw) To: buildroot; +Cc: Thomas Perale, Christian Stewart, Fiona Klute (WIWA) From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de> Go forces the GOLD linker when dynamically linking Go code, because old versions of BFD caused errors. The issue has been fixed in Binutils since at least 2.41 according to the upstream description of the patch added with this commit [1], and now forcing GOLD causes linking failure if ld.gold is not available. The associated Golang issue [2] is still open. Import the patch to stop forcing GOLD. [1] https://go-review.googlesource.com/c/go/+/391115 [2] https://github.com/golang/go/issues/22040 Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> --- ...-binutils-gold-dependency-on-aarch64.patch | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 package/go/go-src/0003-cmd-link-stop-forcing-binutils-gold-dependency-on-aarch64.patch diff --git a/package/go/go-src/0003-cmd-link-stop-forcing-binutils-gold-dependency-on-aarch64.patch b/package/go/go-src/0003-cmd-link-stop-forcing-binutils-gold-dependency-on-aarch64.patch new file mode 100644 index 0000000000..1ba31b6577 --- /dev/null +++ b/package/go/go-src/0003-cmd-link-stop-forcing-binutils-gold-dependency-on-aarch64.patch @@ -0,0 +1,70 @@ +From 6d265b008e3d106b2706645e5a88cd8e2fb98953 Mon Sep 17 00:00:00 2001 +From: Dirk Müller <dirk@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: https://go-review.googlesource.com/c/go/+/391115 +Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> +--- + +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.' -- 2.47.2 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/go/go-src: stop forcing binutils-gold dependency on aarch64 2025-02-03 12:01 [Buildroot] [PATCH 1/1] package/go/go-src: stop forcing binutils-gold dependency on aarch64 Fiona Klute via buildroot @ 2025-02-03 12:48 ` Arnout Vandecappelle via buildroot 2025-02-03 13:04 ` Fiona Klute via buildroot 2025-02-04 6:26 ` yann.morin 1 sibling, 1 reply; 17+ messages in thread From: Arnout Vandecappelle via buildroot @ 2025-02-03 12:48 UTC (permalink / raw) To: Fiona Klute, buildroot; +Cc: Thomas Perale, Christian Stewart Hi Fiona, On 03/02/2025 13:01, Fiona Klute wrote: > From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de> > > Go forces the GOLD linker when dynamically linking Go code, because > old versions of BFD caused errors. The issue has been fixed in > Binutils since at least 2.41 according to the upstream description of > the patch added with this commit [1], and now forcing GOLD causes > linking failure if ld.gold is not available. The associated Golang > issue [2] is still open. > > Import the patch to stop forcing GOLD. This fixes the issue for go-src, but not for go-bin unfortunately... And go-bin is the default... On the other hand, we don't have any autobuilder failures yet, so maybe it's a corner case problem and we can live with it until go-bin gets bumped to 1.23.6 (assuming upstream applies the fix to their stable branch of course). Regards, Arnout > > [1] https://go-review.googlesource.com/c/go/+/391115 > [2] https://github.com/golang/go/issues/22040 > > Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> > --- > ...-binutils-gold-dependency-on-aarch64.patch | 70 +++++++++++++++++++ > 1 file changed, 70 insertions(+) > create mode 100644 package/go/go-src/0003-cmd-link-stop-forcing-binutils-gold-dependency-on-aarch64.patch > > diff --git a/package/go/go-src/0003-cmd-link-stop-forcing-binutils-gold-dependency-on-aarch64.patch b/package/go/go-src/0003-cmd-link-stop-forcing-binutils-gold-dependency-on-aarch64.patch > new file mode 100644 > index 0000000000..1ba31b6577 > --- /dev/null > +++ b/package/go/go-src/0003-cmd-link-stop-forcing-binutils-gold-dependency-on-aarch64.patch > @@ -0,0 +1,70 @@ > +From 6d265b008e3d106b2706645e5a88cd8e2fb98953 Mon Sep 17 00:00:00 2001 > +From: Dirk Müller <dirk@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: https://go-review.googlesource.com/c/go/+/391115 > +Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> > +--- > + > +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.' _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/go/go-src: stop forcing binutils-gold dependency on aarch64 2025-02-03 12:48 ` Arnout Vandecappelle via buildroot @ 2025-02-03 13:04 ` Fiona Klute via buildroot 2025-02-03 14:13 ` Arnout Vandecappelle via buildroot 0 siblings, 1 reply; 17+ messages in thread From: Fiona Klute via buildroot @ 2025-02-03 13:04 UTC (permalink / raw) To: Arnout Vandecappelle, buildroot; +Cc: Thomas Perale, Christian Stewart Hi Arnout! Am 03.02.25 um 13:48 schrieb Arnout Vandecappelle: > Hi Fiona, > > On 03/02/2025 13:01, Fiona Klute wrote: >> From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de> >> >> Go forces the GOLD linker when dynamically linking Go code, because >> old versions of BFD caused errors. The issue has been fixed in >> Binutils since at least 2.41 according to the upstream description of >> the patch added with this commit [1], and now forcing GOLD causes >> linking failure if ld.gold is not available. The associated Golang >> issue [2] is still open. >> >> Import the patch to stop forcing GOLD. > > This fixes the issue for go-src, but not for go-bin unfortunately... > And go-bin is the default... I'm afraid I can't patch the Go binaries, at least not with reasonable effort. > On the other hand, we don't have any autobuilder failures yet, so > maybe it's a corner case problem and we can live with it until go-bin > gets bumped to 1.23.6 (assuming upstream applies the fix to their stable > branch of course). As I understand the code, the forced option is only applied when building a dynamically linked library, which is probably not very common with Go. I haven't looked more deeply into it, but my current assumption is that containerd started doing that with the 2.0 release, because there haven't been any recent changes to package/binutils (and definitely none disabling Gold). Otherwise the error should've shown up earlier. Best regards, Fiona > Regards, > Arnout > >> >> [1] https://go-review.googlesource.com/c/go/+/391115 >> [2] https://github.com/golang/go/issues/22040 >> >> Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> >> --- >> ...-binutils-gold-dependency-on-aarch64.patch | 70 +++++++++++++++++++ >> 1 file changed, 70 insertions(+) >> create mode 100644 package/go/go-src/0003-cmd-link-stop-forcing- >> binutils-gold-dependency-on-aarch64.patch >> >> diff --git a/package/go/go-src/0003-cmd-link-stop-forcing-binutils- >> gold-dependency-on-aarch64.patch b/package/go/go-src/0003-cmd-link- >> stop-forcing-binutils-gold-dependency-on-aarch64.patch >> new file mode 100644 >> index 0000000000..1ba31b6577 >> --- /dev/null >> +++ b/package/go/go-src/0003-cmd-link-stop-forcing-binutils-gold- >> dependency-on-aarch64.patch >> @@ -0,0 +1,70 @@ >> +From 6d265b008e3d106b2706645e5a88cd8e2fb98953 Mon Sep 17 00:00:00 2001 >> +From: Dirk Müller <dirk@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: https://go-review.googlesource.com/c/go/+/391115 >> +Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> >> +--- >> + >> +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.' > -- Dipl.-Ing. Fiona Klute Mollwitzer Str. 2 44141 Dortmund Germany USt.-ID/VAT number: DE363488944 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/go/go-src: stop forcing binutils-gold dependency on aarch64 2025-02-03 13:04 ` Fiona Klute via buildroot @ 2025-02-03 14:13 ` Arnout Vandecappelle via buildroot 2025-02-03 15:17 ` Fiona Klute via buildroot 0 siblings, 1 reply; 17+ messages in thread From: Arnout Vandecappelle via buildroot @ 2025-02-03 14:13 UTC (permalink / raw) To: Fiona Klute, buildroot; +Cc: Thomas Perale, Christian Stewart On 03/02/2025 14:04, Fiona Klute wrote: > Hi Arnout! > > Am 03.02.25 um 13:48 schrieb Arnout Vandecappelle: >> Hi Fiona, >> >> On 03/02/2025 13:01, Fiona Klute wrote: >>> From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de> >>> >>> Go forces the GOLD linker when dynamically linking Go code, because >>> old versions of BFD caused errors. The issue has been fixed in >>> Binutils since at least 2.41 according to the upstream description of >>> the patch added with this commit [1], and now forcing GOLD causes >>> linking failure if ld.gold is not available. The associated Golang >>> issue [2] is still open. >>> >>> Import the patch to stop forcing GOLD. >> >> This fixes the issue for go-src, but not for go-bin unfortunately... >> And go-bin is the default... > > I'm afraid I can't patch the Go binaries, at least not with reasonable > effort. Oh come on, how hard can it be :-) >> On the other hand, we don't have any autobuilder failures yet, so >> maybe it's a corner case problem and we can live with it until go-bin >> gets bumped to 1.23.6 (assuming upstream applies the fix to their stable >> branch of course). > > As I understand the code, the forced option is only applied when > building a dynamically linked library, which is probably not very common > with Go. I haven't looked more deeply into it, but my current assumption > is that containerd started doing that with the 2.0 release, because > there haven't been any recent changes to package/binutils (and > definitely none disabling Gold). Otherwise the error should've shown up > earlier. Great! In that case, we can either patch containerd to not do that, or (temporarily) make containerd depend on host-go-src (with a big comment explaining why). However, I think it's best to apply this patch and leave containerd + go-bin as broken for a while. If there will be a Go 1.23.6 that fixes the issue, then just bumping Go (both bin and src) is a much easier path forward. Regards, Arnout > > Best regards, > Fiona > >> Regards, >> Arnout >> >>> >>> [1] https://go-review.googlesource.com/c/go/+/391115 >>> [2] https://github.com/golang/go/issues/22040 >>> >>> Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> >>> --- >>> ...-binutils-gold-dependency-on-aarch64.patch | 70 +++++++++++++++++++ >>> 1 file changed, 70 insertions(+) >>> create mode 100644 package/go/go-src/0003-cmd-link-stop-forcing- >>> binutils-gold-dependency-on-aarch64.patch >>> >>> diff --git a/package/go/go-src/0003-cmd-link-stop-forcing-binutils- >>> gold-dependency-on-aarch64.patch b/package/go/go-src/0003-cmd-link- >>> stop-forcing-binutils-gold-dependency-on-aarch64.patch >>> new file mode 100644 >>> index 0000000000..1ba31b6577 >>> --- /dev/null >>> +++ b/package/go/go-src/0003-cmd-link-stop-forcing-binutils-gold- >>> dependency-on-aarch64.patch >>> @@ -0,0 +1,70 @@ >>> +From 6d265b008e3d106b2706645e5a88cd8e2fb98953 Mon Sep 17 00:00:00 2001 >>> +From: Dirk Müller <dirk@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: https://go-review.googlesource.com/c/go/+/391115 >>> +Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> >>> +--- >>> + >>> +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.' >> > > > -- > Dipl.-Ing. Fiona Klute > Mollwitzer Str. 2 > 44141 Dortmund > Germany > > USt.-ID/VAT number: DE363488944 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/go/go-src: stop forcing binutils-gold dependency on aarch64 2025-02-03 14:13 ` Arnout Vandecappelle via buildroot @ 2025-02-03 15:17 ` Fiona Klute via buildroot 2025-02-03 20:08 ` Christian Stewart via buildroot 0 siblings, 1 reply; 17+ messages in thread From: Fiona Klute via buildroot @ 2025-02-03 15:17 UTC (permalink / raw) To: Arnout Vandecappelle, buildroot; +Cc: Thomas Perale, Christian Stewart Hi Arnout! Am 03.02.25 um 15:13 schrieb Arnout Vandecappelle: > > > On 03/02/2025 14:04, Fiona Klute wrote: >> Hi Arnout! >> >> Am 03.02.25 um 13:48 schrieb Arnout Vandecappelle: >>> Hi Fiona, >>> >>> On 03/02/2025 13:01, Fiona Klute wrote: >>>> From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de> >>>> >>>> Go forces the GOLD linker when dynamically linking Go code, because >>>> old versions of BFD caused errors. The issue has been fixed in >>>> Binutils since at least 2.41 according to the upstream description of >>>> the patch added with this commit [1], and now forcing GOLD causes >>>> linking failure if ld.gold is not available. The associated Golang >>>> issue [2] is still open. >>>> >>>> Import the patch to stop forcing GOLD. >>> >>> This fixes the issue for go-src, but not for go-bin unfortunately... >>> And go-bin is the default... >> >> I'm afraid I can't patch the Go binaries, at least not with reasonable >> effort. > > Oh come on, how hard can it be :-) > > >>> On the other hand, we don't have any autobuilder failures yet, so >>> maybe it's a corner case problem and we can live with it until go-bin >>> gets bumped to 1.23.6 (assuming upstream applies the fix to their stable >>> branch of course). >> >> As I understand the code, the forced option is only applied when >> building a dynamically linked library, which is probably not very common >> with Go. I haven't looked more deeply into it, but my current assumption >> is that containerd started doing that with the 2.0 release, because >> there haven't been any recent changes to package/binutils (and >> definitely none disabling Gold). Otherwise the error should've shown up >> earlier. > > Great! In that case, we can either patch containerd to not do that, or > (temporarily) make containerd depend on host-go-src (with a big comment > explaining why). > > However, I think it's best to apply this patch and leave containerd + > go-bin as broken for a while. If there will be a Go 1.23.6 that fixes > the issue, then just bumping Go (both bin and src) is a much easier path > forward. I mostly agree, though there's one catch: I have no idea if the patch will be merged upstream soon. The patch is almost 3 years old by now, and the issue discussion doesn't indicate a plan. If we need a workaround enabling Gold in the Binutils build for the cross toolchain might also be an option, but has two disadvantages: a) It's not going to help people using a pre-built toolchain. b) The Binutils developers seem to be planning to deprecate Gold: https://sourceware.org/pipermail/binutils/2024-October/137319.html (The Debian package changelog is a lot more direct about that.) I hope that point b) hurries things along on the Go side, so I mentioned it in the issue [1]. Best regards, Fiona [1] https://github.com/golang/go/issues/22040#issuecomment-2630848777 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/go/go-src: stop forcing binutils-gold dependency on aarch64 2025-02-03 15:17 ` Fiona Klute via buildroot @ 2025-02-03 20:08 ` Christian Stewart via buildroot 2025-02-04 3:41 ` Christian Stewart via buildroot 0 siblings, 1 reply; 17+ messages in thread From: Christian Stewart via buildroot @ 2025-02-03 20:08 UTC (permalink / raw) To: Fiona Klute; +Cc: Thomas Perale, buildroot Hi all, On Mon, Feb 3, 2025 at 7:17 AM Fiona Klute <fiona.klute@gmx.de> wrote: > If we need a workaround enabling Gold in the Binutils build for the > cross toolchain might also be an option, but has two disadvantages: > > a) It's not going to help people using a pre-built toolchain. > b) The Binutils developers seem to be planning to deprecate Gold: > https://sourceware.org/pipermail/binutils/2024-October/137319.html (The > Debian package changelog is a lot more direct about that.) > > I hope that point b) hurries things along on the Go side, so I mentioned > it in the issue [1]. Can't we just put a fake ld.gold binary in the PATH for Go? Best regards, Christian Stewart _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/go/go-src: stop forcing binutils-gold dependency on aarch64 2025-02-03 20:08 ` Christian Stewart via buildroot @ 2025-02-04 3:41 ` Christian Stewart via buildroot 2025-02-04 6:27 ` yann.morin 2025-02-04 14:50 ` Fiona Klute via buildroot 0 siblings, 2 replies; 17+ messages in thread From: Christian Stewart via buildroot @ 2025-02-04 3:41 UTC (permalink / raw) To: Fiona Klute; +Cc: Thomas Perale, buildroot Hi Fiona, Does this PR more correctly address the situation? https://github.com/golang/go/pull/49748 On Mon, Feb 3, 2025 at 12:08 PM Christian Stewart <christian@aperture.us> wrote: > On Mon, Feb 3, 2025 at 7:17 AM Fiona Klute <fiona.klute@gmx.de> wrote: > > If we need a workaround enabling Gold in the Binutils build for the > > cross toolchain might also be an option, but has two disadvantages: > > > > a) It's not going to help people using a pre-built toolchain. > > b) The Binutils developers seem to be planning to deprecate Gold: > > https://sourceware.org/pipermail/binutils/2024-October/137319.html (The > > Debian package changelog is a lot more direct about that.) > > > > I hope that point b) hurries things along on the Go side, so I mentioned > > it in the issue [1]. > > Can't we just put a fake ld.gold binary in the PATH for Go? Thanks, Christian Stewart _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/go/go-src: stop forcing binutils-gold dependency on aarch64 2025-02-04 3:41 ` Christian Stewart via buildroot @ 2025-02-04 6:27 ` yann.morin 2025-02-04 14:50 ` Fiona Klute via buildroot 1 sibling, 0 replies; 17+ messages in thread From: yann.morin @ 2025-02-04 6:27 UTC (permalink / raw) To: Christian Stewart; +Cc: Fiona Klute, Thomas Perale, buildroot Christian, All, On 2025-02-03 19:41 -0800, Christian Stewart via buildroot spake thusly: > Does this PR more correctly address the situation? > https://github.com/golang/go/pull/49748 That would still not solve the issue with go-bin, as Arnout mentioned earlier. Regards, Yann E. MORIN. -- ____________ .-----------------.--------------------: _ :------------------. | Yann E. MORIN | Real-Time Embedded | __/ ) | /"\ ASCII RIBBON | | | Software Designer | _/ - /' | \ / CAMPAIGN | | +33 638.411.245 '--------------------: (_ `--, | X AGAINST | | yann.morin (at) orange.com |_=" ,--' | / \ HTML MAIL | '--------------------------------------:______/_____:------------------' ____________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you. _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/go/go-src: stop forcing binutils-gold dependency on aarch64 2025-02-04 3:41 ` Christian Stewart via buildroot 2025-02-04 6:27 ` yann.morin @ 2025-02-04 14:50 ` Fiona Klute via buildroot 1 sibling, 0 replies; 17+ messages in thread From: Fiona Klute via buildroot @ 2025-02-04 14:50 UTC (permalink / raw) To: Christian Stewart; +Cc: Thomas Perale, buildroot Hi Christian! Am 04.02.25 um 04:41 schrieb Christian Stewart: > Hi Fiona, > > Does this PR more correctly address the situation? > > https://github.com/golang/go/pull/49748 It would fix my issue while not breaking the build for people who use older toolchains with Gold, so it'd probably be preferable to the other patch if we go with patching go-src. But considering the EXTLDFLAGS approach works I think it's preferable to use that, because it should also work with go-bin. Best regards, Fiona _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/go/go-src: stop forcing binutils-gold dependency on aarch64 2025-02-03 12:01 [Buildroot] [PATCH 1/1] package/go/go-src: stop forcing binutils-gold dependency on aarch64 Fiona Klute via buildroot 2025-02-03 12:48 ` Arnout Vandecappelle via buildroot @ 2025-02-04 6:26 ` yann.morin 2025-02-04 10:52 ` Fiona Klute via buildroot 1 sibling, 1 reply; 17+ messages in thread From: yann.morin @ 2025-02-04 6:26 UTC (permalink / raw) To: Fiona Klute; +Cc: buildroot, Thomas Perale, Christian Stewart Fiona, All, On 2025-02-03 13:01 +0100, Fiona Klute via buildroot spake thusly: > From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de> > > Go forces the GOLD linker when dynamically linking Go code, because > old versions of BFD caused errors. The issue has been fixed in > Binutils since at least 2.41 according to the upstream description of > the patch added with this commit [1], and now forcing GOLD causes > linking failure if ld.gold is not available. The associated Golang > issue [2] is still open. I have send a patch back a while ago, that allowed to at least work around the issue for affected packages: https://patchwork.ozlabs.org/project/buildroot/patch/876f3a7bb6a2375193fc8f06ab856d2449f83727.1699547993.git.yann.morin@orange.com/ This would work for both go-src and go-bin. I needed that for filebeat, but as we no longer use filebeat, I withdrew the patch: https://patchwork.ozlabs.org/project/buildroot/patch/46f20e86fa6c17ada33ede672ffe4229d8bf26a3.1699547993.git.yann.morin@orange.com/ Regards, Yann E. MORIN. > Import the patch to stop forcing GOLD. > > [1] https://go-review.googlesource.com/c/go/+/391115 > [2] https://github.com/golang/go/issues/22040 > > Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> > --- > ...-binutils-gold-dependency-on-aarch64.patch | 70 +++++++++++++++++++ > 1 file changed, 70 insertions(+) > create mode 100644 package/go/go-src/0003-cmd-link-stop-forcing-binutils-gold-dependency-on-aarch64.patch > > diff --git a/package/go/go-src/0003-cmd-link-stop-forcing-binutils-gold-dependency-on-aarch64.patch b/package/go/go-src/0003-cmd-link-stop-forcing-binutils-gold-dependency-on-aarch64.patch > new file mode 100644 > index 0000000000..1ba31b6577 > --- /dev/null > +++ b/package/go/go-src/0003-cmd-link-stop-forcing-binutils-gold-dependency-on-aarch64.patch > @@ -0,0 +1,70 @@ > +From 6d265b008e3d106b2706645e5a88cd8e2fb98953 Mon Sep 17 00:00:00 2001 > +From: Dirk Müller <dirk@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: https://go-review.googlesource.com/c/go/+/391115 > +Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> > +--- > + > +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.' > -- > 2.47.2 > > _______________________________________________ > buildroot mailing list > buildroot@buildroot.org > https://lists.buildroot.org/mailman/listinfo/buildroot -- ____________ .-----------------.--------------------: _ :------------------. | Yann E. MORIN | Real-Time Embedded | __/ ) | /"\ ASCII RIBBON | | | Software Designer | _/ - /' | \ / CAMPAIGN | | +33 638.411.245 '--------------------: (_ `--, | X AGAINST | | yann.morin (at) orange.com |_=" ,--' | / \ HTML MAIL | '--------------------------------------:______/_____:------------------' ____________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you. _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/go/go-src: stop forcing binutils-gold dependency on aarch64 2025-02-04 6:26 ` yann.morin @ 2025-02-04 10:52 ` Fiona Klute via buildroot 2025-02-04 11:13 ` yann.morin 2025-02-04 11:27 ` Arnout Vandecappelle via buildroot 0 siblings, 2 replies; 17+ messages in thread From: Fiona Klute via buildroot @ 2025-02-04 10:52 UTC (permalink / raw) To: yann.morin; +Cc: buildroot, Thomas Perale, Christian Stewart Hi Yann! Am 04.02.25 um 07:26 schrieb yann.morin@orange.com: > Fiona, All, > > On 2025-02-03 13:01 +0100, Fiona Klute via buildroot spake thusly: >> From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de> >> >> Go forces the GOLD linker when dynamically linking Go code, because >> old versions of BFD caused errors. The issue has been fixed in >> Binutils since at least 2.41 according to the upstream description of >> the patch added with this commit [1], and now forcing GOLD causes >> linking failure if ld.gold is not available. The associated Golang >> issue [2] is still open. > > I have send a patch back a while ago, that allowed to at least work > around the issue for affected packages: > > https://patchwork.ozlabs.org/project/buildroot/patch/876f3a7bb6a2375193fc8f06ab856d2449f83727.1699547993.git.yann.morin@orange.com/ > > This would work for both go-src and go-bin. > > I needed that for filebeat, but as we no longer use filebeat, I withdrew > the patch: > > https://patchwork.ozlabs.org/project/buildroot/patch/46f20e86fa6c17ada33ede672ffe4229d8bf26a3.1699547993.git.yann.morin@orange.com/ I think that approach should work, I'm just running a test build to verify. One question though: Is there an existing way to check the Binutils version of an external toolchain? For people with Binutils < 2.41 with ld.gold forcing BFD might actually break things, so ideally I'd want to make the flag conditional on Binutils >= 2.41 (all Buildroot-built toolchains meet that anyway). Or would it be acceptable to simply say that people with old external toolchains are on their own? Best regards, Fiona > Regards, > Yann E. MORIN. > >> Import the patch to stop forcing GOLD. >> >> [1] https://go-review.googlesource.com/c/go/+/391115 >> [2] https://github.com/golang/go/issues/22040 >> >> Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> >> --- >> ...-binutils-gold-dependency-on-aarch64.patch | 70 +++++++++++++++++++ >> 1 file changed, 70 insertions(+) >> create mode 100644 package/go/go-src/0003-cmd-link-stop-forcing-binutils-gold-dependency-on-aarch64.patch >> >> diff --git a/package/go/go-src/0003-cmd-link-stop-forcing-binutils-gold-dependency-on-aarch64.patch b/package/go/go-src/0003-cmd-link-stop-forcing-binutils-gold-dependency-on-aarch64.patch >> new file mode 100644 >> index 0000000000..1ba31b6577 >> --- /dev/null >> +++ b/package/go/go-src/0003-cmd-link-stop-forcing-binutils-gold-dependency-on-aarch64.patch >> @@ -0,0 +1,70 @@ >> +From 6d265b008e3d106b2706645e5a88cd8e2fb98953 Mon Sep 17 00:00:00 2001 >> +From: Dirk Müller <dirk@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: https://go-review.googlesource.com/c/go/+/391115 >> +Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> >> +--- >> + >> +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.' >> -- >> 2.47.2 >> >> _______________________________________________ >> buildroot mailing list >> buildroot@buildroot.org >> https://lists.buildroot.org/mailman/listinfo/buildroot > _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/go/go-src: stop forcing binutils-gold dependency on aarch64 2025-02-04 10:52 ` Fiona Klute via buildroot @ 2025-02-04 11:13 ` yann.morin 2025-02-04 11:37 ` Fiona Klute via buildroot 2025-02-04 11:27 ` Arnout Vandecappelle via buildroot 1 sibling, 1 reply; 17+ messages in thread From: yann.morin @ 2025-02-04 11:13 UTC (permalink / raw) To: Fiona Klute; +Cc: buildroot, Thomas Perale, Christian Stewart Fiona, All, On 2025-02-04 11:52 +0100, Fiona Klute spake thusly: > Am 04.02.25 um 07:26 schrieb yann.morin@orange.com: > > > Go forces the GOLD linker when dynamically linking Go code, because > > > old versions of BFD caused errors. The issue has been fixed in > > > Binutils since at least 2.41 according to the upstream description of > > > the patch added with this commit [1], and now forcing GOLD causes > > > linking failure if ld.gold is not available. The associated Golang > > > issue [2] is still open. > > I have send a patch back a while ago, that allowed to at least work > > around the issue for affected packages: > > https://patchwork.ozlabs.org/project/buildroot/patch/876f3a7bb6a2375193fc8f06ab856d2449f83727.1699547993.git.yann.morin@orange.com/ [--SNIP--] > One question though: Is there an existing way to check the Binutils > version of an external toolchain? For people with Binutils < 2.41 with > ld.gold forcing BFD might actually break things, so ideally I'd want to > make the flag conditional on Binutils >= 2.41 (all Buildroot-built > toolchains meet that anyway). Or would it be acceptable to simply say > that people with old external toolchains are on their own? As noted in my filebeat package patch [0], the ld.bfd issue is supposedly fixed since binutils 2.36, AFAIUI. There, I took the approach that the workaround would not be conditional on the binutils version. First, because there is no way in Buildroot to get that information, especially for external toolchains. Second, because using ld.bfd should always work, using ld.gold only being an optimnisation at build time. I also considered that toolchains too old to even have ld.bfd would just be ignored anyway. ld.bfd was introduced with ld.gold, which was "quite a long time ago" (at least 2011 I believe), so we can assume any rdecent toolchain would be recent enough to have it. So, packages that need to specify "-fuse-ld=bfd" would do so unconditionaly, just maybe for the AArch64 case, which is the only one I know can cause the build failure (not all packages have the issue, as can be explamplified by the fact that we have no such failures in the autobuilders). [0] https://patchwork.ozlabs.org/project/buildroot/patch/46f20e86fa6c17ada33ede672ffe4229d8bf26a3.1699547993.git.yann.morin@orange.com/ Regards, Yann E. MORIN. -- ____________ .-----------------.--------------------: _ :------------------. | Yann E. MORIN | Real-Time Embedded | __/ ) | /"\ ASCII RIBBON | | | Software Designer | _/ - /' | \ / CAMPAIGN | | +33 638.411.245 '--------------------: (_ `--, | X AGAINST | | yann.morin (at) orange.com |_=" ,--' | / \ HTML MAIL | '--------------------------------------:______/_____:------------------' ____________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you. _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/go/go-src: stop forcing binutils-gold dependency on aarch64 2025-02-04 11:13 ` yann.morin @ 2025-02-04 11:37 ` Fiona Klute via buildroot 2025-02-04 12:13 ` yann.morin 0 siblings, 1 reply; 17+ messages in thread From: Fiona Klute via buildroot @ 2025-02-04 11:37 UTC (permalink / raw) To: yann.morin; +Cc: buildroot, Thomas Perale, Christian Stewart Am 04.02.25 um 12:13 schrieb yann.morin@orange.com: > Fiona, All, > > On 2025-02-04 11:52 +0100, Fiona Klute spake thusly: >> Am 04.02.25 um 07:26 schrieb yann.morin@orange.com: >>>> Go forces the GOLD linker when dynamically linking Go code, because >>>> old versions of BFD caused errors. The issue has been fixed in >>>> Binutils since at least 2.41 according to the upstream description of >>>> the patch added with this commit [1], and now forcing GOLD causes >>>> linking failure if ld.gold is not available. The associated Golang >>>> issue [2] is still open. >>> I have send a patch back a while ago, that allowed to at least work >>> around the issue for affected packages: >>> https://patchwork.ozlabs.org/project/buildroot/patch/876f3a7bb6a2375193fc8f06ab856d2449f83727.1699547993.git.yann.morin@orange.com/ > [--SNIP--] >> One question though: Is there an existing way to check the Binutils >> version of an external toolchain? For people with Binutils < 2.41 with >> ld.gold forcing BFD might actually break things, so ideally I'd want to >> make the flag conditional on Binutils >= 2.41 (all Buildroot-built >> toolchains meet that anyway). Or would it be acceptable to simply say >> that people with old external toolchains are on their own? > > As noted in my filebeat package patch [0], the ld.bfd issue is > supposedly fixed since binutils 2.36, AFAIUI. According to the discussion in the Go issue, there was another bug that got fixed with 2.41. https://github.com/golang/go/issues/22040#issuecomment-1430110400 > There, I took the approach that the workaround would not be conditional > on the binutils version. First, because there is no way in Buildroot to > get that information, especially for external toolchains. Second, > because using ld.bfd should always work, using ld.gold only being an > optimnisation at build time. > > I also considered that toolchains too old to even have ld.bfd would just > be ignored anyway. ld.bfd was introduced with ld.gold, which was "quite > a long time ago" (at least 2011 I believe), so we can assume any rdecent > toolchain would be recent enough to have it. > > So, packages that need to specify "-fuse-ld=bfd" would do so > unconditionaly, just maybe for the AArch64 case, which is the only one I > know can cause the build failure (not all packages have the issue, as > can be explamplified by the fact that we have no such failures in the > autobuilders). I like that approach, but as mentioned above the toolchains will have to be a bit more recent. What's odd is that my test build failed. As you can see, with your patch setting CONTAINERD_EXTLDFLAGS += -fuse-ld=bfd works to use ld.bfd, but confusingly there's an error that didn't appear when patching Go: # github.com/containerd/containerd/v2/cmd/containerd /home/fiona/development/buildroot/output/revpi/host/lib/go/pkg/tool/linux_amd64/link: running /home/fiona/development/buildroot/output/revpi/host/bin/aarch64-buildroot-linux-musl-gcc failed: exit status 1 /home/fiona/development/buildroot/output/revpi/host/bin/aarch64-buildroot-linux-musl-gcc -Wl,-z,now -Wl,-z,nocopyreloc -fuse-ld=gold -o $WORK/b001/exe/a.out -rdynamic /tmp/go-link-3508132847/go.o /tmp/go-link-3508132847/000000.o /tmp/go-link-3508132847/000001.o /tmp/go-link-3508132847/000002.o /tmp/go-link-3508132847/000003.o /tmp/go-link-3508132847/000004.o /tmp/go-link-3508132847/000005.o /tmp/go-link-3508132847/000006.o /tmp/go-link-3508132847/000007.o /tmp/go-link-3508132847/000008.o /tmp/go-link-3508132847/000009.o /tmp/go-link-3508132847/000010.o /tmp/go-link-3508132847/000011.o /tmp/go-link-3508132847/000012.o /tmp/go-link-3508132847/000013.o /tmp/go-link-3508132847/000014.o /tmp/go-link-3508132847/000015.o /tmp/go-link-3508132847/000016.o /tmp/go-link-3508132847/000017.o /tmp/go-link-3508132847/000018.o /tmp/go-link-3508132847/000019.o /tmp/go-link-3508132847/000020.o /tmp/go-link-3508132847/000021.o /tmp/go-link-3508132847/000022.o /tmp/go-link-3508132847/000023.o /tmp/go-link-3508132847/000024.o -ztext -lresolv -ztext -lpthread -ztext -ldl -ztext -fuse-ld=bfd /home/fiona/development/buildroot/output/revpi/host/lib/gcc/aarch64-buildroot-linux-musl/13.3.0/../../../../aarch64-buildroot-linux-musl/bin/ld.bfd: read-only segment has dynamic relocations collect2: Fehler: ld gab 1 als Ende-Status zurück Any ideas? Is the different order of arguments messing things up? Best regards, Fiona _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/go/go-src: stop forcing binutils-gold dependency on aarch64 2025-02-04 11:37 ` Fiona Klute via buildroot @ 2025-02-04 12:13 ` yann.morin 2025-02-04 14:37 ` Fiona Klute via buildroot 0 siblings, 1 reply; 17+ messages in thread From: yann.morin @ 2025-02-04 12:13 UTC (permalink / raw) To: Fiona Klute; +Cc: buildroot, Thomas Perale, Christian Stewart Fiona, All, On 2025-02-04 12:37 +0100, Fiona Klute spake thusly: > According to the discussion in the Go issue, there was another bug that > got fixed with 2.41. > https://github.com/golang/go/issues/22040#issuecomment-1430110400 Yes, that's exactly why I needed to pass -fuse-ld=bfd for filebeat but not for arm. > Am 04.02.25 um 12:13 schrieb yann.morin@orange.com: [--SNIP--] > > So, packages that need to specify "-fuse-ld=bfd" would do so > > unconditionaly, just maybe for the AArch64 case, which is the only one I > > know can cause the build failure (not all packages have the issue, as > > can be explamplified by the fact that we have no such failures in the > > autobuilders). > I like that approach, but as mentioned above the toolchains will have to > be a bit more recent. 2.36 worked for me, at least. But unless the toolchains have to be less than a year old, I think it is OK to require that. But now, as you mentioned [0], if gold gets dropped, then I'd expect newer binutils to no longer install ld.bfd either (because there'd be only only linker left). So we'd be back to the case of old toolchains, where gold did not yet exist, and thus ld.bfd did not exist either. So, if we need to be future proof, then we need to design a solution that works in all cases; - old toolchains where gold did not exist, and where ld.bfd did not exist, o it's just 'ld;'; - toolchains where binutils was /configure-d with --disable-gold, so it's just 'ld'; - toolchains where gold exists, and has both ld.bfd and ld.gold, and where we want to use 'ld.bfd'; - future toolchains where gold no longer exists, so it's again just 'ld'. [0] https://github.com/golang/go/issues/22040#issuecomment-2630848777 > What's odd is that my test build failed. As you can see, with your patch > setting CONTAINERD_EXTLDFLAGS += -fuse-ld=bfd works to use ld.bfd, but > confusingly there's an error that didn't appear when patching Go: [--SNIP--] > /home/fiona/development/buildroot/output/revpi/host/lib/gcc/aarch64-buildroot-linux-musl/13.3.0/../../../../aarch64-buildroot-linux-musl/bin/ld.bfd: > read-only segment has dynamic relocations > collect2: Fehler: ld gab 1 als Ende-Status zurück > > Any ideas? Is the different order of arguments messing things up? Ordering of args should not matter: the latter should win. Maybe you can requier verbose output: FOO_EXTLDFLAGS = -fuse-ld=bfd -Wl,--verbose -v Otherwise, no idea, as I am not a go guy... I just had to fiddle with filebeat a few years back, managed to get it fall in place with the referenced change, but other than that, I am just a monkey typing on a keyboard in this go land. ;-) Regards, Yann E. MORIN. -- ____________ .-----------------.--------------------: _ :------------------. | Yann E. MORIN | Real-Time Embedded | __/ ) | /"\ ASCII RIBBON | | | Software Designer | _/ - /' | \ / CAMPAIGN | | +33 638.411.245 '--------------------: (_ `--, | X AGAINST | | yann.morin (at) orange.com |_=" ,--' | / \ HTML MAIL | '--------------------------------------:______/_____:------------------' ____________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you. _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/go/go-src: stop forcing binutils-gold dependency on aarch64 2025-02-04 12:13 ` yann.morin @ 2025-02-04 14:37 ` Fiona Klute via buildroot 0 siblings, 0 replies; 17+ messages in thread From: Fiona Klute via buildroot @ 2025-02-04 14:37 UTC (permalink / raw) To: yann.morin; +Cc: buildroot, Thomas Perale, Christian Stewart Yann, everyone, I've just sent a new patch that sets -fuse-ld=bfd for package/containerd: https://patchwork.ozlabs.org/project/buildroot/patch/20250204143227.1233163-1-fiona.klute@gmx.de/ It works for me (host-go-src, musl), I'd appreciate tests with other toolchains. Best regards, Fiona Am 04.02.25 um 13:13 schrieb yann.morin@orange.com: > Fiona, All, > > On 2025-02-04 12:37 +0100, Fiona Klute spake thusly: >> According to the discussion in the Go issue, there was another bug that >> got fixed with 2.41. >> https://github.com/golang/go/issues/22040#issuecomment-1430110400 > > Yes, that's exactly why I needed to pass -fuse-ld=bfd for filebeat but > not for arm. > >> Am 04.02.25 um 12:13 schrieb yann.morin@orange.com: > [--SNIP--] >>> So, packages that need to specify "-fuse-ld=bfd" would do so >>> unconditionaly, just maybe for the AArch64 case, which is the only one I >>> know can cause the build failure (not all packages have the issue, as >>> can be explamplified by the fact that we have no such failures in the >>> autobuilders). >> I like that approach, but as mentioned above the toolchains will have to >> be a bit more recent. > > 2.36 worked for me, at least. But unless the toolchains have to be less > than a year old, I think it is OK to require that. > > But now, as you mentioned [0], if gold gets dropped, then I'd expect > newer binutils to no longer install ld.bfd either (because there'd be > only only linker left). So we'd be back to the case of old toolchains, > where gold did not yet exist, and thus ld.bfd did not exist either. > > So, if we need to be future proof, then we need to design a solution > that works in all cases; > - old toolchains where gold did not exist, and where ld.bfd did not > exist, o it's just 'ld;'; > - toolchains where binutils was /configure-d with --disable-gold, > so it's just 'ld'; > - toolchains where gold exists, and has both ld.bfd and ld.gold, and > where we want to use 'ld.bfd'; > - future toolchains where gold no longer exists, so it's again just > 'ld'. > > [0] https://github.com/golang/go/issues/22040#issuecomment-2630848777 > >> What's odd is that my test build failed. As you can see, with your patch >> setting CONTAINERD_EXTLDFLAGS += -fuse-ld=bfd works to use ld.bfd, but >> confusingly there's an error that didn't appear when patching Go: > [--SNIP--] >> /home/fiona/development/buildroot/output/revpi/host/lib/gcc/aarch64-buildroot-linux-musl/13.3.0/../../../../aarch64-buildroot-linux-musl/bin/ld.bfd: >> read-only segment has dynamic relocations >> collect2: Fehler: ld gab 1 als Ende-Status zurück >> >> Any ideas? Is the different order of arguments messing things up? > > Ordering of args should not matter: the latter should win. > > Maybe you can requier verbose output: > > FOO_EXTLDFLAGS = -fuse-ld=bfd -Wl,--verbose -v > > Otherwise, no idea, as I am not a go guy... I just had to fiddle with > filebeat a few years back, managed to get it fall in place with the > referenced change, but other than that, I am just a monkey typing on a > keyboard in this go land. ;-) > > Regards, > Yann E. MORIN. > _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/go/go-src: stop forcing binutils-gold dependency on aarch64 2025-02-04 10:52 ` Fiona Klute via buildroot 2025-02-04 11:13 ` yann.morin @ 2025-02-04 11:27 ` Arnout Vandecappelle via buildroot 2025-02-04 14:46 ` Fiona Klute via buildroot 1 sibling, 1 reply; 17+ messages in thread From: Arnout Vandecappelle via buildroot @ 2025-02-04 11:27 UTC (permalink / raw) To: Fiona Klute, yann.morin; +Cc: buildroot, Thomas Perale, Christian Stewart On 04/02/2025 11:52, Fiona Klute via buildroot wrote: > Hi Yann! > > Am 04.02.25 um 07:26 schrieb yann.morin@orange.com: >> Fiona, All, >> >> On 2025-02-03 13:01 +0100, Fiona Klute via buildroot spake thusly: >>> From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de> >>> >>> Go forces the GOLD linker when dynamically linking Go code, because >>> old versions of BFD caused errors. The issue has been fixed in >>> Binutils since at least 2.41 according to the upstream description of >>> the patch added with this commit [1], and now forcing GOLD causes >>> linking failure if ld.gold is not available. The associated Golang >>> issue [2] is still open. >> >> I have send a patch back a while ago, that allowed to at least work >> around the issue for affected packages: >> >> https://patchwork.ozlabs.org/project/buildroot/ >> patch/876f3a7bb6a2375193fc8f06ab856d2449f83727.1699547993.git.yann.morin@orange.com/ >> >> This would work for both go-src and go-bin. >> >> I needed that for filebeat, but as we no longer use filebeat, I withdrew >> the patch: >> >> https://patchwork.ozlabs.org/project/buildroot/ >> patch/46f20e86fa6c17ada33ede672ffe4229d8bf26a3.1699547993.git.yann.morin@orange.com/ > > I think that approach should work, I'm just running a test build to verify. > > One question though: Is there an existing way to check the Binutils > version of an external toolchain? For people with Binutils < 2.41 with The commit message of Yann's patch says "This is supposedly fixed in binutils 2.36". 2.36 is plenty old that we can afford to unconditionally use ld.bfd. However, if it's only _really_ fixed in 2.41: that one only became the default for Buildroot in 2024.05. So I don't really think we can count on it if it's really only fixed in 2.41. > ld.gold forcing BFD might actually break things, so ideally I'd want to > make the flag conditional on Binutils >= 2.41 (all Buildroot-built > toolchains meet that anyway). Or would it be acceptable to simply say > that people with old external toolchains are on their own? Using ld.gold only if it is available sounds like a good approach, but I don't know how easy it is to discover whether or not it is available... Maybe this works: $(wildcard $(shell $(TARGET_CC) -print-prog-name=ld.gold)) BTW regarding Yann's patch: I would give the use-ld flag unconditionally, not on a per-package basis. That way, if there really is a problem with bfd, we have a higher chance of running in to it and therefore fixing it. Regards, Arnout > > Best regards, > Fiona > >> Regards, >> Yann E. MORIN. >> >>> Import the patch to stop forcing GOLD. >>> >>> [1] https://go-review.googlesource.com/c/go/+/391115 >>> [2] https://github.com/golang/go/issues/22040 >>> >>> Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> >>> --- >>> ...-binutils-gold-dependency-on-aarch64.patch | 70 +++++++++++++++++++ >>> 1 file changed, 70 insertions(+) >>> create mode 100644 package/go/go-src/0003-cmd-link-stop-forcing-binutils- >>> gold-dependency-on-aarch64.patch >>> >>> diff --git a/package/go/go-src/0003-cmd-link-stop-forcing-binutils-gold- >>> dependency-on-aarch64.patch b/package/go/go-src/0003-cmd-link-stop-forcing- >>> binutils-gold-dependency-on-aarch64.patch >>> new file mode 100644 >>> index 0000000000..1ba31b6577 >>> --- /dev/null >>> +++ b/package/go/go-src/0003-cmd-link-stop-forcing-binutils-gold-dependency- >>> on-aarch64.patch >>> @@ -0,0 +1,70 @@ >>> +From 6d265b008e3d106b2706645e5a88cd8e2fb98953 Mon Sep 17 00:00:00 2001 >>> +From: Dirk Müller <dirk@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: https://go-review.googlesource.com/c/go/+/391115 >>> +Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> >>> +--- >>> + >>> +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.' >>> -- >>> 2.47.2 >>> >>> _______________________________________________ >>> buildroot mailing list >>> buildroot@buildroot.org >>> https://lists.buildroot.org/mailman/listinfo/buildroot >> > > _______________________________________________ > buildroot mailing list > buildroot@buildroot.org > https://lists.buildroot.org/mailman/listinfo/buildroot _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/go/go-src: stop forcing binutils-gold dependency on aarch64 2025-02-04 11:27 ` Arnout Vandecappelle via buildroot @ 2025-02-04 14:46 ` Fiona Klute via buildroot 0 siblings, 0 replies; 17+ messages in thread From: Fiona Klute via buildroot @ 2025-02-04 14:46 UTC (permalink / raw) To: Arnout Vandecappelle, yann.morin Cc: buildroot, Thomas Perale, Christian Stewart Hi Arnout! Am 04.02.25 um 12:27 schrieb Arnout Vandecappelle: [... snip ...] >> One question though: Is there an existing way to check the Binutils >> version of an external toolchain? For people with Binutils < 2.41 with > > The commit message of Yann's patch says "This is supposedly fixed in > binutils 2.36". 2.36 is plenty old that we can afford to unconditionally > use ld.bfd. > > However, if it's only _really_ fixed in 2.41: that one only became the > default for Buildroot in 2024.05. So I don't really think we can count > on it if it's really only fixed in 2.41. > >> ld.gold forcing BFD might actually break things, so ideally I'd want to >> make the flag conditional on Binutils >= 2.41 (all Buildroot-built >> toolchains meet that anyway). Or would it be acceptable to simply say >> that people with old external toolchains are on their own? > > Using ld.gold only if it is available sounds like a good approach, but > I don't know how easy it is to discover whether or not it is > available... Maybe this works: > > $(wildcard $(shell $(TARGET_CC) -print-prog-name=ld.gold)) > > > BTW regarding Yann's patch: I would give the use-ld flag > unconditionally, not on a per-package basis. That way, if there really > is a problem with bfd, we have a higher chance of running in to it and > therefore fixing it. I'm happy to do that instead of in package/containerd if that's consensus. Which makes me wonder: Would it make sense to provide a *global* config for EXTLDFLAGS (BR2_GO_EXTLDFLAGS or something), which would default to "-fuse-ld=bfd" (plus maybe "-Wl,--no-pie" with musl)? That way people who e.g. use an external toolchain with old Binutils and Gold linker available could adjust it. Best regards, Fiona _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2025-02-04 14:50 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-02-03 12:01 [Buildroot] [PATCH 1/1] package/go/go-src: stop forcing binutils-gold dependency on aarch64 Fiona Klute via buildroot 2025-02-03 12:48 ` Arnout Vandecappelle via buildroot 2025-02-03 13:04 ` Fiona Klute via buildroot 2025-02-03 14:13 ` Arnout Vandecappelle via buildroot 2025-02-03 15:17 ` Fiona Klute via buildroot 2025-02-03 20:08 ` Christian Stewart via buildroot 2025-02-04 3:41 ` Christian Stewart via buildroot 2025-02-04 6:27 ` yann.morin 2025-02-04 14:50 ` Fiona Klute via buildroot 2025-02-04 6:26 ` yann.morin 2025-02-04 10:52 ` Fiona Klute via buildroot 2025-02-04 11:13 ` yann.morin 2025-02-04 11:37 ` Fiona Klute via buildroot 2025-02-04 12:13 ` yann.morin 2025-02-04 14:37 ` Fiona Klute via buildroot 2025-02-04 11:27 ` Arnout Vandecappelle via buildroot 2025-02-04 14:46 ` Fiona Klute via buildroot
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.