Conversation
…AArch64) Two wit-bindgen cores both export cabi_realloc, so co-linking their relocatable objects failed with a duplicate symbol and needed an objcopy --localize-symbol step outside synth. --local-export NAME (repeatable) binds that export name LOCAL in the ARM Thumb-2/A32 relocatable builder and in the shared AArch64 object plan (ELF and Mach-O); the function stays in the object and .text is unchanged. Recorded in the provenance sidecar (local_exports) and SBOM (synth:local-export). Refused loudly for a name the object does not export, __synth_start, a set leaving nothing GLOBAL, self-contained images, the single-function path, RV32, x86-64 and the transpiler backends. Evidence: real-linker co-link test (red without the flag) on cortex-m3, cortex-r5 and aarch64; hosted execution oracle vs kiln; byte-identity sweep 1245 identical / 0 differing without the flag. oracle-kiln.yml: "2 passed" integration count 1 -> 2 plus the new ORACLE pin. Refs #1726 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L
The co-link legs skipped when neither arm-none-eabi-ld nor ld.lld was on PATH, and CI's Test job installs neither, so the red/green link evidence would have passed vacuously there. The mandatory leg now resolves rust-lld from the Rust toolchain (`rustc --print sysroot` -> lib/rustlib/<host>/bin/rust-lld, `-flavor gnu`) for the cortex-m3, cortex-r5 and aarch64 configurations, and FAILS with a message when it is missing. PATH linkers remain optional extra legs. Refs #1726 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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
A wit-bindgen core always exports
cabi_reallocandcabi_realloc_wit_bindgen_<ver>, and synth bound every wasm export GLOBAL. Two such objects could not be linked into one image (duplicate symbol: cabi_realloc). gale worked around this withobjcopy --localize-symbol, an edit made after synth that synth's provenance never recorded.synth compile --local-export NAME(repeatable) binds that export nameSTB_LOCALin the relocatable object instead of GLOBAL..textis byte-identical to the compile without the flag. The flag works per name: another export name of the same function stays GLOBAL unless you name it too.build_relocatable_elfbinds the export symbol, or its alias, LOCAL. The builder's existing locals-first sort keeps symbol order andsh_infocorrect.ObjectFunction::local_symbolsis read in the sharedplan_object, so both containers agree by construction. Mach-O shows the symbol asnon-external.--emit-provenancesidecar gets"local_exports"(left out when empty). The--sbommetadata gets asynth:local-exportproperty for each name.__synth_start, which the embedder must call from outside;--func-name/--func-index --relocatablecompile;-b riscv: the RV32 writer binds every function symbol GLOBAL and has no locals-first ordering;-b x86_64, through its refused-flag list;__synth_start. The__synth_prefix is already refused as an export name (Relocatable objects define only one name per function: other export names of the same index are silently dropped #1746), and no path emits an async-edge export.Evidence
Real-linker co-link (
crates/synth-cli/tests/local_export_1726.rs). Two modules both exportcabi_realloc, plusa_entryorb_entry. Each pair gets a final link (-e a_entry).The mandatory linker is the Rust toolchain's own
rust-lldin its GNU flavor (rustc --print sysroot→lib/rustlib/<host>/bin/rust-lld -flavor gnu). Every CI job that runscargo testhas it, so the link legs never skip. Ifrust-lldis missing, the test FAILS with a message; I checked this with a fake sysroot.arm-none-eabi-ldandld.lldon PATH add optional extra legs.--local-export cabi_realloc--relocatableduplicate symbol: cabi_realloc/multiple definition of 'cabi_realloc'cabi_reallocLOCAL ×2 in the image, entries GLOBAL--relocatable-b aarch64duplicate symbol: cabi_reallocobjectcrate. With the flag,cabi_reallocis exactly one LOCAL defined symbol, the entries stay GLOBAL, every LOCAL precedes every non-local, andsh_infopoints at the first non-local. Without the flag, the GLOBAL definitions the two objects share are exactly{cabi_realloc}.--local-exportobjects withrust-lld -flavor gnufor all three configs. All three were refused withduplicate symbol: cabi_realloc.object_plan::local_symbols_are_planned_local_and_ordered_first_1726checks the binding, the growth of the locals-first prefix, relocation resolution through the reordering, and unchanged text.Execution (
crates/synth-oracle/tests/local_export_1726_oracle.rs, hosted harness against kiln):a_entry→ LOCALcabi_realloc, 5-call sequence through linear memory, cortex-m4 + cortex-m3.textwith the flag vs withoutoracle-kiln.yml:ORACLE local-export: 10 steps agree with kiln across 2 targets;2 passedmoves from 1 to 2, because this binary is the second one.I replayed the step's whole
run:block against a localCARGO_TERM_COLOR=alwayslog ofcargo test -p synth-oracle --features exec. Exit 0.Byte identity without the flag. Base binary main
c0bd12a3against this branch. Inputs: every.wat/.wasmunderscripts/repro,tests,examples(278 files). Configurations (7):-t cortex-r5image,-t cortex-m4fimage,-t cortex-m3 --relocatable, the same with--emit-provenance --sbom(sidecars compared,SOURCE_DATE_EPOCHpinned),-t cortex-r5 --relocatable,-b aarch64,-b riscv.Gates
cargo fmt --checkcargo +1.100.0 clippy --workspace --all-targets -- -D warningscargo clippy -p synth-oracle --features exec --all-targets -- -D warningscargo test -p synth-cli --no-fail-fast(incl.frozen_codegen_bytes, 10 passed)cargo test -p synth-core -p synth-backend-aarch64 -p synth-backend-x86_64 --no-fail-fastcargo test -p synth-oracle/--features exec--features exec: first commit; no oracle code changed in the rust-lld commit)scripts/claim_check.py claims.yaml(82/82) and--metricoracle-wiring-checkDocs
docs/embedder-abi-relocatable-arm.md("Keeping an export out of the link");docs/embedder-abi-relocatable-aarch64.md;FEATURE_MATRIX: a new row plus the CLI row. I edited the templatescripts/templates/feature_matrix.md.tmpland regenerated with--emit-status.Not in this PR
func_Nlabels are GLOBAL. Localizing exports there alone would not make two RV32 objects co-link, so the flag is refused by name on RV32.Refs #1726
🤖 Generated with Claude Code
https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L