Skip to content

build: inline aarch64 atomics in musl C code instead of linking libgcc - #619

Open
adriencaccia wants to merge 1 commit into
mainfrom
cod-4123-release-valgrind-codspeed-and-runner
Open

adriencaccia wants to merge 1 commit into
mainfrom
cod-4123-release-valgrind-codspeed-and-runner

Conversation

@adriencaccia

Copy link
Copy Markdown
Member

The v5.7.0 Release workflow failed to link codspeed for aarch64-unknown-linux-musl with undefined reference to __aarch64_ldadd4_sync (job). dist always sets RUSTFLAGS for musl targets, which makes cargo ignore the -lgcc in target.aarch64-unknown-linux-musl.rustflags, and since #531 the runner links libbpf, whose C code calls gcc's outline-atomic helpers. CI's musl-build job runs plain cargo build, kept the flag, and passed.

This compiles the C code with -mno-outline-atomics instead, so the atomics are inlined and the link needs nothing from libgcc.

aarch64 musl build Before Now
cargo build (CI musl-build) links (-lgcc from config) links
dist build (Release, RUSTFLAGS set) fails: __aarch64_ldadd4_sync undefined links

Checked by replaying the dist build in an ubuntu:26.04 arm64 container (gcc 15.2, --profile dist, dist's RUSTFLAGS): main fails with the same error, this branch links a static binary that runs.

Refs COD-4123

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>
@greptile-apps

greptile-apps Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Replaces explicit libgcc linking with -mno-outline-atomics for AArch64 musl C builds.

  • Aarch64 musl C code inlines atomics before linking.

Reviews (1) · Last reviewed commit: "build: inline aarch64 atomics in musl C ..." · Reviewed by Greptile

@codspeed

codspeed Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

2 warnings

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚠️ 8 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 53 untouched benchmarks
⏩ 6 skipped benchmarks1


Comparing cod-4123-release-valgrind-codspeed-and-runner (df1e3ad) with main (34b48f1)

Open in CodSpeed

Footnotes

  1. 6 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@GuillaumeLagrange GuillaumeLagrange left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, @not-matthias FYI in case we ever need to troubleshoot this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants