Repository navigation
fix(target): validate IR layouts and ELF object identities - #217
Merged
Merged
Conversation
Signed-off-by: LunaStev <luna@lunastev.org>
4 tasks done
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
whale ir lower --target bananapreviously accepted an arbitrary target with an AMD64 layout. Select the supportedx86_64-whale-linuxcontract before input I/O, derive its 64-bit little-endian layout, and reject unsupported targets even with--no-verify. Library lowering and verification also reject target/layout mismatches.A dependency-free
whale-targetworkspace crate shares target and object identity between IR and object consumers. Objects retain machine, format, byte order, and address width. Both ELF writer entry points and linker inputs reject unsupported identities before interpreting them as AMD64. Valid AMD64 ELF headers and output bytes remain unchanged.Motivation
Closes #21. Closes #85.
Official reference updates and verified code examples: wavefnd/wave-platform#69 (merge after this implementation).
Aggregate size/offset/stride calculation remains #105. Object reading, ABI code generation, full executable linking, initialization tracking, and weak-symbol precedence are outside this change.
Target and compatibility impact
x86_64-whale-linuxis a supported IR output target. Host triples and other target strings are not accepted aliases.ObjectFile::new(ObjectFormat::ELF64)retains its AMD64 behavior. Explicit metadata usesObjectFile::with_target;object.formatmoves toobject.target.format.ir::DataLayoutandir::Endianremain re-exported at their existing paths. Existing test fixtures now use a supported target to reach their intended validation checks.Validation
Linux x86_64, Rust 1.96.0; all Cargo checks used the lockfile and offline cached dependencies after initial dependency retrieval.
--no-verify.cargo test --workspace --locked --offline: 108 passed.cargo test --workspace --all-features --locked --offline: 130 passed.cargo +1.86.0 test --workspace --all-features --locked --offline --target-dir /tmp/whale-target-msrv: 130 passed.cargo clippy --workspace --all-targets --locked --offline -- -D warnings, with and without--all-features: passed.cargo build --workspace --locked --offline, with and without--all-features: passed;python3 tools/ci_smoke.py --binary target/debug/whale --socket disabled/enabledpassed for the corresponding builds with empty PATH.cargo fmt --all -- --check,git diff --check, and warning-free all-feature workspace rustdoc: passed.python3 -m unittest discover -s tools -p 'test_*.py' -v: 8 passed.Cross-host, QEMU, coverage, and release-mode checks are left to the registered GitHub CI jobs; they were not rerun locally.
Checklist
Signed-off-byline and preserve existing attribution.