[PATCH] D38343: [X86] Provide the LSDA pointer with RIP relative addressing if necessary

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 28 00:35:10 PDT 2017


mstorsjo created this revision.

This makes sure the LSDA pointer isn't truncated to 32 bit.

This solves the other half of the issues mentioned in PR34720.


https://reviews.llvm.org/D38343

Files:
  lib/Target/X86/X86ISelLowering.cpp
  test/CodeGen/X86/sjlj-eh.ll


Index: test/CodeGen/X86/sjlj-eh.ll
===================================================================
--- test/CodeGen/X86/sjlj-eh.ll
+++ test/CodeGen/X86/sjlj-eh.ll
@@ -89,7 +89,7 @@
 ; CHECK-X64: leaq __gxx_personality_sj0(%rip), %rax
 ; CHECK-X64: movq %rax, -280(%rbp)
 ;     UFC.__lsda = $LSDA
-; CHECK-X64: movl $[[LSDA:GCC_except_table[0-9]+]], %eax
+; CHECK-X64: leaq [[LSDA:GCC_except_table[0-9]+]](%rip), %rax
 ; CHECK-X64: movq %rax, -272(%rbp)
 ;     UFC.__jbuf[0] = $RBP
 ; CHECK-X64: movq %rbp, -264(%rbp)
Index: lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- lib/Target/X86/X86ISelLowering.cpp
+++ lib/Target/X86/X86ISelLowering.cpp
@@ -20105,7 +20105,10 @@
     auto &Context = MF.getMMI().getContext();
     MCSymbol *S = Context.getOrCreateSymbol(Twine("GCC_except_table") +
                                             Twine(MF.getFunctionNumber()));
-    return DAG.getNode(X86ISD::Wrapper, dl, VT, DAG.getMCSymbol(S, PtrVT));
+    // getGlobalWrapperKind isn't usable here.
+    return DAG.getNode(Subtarget.isPICStyleRIPRel() ? X86ISD::WrapperRIP
+                                                    : X86ISD::Wrapper,
+                       dl, VT, DAG.getMCSymbol(S, PtrVT));
   }
 
   case Intrinsic::x86_seh_lsda: {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38343.116933.patch
Type: text/x-patch
Size: 1304 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170928/b1ad0e65/attachment.bin>


More information about the llvm-commits mailing list