Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.20 linux/amd64
Does this issue reproduce with the latest release?
Yes, by cross compiling kubernetes/kubernetes@b7ad179 to the linux/arm
platform.
What operating system and processor architecture are you using (go env
)?
We build in a custom container image registry.k8s.io/build-image/kube-cross
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/go/src/k8s.io/kubernetes/.cache/go-build" GOENV="/go/src/k8s.io/kubernetes/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.20" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/dev/null" GOWORK="" CGO_CFLAGS="-O2 -g" CGO_CPPFLAGS="" CGO_CXXFLAGS="-O2 -g" CGO_FFLAGS="-O2 -g" CGO_LDFLAGS="-O2 -g" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp.k8s/go-build942910395=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Running make release
in the root of the Kubernetes repository. Everything gets built successfully, except the k8s.io/kubernetes/test/e2e_node.test
, which fails with:
/usr/local/go/pkg/tool/linux_amd64/link: running arm-linux-gnueabihf-gcc failed: exit status 1
/tmp.k8s/go-link-865684912/go.o: in function `k8s.io/kubernetes/vendor/github.com/aws/aws-sdk-go/service/ec2.(*ModifyCapacityReservationInput).GoString':
go.go:(.text+0x207ca88): relocation truncated to fit: R_ARM_CALL against `runtime.duffcopy'
go.go:(.text+0x207ca94): relocation truncated to fit: R_ARM_CALL against `runtime.duffcopy'
collect2: error: ld returned 1 exit status
A small patch can be applied to make it fail faster for reproduction:
diff --git a/hack/make-rules/cross.sh b/hack/make-rules/cross.sh
index f8a6d0dbf5e..1a7a19ff307 100755
--- a/hack/make-rules/cross.sh
+++ b/hack/make-rules/cross.sh
@@ -27,12 +27,12 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
# NOTE: Using "${array[*]}" here is correct. [@] becomes distinct words (in
# bash parlance).
-make all WHAT="${KUBE_SERVER_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_SERVER_PLATFORMS[*]}"
+#make all WHAT="${KUBE_SERVER_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_SERVER_PLATFORMS[*]}"
-make all WHAT="${KUBE_NODE_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_NODE_PLATFORMS[*]}"
+#make all WHAT="${KUBE_NODE_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_NODE_PLATFORMS[*]}"
-make all WHAT="${KUBE_CLIENT_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_CLIENT_PLATFORMS[*]}"
+#make all WHAT="${KUBE_CLIENT_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_CLIENT_PLATFORMS[*]}"
-make all WHAT="${KUBE_TEST_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_TEST_PLATFORMS[*]}"
+#make all WHAT="${KUBE_TEST_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_TEST_PLATFORMS[*]}"
-make all WHAT="${KUBE_TEST_SERVER_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_TEST_SERVER_PLATFORMS[*]}"
+make all WHAT="test/e2e_node/e2e_node.test" KUBE_BUILD_PLATFORMS="linux/arm"
Setting CGO_CFLAGS=-mlong-calls
does not help, disabling CGO does provide a workaround.
Source code changes seem to have impact on the issue, because the build works with the next commit kubernetes/kubernetes@b0171f7
Ref: kubernetes/kubernetes#115613, kubernetes/kubernetes#115605
What did you expect to see?
That the test binary compiles correctly with CGO enabled.
What did you see instead?
The link failure.
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
linux/arm
kubernetes/kubernetes#115613saschagrunert commentedon Feb 9, 2023
Copying from kubernetes/kubernetes#115605 (comment)
Reproducer with a Dockerfile, on kubernetes/kubernetes@b7ad179:
tpaschalis commentedon Feb 10, 2023
We're also having this issue when cross-compiling the Grafana Agent on ARMv6/ARMv7. I've posted some details on #58428
dr2chase commentedon Feb 10, 2023
@golang/compiler
thanm commentedon Feb 10, 2023
I'll take a look.
liggitt commentedon Feb 10, 2023
I bisected to 833367e:
Notes:
Reproducer:
Output is:
That commit defaulted
GOEXPERIMENT=Unified
on. Starting to run the bisection again with that experiment on in the invocationliggitt commentedon Feb 10, 2023
Building go1.19.5 with
GOEXPERIMENT=Unified
reproduces therelocation truncated to fit: R_ARM_CALL against 'runtime.duffcopy'
issue, so it looks like the unified build regresses on armliggitt commentedon Feb 10, 2023
cc @mdempsky
77 remaining items
gopherbot commentedon Oct 2, 2023
Change https://go.dev/cl/532096 mentions this issue:
cmd/link: split text sections for arm 32-bit
gopherbot commentedon Oct 2, 2023
Change https://go.dev/cl/532097 mentions this issue:
cmd/link: split text sections for arm 32-bit
[release-branch.go1.21] cmd/link: split text sections for arm 32-bit
[release-branch.go1.20] cmd/link: split text sections for arm 32-bit
Prometheus: (Experimental) Inject label matchers into queries (also c…