This fixes the combination of two things:
- Placing a BTI after calls to a returns twice function like setjmp. This allows the setjmp to return with a br instead of a ret.
- Straight line speculation mitigations that replace BLR with a BL to a thunk that does the mitigation, and then goes to the original target.
Originally I marked AArch64call_bti as requiring that SLS mitigation
be disabled. This caused a crash when you tried to codegen with both.
Since CALL_BTI tried to match with AArch64call_bti but could not.
This change does 2 things:
- Follow the pattern set by AArch64call and add 2 patterns for AArch64call_bti. One with no IP (interprocedural) registers, and one with. For SLS mitigation on and off respectively.
- Modify the sls hardening pass to iterate through bundled instructions, as the AArch64 KCFI pass does.
Since there is a 1:1 replacement of the BLR with a BL,
the bundle remains intact. This is checked with an MIR test.
The ir -> asm testing is updated to add runs with the sls