[llvm] [RISC-V] Adjust trampoline code for branch control flow protection (PR #141949)

Jesse Huang via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 2 01:18:19 PDT 2025


================
@@ -8295,9 +8296,23 @@ SDValue RISCVTargetLowering::lowerINIT_TRAMPOLINE(SDValue Op,
   //     16: <StaticChainOffset>
   //     24: <FunctionAddressOffset>
   //     32:
-
-  constexpr unsigned StaticChainOffset = 16;
-  constexpr unsigned FunctionAddressOffset = 24;
+  // Offset with branch control flow protection enabled:
+  //      0: lpad    <imm20>
+  //      4: auipc   t3, 0
+  //      8: ld      t0, 28(t3)
+  //     12: ld      t3, 20(t3)
----------------
jaidTw wrote:

Thanks, I missed it.
I fixed it in https://github.com/llvm/llvm-project/pull/142344.

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


More information about the llvm-commits mailing list