eckertliam opened PR #12824 from eckertliam:issue-12818 to bytecodealliance:main:
Fixes #12818
On aarch64 in non-PIC mode, colocated symbols (non-preemptible linkage like
Local,Hidden,Export) generateadrp+addinstruction pairs viaLoadExtNameNear, producingAarch64AdrPrelPgHi21andAarch64AddAbsLo12Ncrelocations. These were not handled incranelift-object'sprocess_reloc, causing anunimplemented!()panic.Changes
- Add match arms in
process_relocfor both relocations, mapping to the correct ELF (R_AARCH64_ADR_PREL_PG_HI21,R_AARCH64_ADD_ABS_LO12_NC) and MachO (ARM64_RELOC_PAGE21,ARM64_RELOC_PAGEOFF12) relocation types- Add
aarch64_colocated_data_symbol_relocintegration test that exercises the full code path: declares a local data symbol, builds a function that loads its address, and verifies the object file emits successfully- Enable the
arm64feature in cranelift-object dev-dependencies to support the new test:robot: Generated with Claude Code
eckertliam requested cfallin for a review on PR #12824.
eckertliam requested wasmtime-compiler-reviewers for a review on PR #12824.
bjorn3 submitted PR review.
bjorn3 created PR review comment:
Please sort these next to the other arm64 relocs.
github-actions[bot] added the label cranelift:module on PR #12824.
github-actions[bot] added the label cranelift on PR #12824.
cfallin submitted PR review:
Thanks for this!
In addition to the enum arm ordering pointed out by bjorn3's comment, a high-level thought. Thanks for being straightforward about having used Claude Code for this. I think such tools are fine given the right checks and controls. However for something as low-level and important as binary relocations, I want to make sure we verify in the human layer as well (that is, have a domain expert look at every line). Relying solely on the human PR reviewer (that's me) isn't great either because of the effort asymmetry -- your agent does the work automatically, I have to go Google the Mach-O and ELF relocation specs and make sure it did the right thing. The etiquette around all of this is still evolving but in this case I think I want to ask for the following:
If you don't mind, would you be able to (as a human, without an LLM assisting please):
- Link us to some docs here that describe the ELF and Mach-O relocations;
- Verify yourself that they're the right ones, and that the associated fields are correct (e.g. for a specific case: the
r_length: 2is curious -- that must be the log2 of the size? It looks like the other Mach-O cases do that too? Can you verify?)No need to update the code with any citations or anything -- our other cases don't have anything like that. I just want to make sure we get this right, and also establish a norm of checking an agent's work carefully.
Thanks!
Last updated: Mar 23 2026 at 16:19 UTC