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: { 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)