Go version
go1.25rc2
Output of go env
in your module/workspace:
Unknown at this time.
What did you do?
Running through GitHub CI runners on x64 host platform cross compiling, we are seeing linker failures running the go test -c
command with the -race flag enabled on aarch64 and s390x platforms under 1.25.rc2. The same tests compile without the -race flag on all platforms properly.
Of note we aren't seeing the linker failures other platforms such as armv6, armv7, 386, x64.
This does seem to work properly using 1.24.4 and previous versions of Go.
See: https://github.com/petermattis/goid/actions/runs/16358274496/job/46221706467?pr=61
What did you see happen?
The following error is returned
+ go test -c -race -o goid.race.test ./...
# github.com/petermattis/goid.test
/opt/hostedtoolcache/go/1.25.0-rc.2/x64/pkg/tool/linux_amd64/link: running aarch64-linux-gnu-gcc failed: exit status 1
/usr/bin/aarch64-linux-gnu-gcc -Wl,--build-id=0xd0880a43064c97283ad4ffa2b14213a6c4ad456c -o $WORK/b001/goid.test -Wl,--export-dynamic-symbol=_cgo_panic -Wl,--export-dynamic-symbol=_cgo_topofstack -Wl,--export-dynamic-symbol=crosscall2 -Wl,--compress-debug-sections=zlib /tmp/go-link-1830713424/go.o /tmp/go-link-1830713424/000000.o /tmp/go-link-1830713424/000001.o /tmp/go-link-1830713424/000002.o /tmp/go-link-1830713424/000003.o /tmp/go-link-1830713424/000004.o /tmp/go-link-1830713424/000005.o /tmp/go-link-1830713424/000006.o /tmp/go-link-1830713424/000007.o /tmp/go-link-1830713424/000008.o /tmp/go-link-1830713424/000009.o /tmp/go-link-1830713424/000010.o /tmp/go-link-1830713424/000011.o /tmp/go-link-1830713424/000012.o /tmp/go-link-1830713424/000013.o /tmp/go-link-1830713424/000014.o /tmp/go-link-1830713424/000015.o /tmp/go-link-1830713424/000016.o -O2 -g -O2 -g -lpthread -no-pie
/tmp/go-link-1830713424/000002.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
What did you expect to see?
All supported platforms should be able to compile the test suite with the -race flag, considering this seems to work properly using prior versions of Go.
Comment From: gabyhelp
Related Issues
- Crosscompile with race detector fails with fault and panic #49102 (closed)
- cmd/dist/test: -race flag not supported for linux/s390x although cmd/internal/sys/supported begs to differ #53981 (closed)
- testing: go test fails with -race and test that calls flag.Parse() (go 1.13) #34073 (closed)
- cmd/link: fail to build with -race (unrecognized relocation (0x2a) in section `.text') #54060 (closed)
- arm64 race detector link errors #49749 (closed)
- cmd/go: cross-compiling for Linux x86_64 with CGO -race enabled failed on macOS Mojave (Darwin) #30863 (closed)
- cmd/link: -gcflags=-race causes panic #42396 (closed)
- vendor/golang.org/x/arch/arm64/arm64asm: Go 1.10.beta1: test failures #23237 (closed)
- runtime: `linux/s390x` `ThreadSanitizer failed to allocate 0x7e0000 (8257536) bytes at address 900000180000 (errno: 12)` in QEMU #67881
- runtime/race: llvm-unstable changes break Go tests with -race: panic: release of handle with refcount 0 #70283 (closed)
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Comment From: cherrymui
curl --location --output "$(go env GOROOT)"/src/runtime/race/race_linux_"$GOARCH".syso \ https://github.com/golang/go/raw/release-branch.go1.25.0-rc.2/src/runtime/race/race_linux_"$GOARCH".syso
I don't know how you get that URL, but that just gives 404. Try https://github.com/golang/go/raw/release-branch.go1.25/src/runtime/race/race_linux_arm64.syso
The "file format not recognized" error is probably just that the "object file" is actually a 404 page.
Comment From: stevendpclark
Oops thanks @cherrymui for getting back to me on this so quickly.
Comment From: tamird
Yes, this is PEBKAC. The CI script tries to download from https://github.com/golang/go/raw/release-branch.go${{ matrix.go }}/src/runtime/race/race_linux_"$GOARCH".syso
which doesn't work when we're using an RC.
I fixed it in https://github.com/petermattis/goid/pull/61/commits/173a0336d19f33cb749bd0ceb255a228d23a10cc.