Repository navigation
feat(elf): emit DF_TEXTREL for text relocations (reld#123 Phase 2) - #145
Merged
Merged
Conversation
zackees
force-pushed
the
phase2-df-textrel
branch
2 times, most recently
from
September 16, 2026 21:58
7a0dbb8 to
426d009
Compare
reld produced text relocations (an absolute relocation to a non-writable section) without setting DF_TEXTREL, so a loader would apply them without making the text segment writable. Track text relocations and set DF_TEXTREL in DT_FLAGS. Add a textrel fixture (non-PIC shared object) to pin the behavior against bfd/lld references. This resolves the gap found while descoping the `-z notext` TEXTREL test (reld#123 D3 "TEXTREL presence"). Co-Authored-By: Claude Code <[email protected]>
zackees
force-pushed
the
phase2-df-textrel
branch
from
September 16, 2026 22:05
426d009 to
0ed93b7
Compare
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
Fixes a correctness gap: reld produced text relocations (an absolute relocation to a non-writable section of a relocatable output) but never set
DF_TEXTREL, so a dynamic loader would apply the relocation without first making the text segment writable.Change
Track
has_text_relocationsthroughLayoutResources→GcOutputs→Layout→DynamicEntryInputs, set it in the relocation path for absolute relocations to non-writable sections of a relocatable output (shared object / PIE), and includeDF_TEXTRELindt_flags().Notes
.rela.dynemission (and a difftest fixture) is deferred: reld's text-relocation output still diverges from bfd/lld on several dynamic tags (DT_RELA,DT_RELAENT, old-vs-newDT_TEXTREL, unconditionalDF_1_NOW), which is a larger Phase 2/3 text-relocation-support item. This PR lands theDF_TEXTRELflag emission only.Verification
cargo test -p reld-core --lib— 202 pass.cargo clippy -p reld-core --all-targets -- -D warnings— clean.cargo fmt --check— clean.🤖 Generated with Claude Code