Conversation
…#538) Milestone-1c: `synth compile x.wat -b aarch64` wrapped the correct A64 `.text` in the CLI's ARM ELF container (ELF32 / EM_ARM / ET_EXEC) instead of the AArch64 backend's own EM_AARCH64 ELF64 relocatable object. The codegen was already correct; only the container was wrong. Both CLI ELF-assembly sites are fixed by routing on `backend.name() == "aarch64"` (not target family — `cortex_a53()` is `ArchFamily::ArmCortexA` with isa AArch64, so a family check would misroute into the ARM builder): - multi-function `--all-exports` path: new first arm in the `elf_data` match (ahead of `has_external_relocations || relocatable`, so `-b aarch64 --relocatable` isn't stolen into the ARM builder), plus `is_aarch64` folded into `produced_relocatable` and `dwarf_effective`. - single-function path: mirror the same branch. Both delegate to the backend's existing, unit-tested `synth_backend_aarch64::elf::build_relocatable_object`, mirroring the RISC-V `build_multi_func_riscv_elf` precedent. ARM and RISC-V ELF paths are untouched. Verification: - pyelftools on the acceptance object: ELFCLASS64 / EM_AARCH64 (183) / ET_REL with global STT_FUNC symbols add, muladd, const_sub, xor_or. - scripts/repro/aarch64_add_538_differential.py: PASS (8/8 vs wasmtime). - frozen_codegen_bytes 3/3 (control_step 0x00210A55, flight_algo 0x07FDF307 unchanged — ARM/RV32 output bit-identical). - cargo fmt --check clean; clippy -D warnings clean on synth-cli + synth-backend-aarch64; both crates' test suites green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem (#546, milestone-1c)
synth compile x.wat -b aarch64produced correct A64 machine code but wrapped it in the CLI's ARM ELF container (ELF32 / EM_ARM / ET_EXEC) instead of the AArch64 backend's own EM_AARCH64 ELF64 relocatable object. The codegen was already right; only the container was wrong. The backend already had a unit-testedelf::build_relocatable_objectproducing the correct EM_AARCH64 object — the CLI just wasn't calling it.Fix
The CLI has two ELF-assembly sites and
-b aarch64fell through both into the ARM builder. Both are now routed onbackend.name() == "aarch64":--all-exportspath: new first arm of theelf_datamatch, placed ahead of thehas_external_relocations || relocatablearm so-b aarch64 --relocatableisn't stolen into the ARM builder.is_aarch64is also folded intoproduced_relocatable(correct ET_REL summary) anddwarf_effective(honest "no DWARF yet" warning).Both delegate to
synth_backend_aarch64::elf::build_relocatable_object, mirroring the existing RISC-Vbuild_multi_func_riscv_elfprecedent.Discriminator note: keyed on
backend.name(), nottarget_spec.family—cortex_a53()isArchFamily::ArmCortexA(isa AArch64), notArchFamily::AArch64, so a family check would misroute.The ARM and RISC-V ELF paths are untouched.
Verification
synth compile scripts/repro/aarch64_add_538.wat -b aarch64 -o /tmp/a.o --all-exports:scripts/repro/aarch64_add_538_differential.py: PASS — 8/8 vs wasmtime (third oracle).cargo test -p synth-cli --test frozen_codegen_bytes: 3/3 (control_step0x00210A55, flight_algo0x07FDF307unchanged — ARM/RV32 output bit-identical).cargo fmt --checkclean;cargo clippy -p synth-cli -p synth-backend-aarch64 --all-targets -- -D warningsclean; both crates' test suites green.Closes #546.
🤖 Generated with Claude Code