Repository navigation
feat(args): implement --image-base (reld#14) - #165
Merged
Merged
Conversation
The base address was an architecture constant with no way to override it, so `--image-base` was rejected outright. It now threads through the platform Args trait as an `Option<u64>` that defaults to `None`, which leaves every link that does not pass the flag on exactly the address it had. `image-base.sh` comes off the mold skip list. `synthetic-symbols.sh` stays, but for the right reason now: `--image-base` works, and it fails in its second half, where a program defines `__ehdr_start` and friends itself and the synthetic definitions are required to win. Verified against the real thing: `--image-base=0x8000000` puts `.interp` at 0x8000a78 and the binary runs, and `--image-base=0xffffffff80000000` puts `.text` at 0xffffffff80001460, so a kernel-style high base survives as unsigned. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
11 of 20 tasks
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.
Advances #14 (Wave 2 of #153) — one more entry off the mold skip list, from the evidence gathered in #158.
What was missing
The output image's base address was an architecture constant (
Arch::start_memory_address) with no override, so--image-basewas rejected outright. It now threads through the platformArgstrait asOption<u64>defaulting toNone, which leaves every link that does not pass the flag on exactly the address it had — the default is not re-expressed anywhere, so it cannot drift.Verified against the real thing
The second matters: a kernel-style high base has to survive as an unsigned 64-bit value rather than wrapping.
image-base.shcomes off the skip list.synthetic-symbols.sh stays, for the right reason
It was listed under
--image-basetoo. That flag is no longer why it fails: it now gets through the first half and fails in the second, where a program defines__ehdr_start,_end,_etextand friends itself and mold requires the synthetic definitions to win. The comment now says that, so the next person does not go looking at the wrong flag — which is the same mistake #158 fixed across the rest of the list.Verification
cargo test -p reld-core --lib args::elf::tests::image_base_overrides_the_architecture_default— passes; covers the default, both spellings, the high base, and a rejected value.rpath.sh,sframe.sh,trace.sh,weak-export-dso2.sh) that fail identically onmain.cargo test --test acceptance: 212 passed, 11 failed — the same pre-existing environmental failures this host has onmain.cargo fmt --all -- --check,cargo clippy --workspace --all-targets -- -D warnings— clean.🤖 Generated with Claude Code