Adding BTI to those PLT's which accessed with by a range extension thunk due to those preform an indirect call.
Fixes: #62140
Details
Diff Detail
Event Timeline
From the Arm side this looks good to me. If it turns out that we can't use the flag an alternative could be adding a Target::registerThunk(Destination) function that could be defined by the AArch64 to record the symbol destinations, these could then be looked up by the PLT writing code.
lld/test/ELF/aarch64-btiplt.s | ||
---|---|---|
2 | I think the convention now is to use the split-file command so that the linker script and assembler file can be generated in one file. For an example the test added in arm-exidx-nonzero-offset.s https://reviews.llvm.org/D148033 | |
8 | Suggest: The PLT must start with a bti c instruction due to the indirect call from the range extension thunk. Previously the call to the PLT was direct so no bti was required. |
lld/test/ELF/aarch64-btiplt.s | ||
---|---|---|
2 | Like the convention, thanks! |
lld/ELF/Symbols.h | ||
---|---|---|
296 | This uses the last bit of the byte. Adding another bit will increase the size of Symbol. | |
lld/test/ELF/aarch64-btiplt.s | ||
2 | The main feature test is aarch64-feature-bti. I'd use aarch64-feature-bti-plt.s to share a prefix, to make bti tests more discoverable. | |
21 | Don't mix leading comment markers. Use # throughout, i.e. #---. |
lld/ELF/Symbols.h | ||
---|---|---|
296 | There is a bit more space after uint8_t hasVersionSuffix : 1; if we need to squeeze something in. |
This uses the last bit of the byte. Adding another bit will increase the size of Symbol.