Repository navigation
boards: Link libgcc after the user libraries of a protected build. - #21469
Merged
Merged
Conversation
Five boards linked libgcc inside the group of the user libraries of a protected build: at32f437-mini, qemu-armv7r, stm32f4discovery, lm3s6965-ek and fvp-armv8r. Inside the group, the linker takes a function from libgcc as soon as the applications refer to it, before it scans libc again. So a function that both libc and libgcc define comes from libgcc. Link libgcc after the group, as the other boards do. Today no function in these images is in both, so the images keep the same archive members, and only the place of the libgcc code changes. [skip-cmake-parity] Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]>
casaroli
requested review from
GUIDINGLI,
jerpelea,
xiaoxiang781216,
yamt and
yf13
as code owners
November 5, 2026 02:32
|
xiaoxiang781216
approved these changes
Nov 5, 2026
acassis
approved these changes
Nov 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Five boards linked libgcc inside the group of the user libraries of a protected build: at32f437-mini, qemu-armv7r, stm32f4discovery, lm3s6965-ek and fvp-armv8r. Inside the group, the linker takes a function from libgcc as soon as the applications refer to it, before it scans libc again. So a function that both libc and libgcc define comes from libgcc.
This PR links libgcc after the group, as the other boards do:
--start-group $(USER_LDLIBS) --end-group $(USER_LIBGCC)in place of--start-group $(USER_LDLIBS) $(USER_LIBGCC) --end-group.Today no function in these images is in both, so this PR fixes nothing that a program can see. It matters when libc defines such a function, as #20723 does for
__emutls_get_address(): with the old order these boards link the copy of libgcc.[skip-cmake-parity]: only these five Make files have this order.Impact
Only the user image of a protected build of the five boards, with Make. The images keep the same archive members and the same symbols. The libgcc code moves to another place in the image. No ABI change. Not a breaking change.
Testing
Link maps with and without this PR, on master 6b9b216, Arm GNU 13.2 and AArch64 GNU 14.2:
lm3s6965-ek:qemu-protectedfvp-armv8r:pnshnmof the user image, with and without this PR:qemu-armv7r:pnsh,stm32f4discovery:kostest,lm3s6965-ek:qemu-kostest,lm3s6965-ek:qemu-protectedandfvp-armv8r:pnshhave the same symbols. These images were not run. at32f437-mini has no protected configuration in the tree, so its Makefile is not built.With #20723 and a program with a
__threadvariable, the user image links libgcc'semutls.owithout this PR and libc'stls_emutls.owith it, onlm3s6965-ek:qemu-protectedandfvp-armv8r:pnsh.Builds with
EXTRAFLAGS="-Wno-cpp -Werror", each OK: the five configurations above, and qemu-armv8a:nsh, rv-virt:pnsh64, mps2-an500:knsh.tools/checkpatch.sh -c -u -m -gpasses.