From 03e8715acbf1cff26feeef216e77db3c1fdd679f Mon Sep 17 00:00:00 2001 From: Tom Wieczorek Date: Thu, 27 Jun 2024 17:38:10 +0200 Subject: [PATCH] Only require gold linker on ARM This is an upstream requirement of Go. Since gold is not available on every architecture, let's just use it where it's required. Signed-off-by: Tom Wieczorek --- build/Dockerfile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/build/Dockerfile b/build/Dockerfile index 158887c48fe8..5a39abe9e8d2 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,6 +1,15 @@ ARG BUILDIMAGE FROM $BUILDIMAGE -RUN apk add --no-cache make gcc musl-dev binutils-gold + +ARG TARGETARCH +RUN set -ex; \ +# Need to use the gold linker on ARM, Go really wants to have it. +# https://github.com/golang/go/blob/go1.22.4/src/cmd/link/internal/ld/lib.go#L1622-L1641 + case "$TARGETARCH" in \ + arm*) binutils=binutils-gold ;; \ + *) binutils=binutils ;; \ + esac; \ + apk add --no-cache make gcc musl-dev "$binutils" ENV \ HOME="/run/k0s-build" \