[lld] [LLD][ELF][AArch64] Add BTI Aware long branch thunks (PR #108989)
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 26 08:22:06 PDT 2024
================
@@ -2326,6 +2334,21 @@ bool ThunkCreator::createThunks(uint32_t pass,
ts = getISDThunkSec(os, isec, isd, rel, src);
ts->addThunk(t);
thunks[t->getThunkTargetSym()] = t;
+
+ // When indirect branches are restricted, such as AArch64 BTI
+ // Thunks may need to target a linker generated landing pad
+ // instead of the target.
+ if (t->needsSyntheticLandingPad()) {
+ Thunk *lpt;
+ auto &dr = cast<Defined>(t->destination);
+ std::tie(lpt, isNew) = getSyntheticLandingPad(dr, t->addend);
+ if (isNew) {
+ InputSection *targetsec = dyn_cast<InputSection>(dr.section);
----------------
smithp35 wrote:
I've used cast<>
The code in isAArch64BTILandingPad has a test
```
if (!isa_and_nonnull<InputSection>(d->section))
```
so `t->needsSyntheticLandingPad()` should return false in those cases.
https://github.com/llvm/llvm-project/pull/108989
More information about the llvm-commits
mailing list