[llvm] [AArch64][BTI] Mark EH landing pads as jump targets (PR #149680)
Benjamin Herrenschmidt via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 21 22:49:16 PDT 2025
ozbenh wrote:
So bear with me, I have no idea what I'm doing, never looked at LLVM code that deep, and this is probably completely wrong ... but hacking `AArch64BranchTargets::addBTI()` this way:
```
- BuildMI(MBB, MBB.begin(), MBB.findDebugLoc(MBB.begin()),
- TII->get(AArch64::HINT))
+ for (MBBI = MBB.begin() ; MBBI != MBB.end() && MBB.isEHPad(); MBBI++)
+ if (MBBI->getOpcode() == TargetOpcode::EH_LABEL) {
+ MBBI++;
+ break;
+ }
+ BuildMI(MBB, MBBI, MBB.findDebugLoc(MBBI), TII->get(AArch64::HINT))
.addImm(HintNum);
```
Seems to do the trick :-)
I don't know how the `HasWinCFI` bit right before is affected if at all, again I have no idea what I'm doing, I mostly just grepped `EH_LABEL` and tried to make uniformed deductions :-)
https://github.com/llvm/llvm-project/pull/149680
More information about the llvm-commits
mailing list