mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-12 18:59:50 +03:00
community/go: remove dependency on binutils-gold
Unmaintained upstream and pending for removal: https://sourceware.org/pipermail/binutils/2025-February/139195.html This fixes build of k3s and kubernetes with go 1.24.5 on aarch64. Ref: https://github.com/golang/go/issues/22040
This commit is contained in:
parent
abaf8726ef
commit
a65df52543
2 changed files with 74 additions and 9 deletions
|
@ -4,27 +4,21 @@ maintainer="fossdd <fossdd@pwned.life>"
|
|||
pkgname=go
|
||||
# go binaries are statically linked, security updates require rebuilds
|
||||
pkgver=1.24.5
|
||||
pkgrel=0
|
||||
pkgrel=1
|
||||
pkgdesc="Go programming language compiler"
|
||||
url="https://go.dev/"
|
||||
arch="all"
|
||||
license="BSD-3-Clause"
|
||||
depends="binutils gcc musl-dev"
|
||||
makedepends="bash"
|
||||
checkdepends="binutils-gold git git-daemon"
|
||||
checkdepends="git git-daemon"
|
||||
subpackages="$pkgname-doc"
|
||||
source="https://go.dev/dl/go$pkgver.src.tar.gz
|
||||
0001-cmd-link-prefer-musl-s-over-glibc-s-ld.so-during-dyn.patch
|
||||
0002-go.env-Don-t-switch-Go-toolchain-version-as-directed.patch
|
||||
tests-fchmodat-not-supported.patch
|
||||
drop-binutils-gold-dep.patch
|
||||
"
|
||||
case "$CARCH" in
|
||||
arm*|aarch64) depends="$depends binutils-gold";;
|
||||
riscv64|loongarch64)
|
||||
# binutils-gold is not supported on riscv64 and loongarch64.
|
||||
checkdepends="${checkdepends/binutils-gold/}"
|
||||
;;
|
||||
esac
|
||||
|
||||
# secfixes:
|
||||
# 0:
|
||||
|
@ -324,4 +318,5 @@ sha512sums="
|
|||
34dbe032c5f08dd8a7aad36fc4d54e746a876fdadc25466888a2f04f5a9d53103190ebd68d3cf978d3a041976185e30ffb25611fb577d031c159810d2d4c7c41 0001-cmd-link-prefer-musl-s-over-glibc-s-ld.so-during-dyn.patch
|
||||
8061e4ef9d7dd31804bd8d98c95afa5dd82567940b3436f45f874e0419e324b49713d8a814df04617e575ec3c6155199c4661352ea8aef63ead81ca3020f3dc4 0002-go.env-Don-t-switch-Go-toolchain-version-as-directed.patch
|
||||
33ecefca77fa0af52a3b2b66a76977af27a88c8dddb89f03e0a5ae6794b9aac53a62d7be33020b49022e9a89d4cdfa383038ee10e160eb94548b2430bf3cfb5e tests-fchmodat-not-supported.patch
|
||||
9ea8720fc19110ae823be29fae94a9851045b555985a95b33dd7a449c3a1c0e6841991889d8dc2ce3290b171b5510af53a6064cff91b42fafbba5cda44686549 drop-binutils-gold-dep.patch
|
||||
"
|
||||
|
|
70
community/go/drop-binutils-gold-dep.patch
Normal file
70
community/go/drop-binutils-gold-dep.patch
Normal file
|
@ -0,0 +1,70 @@
|
|||
Patch-Source: https://go-review.googlesource.com/c/go/+/391115
|
||||
---
|
||||
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
|
||||
---
|
||||
|
||||
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.'
|
Loading…
Add table
Add a link
Reference in a new issue