This patch intends to guard indirect branches performed by longjmp
by inserting BTI instructions after calls to setjmp.
Calls with 'returns-twice' are lowered to a new pseudo-instruction
named t2CALL_BTI that is later expanded to a bundle of {tBL,t2BTI}.
This patch is part of a series that adds support for the PACBTI-M extension of
the Armv8.1-M architecture, as detailed here:
The PACBTI-M specification can be found in the Armv8-M Architecture Reference
Manual:
https://developer.arm.com/documentation/ddi0553/latest
The following people contributed to this patch:
- Alexandros Lamprineas
- Ties Stuij
Should this require IsMClass instead/also? Though I wasn't able to get anything weird to happen when using an A profile triple so maybe I'm missing a check elsewhere that means you'd never get to this point with A profile Arm.
For example this A profile triple:
$ ./bin/clang --target=thumbv8-arm-none-eabi /tmp/test.c -o /tmp/test.o -o - -S -mbranch-protection=bti -mthumb
Doesn't put anything after a call to setjmp, nop or otherwise, but I can't place where that decision is made.