Repository navigation
build: inline aarch64 atomics in musl C code instead of linking libgcc - #619
adriencaccia wants to merge 1 commit into
Conversation
The v5.7.0 release failed to link codspeed for aarch64-unknown-linux-musl: dist sets `RUSTFLAGS` for musl targets, which replaces the `-lgcc` from `target.aarch64-unknown-linux-musl.rustflags`, so libbpf's calls to gcc's outline-atomic helpers (`__aarch64_ldadd4_sync`) stayed unresolved. The CI musl-build job runs plain cargo, kept the flag, and passed. Compile the C code with `-mno-outline-atomics` instead, so the atomics are inlined and nothing is needed at link time, whatever `RUSTFLAGS` holds. Refs COD-4123 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryReplaces explicit
Reviews (1) · Last reviewed commit: "build: inline aarch64 atomics in musl C ..." · Reviewed by Greptile |
Merging this PR will not alter performance2 warnings
Comparing Footnotes
|
GuillaumeLagrange
left a comment
There was a problem hiding this comment.
lgtm, @not-matthias FYI in case we ever need to troubleshoot this
The v5.7.0 Release workflow failed to link
codspeedforaarch64-unknown-linux-muslwithundefined reference to __aarch64_ldadd4_sync(job). dist always setsRUSTFLAGSfor musl targets, which makes cargo ignore the-lgccintarget.aarch64-unknown-linux-musl.rustflags, and since #531 the runner links libbpf, whose C code calls gcc's outline-atomic helpers. CI'smusl-buildjob runs plaincargo build, kept the flag, and passed.This compiles the C code with
-mno-outline-atomicsinstead, so the atomics are inlined and the link needs nothing from libgcc.cargo build(CImusl-build)-lgccfrom config)dist build(Release,RUSTFLAGSset)__aarch64_ldadd4_syncundefinedChecked by replaying the dist build in an
ubuntu:26.04arm64 container (gcc 15.2,--profile dist, dist'sRUSTFLAGS):mainfails with the same error, this branch links a static binary that runs.Refs COD-4123