| Issue |
233479
|
| Summary |
[AArch64][SME] Calls to the SME ABI routines ignore the code model
|
| Labels |
|
| Assignees |
|
| Reporter |
FedericoBruzzone
|
The AArch64 backend emits calls to the SME ABI routines (`__arm_tpidr2_save`, `__arm_tpidr2_restore`, `__arm_sme_save`, `__arm_sme_restore`, `__arm_sme_state`) as direct [BL instructions](https://support.arm.com/documentation/dui0801/l/A64-General-Instructions/BL--A64-?lang=en) and does not look at the code model.
Other external calls under the large code model on MachO go through the GOT (i.e., _Global Offset Table_), but these don't.
If the routine is more than +/-128 MB away, the BL cannot encode the offset.
Where the direct BL is built:
- `AArch64ExpandPseudoInsts.cpp`: TPIDR2 save/restore
- `MachineSMEABIPass.cpp`: `__arm_sme_save`/`__arm_sme_restore` and the state size call
- `AArch64ISelLowering.cpp`: `__arm_sme_state`
The MLIR ArmSME integration tests fail on macOS arm64 in an ASan build, because the ABI library is mapped far from the JIT memory. RuntimeDyld (MachO AArch64) then asserts:
```bash
Assertion failed: (isInt<28>(Addend) && "Branch target is out of range."),
function encodeAddend, file RuntimeDyldMachOAArch64.h
```
ASan is not required: placing the ABI library about 200 MB away from the JIT memory hits the same assert without it.
Setting `CodeModel::Large` in the JIT does not help, since these calls ignore it.
**Expected**: these calls should respect the code model.
The MLIR tests are currently marked unsupported under ASan on Darwin as a stopgap: #233445
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs