[llvm] [X86] Disallow immediate address calls when position independent (PR #202370)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 11 01:00:36 PDT 2026


================
@@ -241,7 +241,7 @@ bool X86Subtarget::isLegalToCallImmediateAddr() const {
   // FIXME: I386 PE/COFF supports PC relative calls using IMAGE_REL_I386_REL32
   // but WinCOFFObjectWriter::RecordRelocation cannot emit them.  Once it does,
   // the following check for Win32 should be removed.
-  if (Is64Bit || isTargetWin32())
+  if (Is64Bit || isTargetWin32() || isPositionIndependent())
----------------
phoebewang wrote:

Thanks for the example! Given both GCC and Clang don't complain, I believe it's a valid case we should support. The %ebx part is addressed in https://github.com/llvm/llvm-project/pull/203192

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


More information about the llvm-commits mailing list