Open Quuxplusone opened 6 years ago
Attached test_static.c
(235 bytes, text/x-csrc): The C source code with inline assembly that is mis-compiled when the PIC is enabled.
The following patch should work. I will send it to llvm-commits after checking
the formatting.
Index: lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- lib/Target/X86/X86ISelLowering.cpp (revision 345806)
+++ lib/Target/X86/X86ISelLowering.cpp (working copy)
@@ -41119,7 +41119,9 @@
// In any sort of PIC mode addresses need to be computed at runtime by
// adding in a register or some sort of table lookup. These can't
// be used as immediates.
- if (Subtarget.isPICStyleGOT() || Subtarget.isPICStyleStubPIC())
+ if (Subtarget.isPICStyleGOT() ||
+ Subtarget.isPICStyleStubPIC() ||
+ Subtarget.isPICStyleRIPRel())
return;
// If we are in non-pic codegen mode, we allow the address of a global (with
Attached pic.diff
(702 bytes, text/plain): A proposed patch
See also https://bugs.llvm.org/show_bug.cgi?id=4752 for a related bug.
test_static.c
(235 bytes, text/x-csrc)pic.diff
(702 bytes, text/plain)