[llvm] [BOLT][BTI] Refactor: move applyBTIFixup under MCPlusBuilder (PR #177164)

Paschalis Mpeis via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 5 06:32:21 PST 2026


================
@@ -43,6 +43,8 @@ static void relaxStubToShortJmp(BinaryBasicBlock &StubBB, const MCSymbol *Tgt) {
   BC.MIB->createShortJmp(Seq, Tgt, BC.Ctx.get());
   StubBB.clear();
   StubBB.addInstructions(Seq.begin(), Seq.end());
+  if (BC.usesBTI())
+    BC.MIB->applyBTIFixupToTarget(StubBB);
----------------
paschalis-mpeis wrote:

Just read @yavtuk's comment [here](https://github.com/llvm/llvm-project/pull/177164#issuecomment-3785201847) and it's related.

I'd prefer handling this at the `MIB` level, so we tackle it at the source and not worry about other users of these functions.

A similar approach could be followed in the future for instrumentation.

https://github.com/llvm/llvm-project/pull/177164


More information about the llvm-commits mailing list