[PATCH] D68907: [6/7/trunk] -fno-plt generates wrong relocation for std::ios_base::Init leading to segmentation fault

kamlesh kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 13 05:23:57 PDT 2019


kamleshbhalui updated this revision to Diff 224780.
kamleshbhalui edited the summary of this revision.

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68907/new/

https://reviews.llvm.org/D68907

Files:
  llvm/lib/Target/X86/X86FastISel.cpp


Index: llvm/lib/Target/X86/X86FastISel.cpp
===================================================================
--- llvm/lib/Target/X86/X86FastISel.cpp
+++ llvm/lib/Target/X86/X86FastISel.cpp
@@ -745,6 +745,12 @@
         AM.Base.Reg = getInstrInfo()->getGlobalBaseReg(FuncInfo.MF);
       }

+      bool NeedLoad = GVFlags == X86II::MO_GOTPCREL;
+      if(NeedLoad) {
+          assert(AM.Base.Reg == 0 && AM.IndexReg == 0);
+          AM.Base.Reg = X86::RIP;
+      }
+
       // Unless the ABI requires an extra load, return a direct reference to
       // the global.
       if (!isGlobalStubReference(GVFlags)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68907.224780.patch
Type: text/x-patch
Size: 617 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191013/9051380e/attachment.bin>


More information about the llvm-commits mailing list