-
Notifications
You must be signed in to change notification settings - Fork 9
GCC linking fails due to incorrect libgcc link order #53
Copy link
Copy link
Labels
bugSomething isn't workingSomething isn't workingfeatureNew feature requestNew feature requesthelp wantedExtra attention is neededExtra attention is neededp3Medium/Low - handle it within normal processMedium/Low - handle it within normal processtemplateAdd or update template toolchain configurationsAdd or update template toolchain configurationswipWork in progressWork in progress
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfeatureNew feature requestNew feature requesthelp wantedExtra attention is neededExtra attention is neededp3Medium/Low - handle it within normal processMedium/Low - handle it within normal processtemplateAdd or update template toolchain configurationsAdd or update template toolchain configurationswipWork in progressWork in progress
Description
We are encountering linker failures on AArch64 builds caused by unresolved outlined atomic helper symbols such as:
These symbols are emitted by GCC when compiling with outlined atomics (default on AArch64) and are expected to be resolved from
libgcc.We verified that the toolchain-provided
libgcc.adoes contain these symbols, so the issue is not missing runtime support.Root Cause
Root Cause
The problem appears to be link order / link grouping when using static libraries:
-Wl,-Bstatic)-nodefaultlibsis enabled, so runtime libraries must be added explicitlylibgccis either:Because of this, the linker does not pull in the required objects from
libgcc.awhen resolving references originating from later static libraries.This is a standard static linking behavior: archives are only searched once, left-to-right.
Proposed Fix
Ensure that
libgcc(and related runtime libs) are linked after all static libraries that may reference them.Two valid approaches:
Option 1 — Late linkage
Add at the end of the link command:
Option 2 — Link group (more robust for large static graphs)
Expected Changes ot work products
Impact analysis
NA
Safety or Security relevance
Expected required ASIL classification
QM
Expected Implementation Version (Release)
1.0