You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
authored
Arm64: don't fold ldr page offset (PAGEOFFSET_12L) for NativeAOT (#129966)
Fixes#129936.
PR #129589 added an Arm64 fold of `adrp+add+ldr` into
`adrp+ldr[#:lo12:]` via a 64-bit `PAGEOFFSET_12L` reloc
(`R_AARCH64_LDST64_ABS_LO12_NC`). That reloc encodes the offset scaled
by 8, so the target must be 8-byte aligned. In R2R the relocatable loads
always go through pointer-aligned indirection cells, but NativeAOT can
fold a direct 64-bit load of byte-packed frozen data (4-byte aligned),
which `ld.lld` rejects:
```
ld.lld : error : improper alignment for relocation R_AARCH64_LDST64_ABS_LO12_NC: 0x74A52C is not aligned to 8 bytes
```
The fold is purely a size optimization, so this restricts it to
non-NativeAOT and falls back to the always-safe `adrp+add+ldr`.
Validation (SPMI, linux-arm64):
- `benchmarks.run` (R2R, ~427K contexts): **0 asm diffs** — the win is
preserved.
- `smoke_tests.nativeaot` (18891 ctx): clean replay, no diffs.
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
0 commit comments