[llvm] [BOLT][ICP] Use PC-relative instructions for x86 PIC binaries in ICP (PR #216587)

Jinjie Huang via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 1 02:16:41 PDT 2026


================
@@ -3298,6 +3304,9 @@ class X86MCPlusBuilder : public MCPlusBuilder {
       const bool MinimizeCodeSize, MCContext *Ctx) override {
     const bool IsTailCall = isTailCall(CallInst);
     const bool IsJumpTable = getJumpTable(CallInst) != 0;
+    const bool UsePIC =
+        !IsJumpTable &&
+        (Ctx->getObjectFileInfo()->isPositionIndependent() || opts::X86ICPPIC);
----------------
Jinjie-Huang wrote:

Yes, using PIC code for a PIC binary is intended. Under this flag, using PIC code for a non-PIC binary is also reasonable.

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


More information about the llvm-commits mailing list