[llvm] [X86] Disallow immediate address calls when position independent (PR #202370)
Phoebe Wang via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 9 06:14:42 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:
I'm not experienced in the involved code here. I just want to be cautious given it looks like a behavioral change of long existing code.
I skimed the related link and issues. It looks like the absolute address is not intended. Maybe we can try to avoid the generation of it. Is there a simple C reproducer? I'd like to see how GCC handles it as a comparison.
https://github.com/llvm/llvm-project/pull/202370
More information about the llvm-commits
mailing list