Repository navigation
test(acceptance): pin SHF_GNU_RETAIN survives --gc-sections (reld#123 Phase 2) - #147
Merged
Merged
Conversation
… Phase 2) reld already honors SHF_GNU_RETAIN (should_retain -> must_load), but had no test. Add a fixture where an unreferenced `__attribute__((used))` section must survive --gc-sections. Co-Authored-By: Claude Code <[email protected]>
…hase 2) The fixture defined main() but linked without a CRT, so reld warned it could not find the _start entry symbol. Drive the link through gcc (-Wl,--gc-sections) so crt0 supplies _start, matching trivial-main. Co-Authored-By: Claude Code <[email protected]>
…23 Phase 2) C's __attribute__((used)) does not set SHF_GNU_RETAIN, so the fixture was silently GC'd. Use __attribute__((retain)) (the C equivalent of Rust's #[used]) so the section carries SHF_GNU_RETAIN and survives --gc-sections. Co-Authored-By: Claude Code <[email protected]>
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.
What
reld already honors
SHF_GNU_RETAINin GC (should_retain()→must_load), but had no test pinning it. Add a fixture where an unreferenced__attribute__((used))section must survive--gc-sections.Part of reld#123 Phase 2 (
SHF_GNU_RETAINhonored in GC, with a test).Verification
--gc-sections+ExpectSymasserts the retained symbol's section survives.🤖 Generated with Claude Code