diff --git a/debian/changelog b/debian/changelog index c44fe357..ee50013d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,16 @@ llvm-toolchain-5.0 (1:5.0.1-4) UNRELEASED; urgency=medium + [ Sylvestre Ledru ] * Ignore the test tools/gold/X86/comdat.ll until https://bugs.llvm.org/show_bug.cgi?id=36166 is fixed. Will fix the ftbfs on x86 + [ John Paul Adrian Glaubitz ] + * Add proposed upstream patch by James Clarke to add the + missing __tls_get_addr symbol to the symbol table for + TLS calls on SPARC (Closes: #890401) + -- Sylvestre Ledru Wed, 14 Feb 2018 13:12:18 +0100 llvm-toolchain-5.0 (1:5.0.1-3) unstable; urgency=medium diff --git a/debian/patches/series b/debian/patches/series index df49ba03..7f58c36b 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -49,3 +49,4 @@ update-cuda-search-path.patch test-keep-alive.diff libfuzzer-path.diff +sparc64-add-missing-tls-get-addr.diff diff --git a/debian/patches/sparc64-add-missing-tls-get-addr.diff b/debian/patches/sparc64-add-missing-tls-get-addr.diff new file mode 100644 index 00000000..3f4413d6 --- /dev/null +++ b/debian/patches/sparc64-add-missing-tls-get-addr.diff @@ -0,0 +1,43 @@ +Description: [Sparc] Include __tls_get_addr in symbol table for TLS calls to it + Global Dynamic and Local Dynamic call relocations only implicitly + reference __tls_get_addr, but it still needs to be in the symbol table + to be bound at link time otherwise it fails to link. For details, see + https://sourceware.org/bugzilla/show_bug.cgi?id=22832. +Author: James Clarke +Last-Update: 2018-02-14 + +--- llvm-toolchain-4.0-4.0.1.orig/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp ++++ llvm-toolchain-4.0-4.0.1/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp +@@ -194,14 +194,30 @@ static void fixELFSymbolsInTLSFixupsImpl + void SparcMCExpr::fixELFSymbolsInTLSFixups(MCAssembler &Asm) const { + switch(getKind()) { + default: return; ++ case VK_Sparc_TLS_GD_CALL: ++ case VK_Sparc_TLS_LDM_CALL: { ++ // The corresponding relocations reference __tls_get_addr, as they call it, ++ // but this is only implicit; there is no connection in the ELF file ++ // between the relocation and the symbol, other than the specification for ++ // the semantics of the relocations. However, the symbol must be included ++ // in our symbol table despite the lack of references to it, since it needs ++ // to be bound during linking for these relocations. For details see ++ // https://sourceware.org/bugzilla/show_bug.cgi?id=22832. ++ MCSymbol *Symbol = Asm.getContext().getOrCreateSymbol("__tls_get_addr"); ++ Asm.registerSymbol(*Symbol); ++ auto ELFSymbol = cast(Symbol); ++ if (!ELFSymbol->isBindingSet()) { ++ ELFSymbol->setBinding(ELF::STB_GLOBAL); ++ ELFSymbol->setExternal(true); ++ } ++ LLVM_FALLTHROUGH; ++ } + case VK_Sparc_TLS_GD_HI22: + case VK_Sparc_TLS_GD_LO10: + case VK_Sparc_TLS_GD_ADD: +- case VK_Sparc_TLS_GD_CALL: + case VK_Sparc_TLS_LDM_HI22: + case VK_Sparc_TLS_LDM_LO10: + case VK_Sparc_TLS_LDM_ADD: +- case VK_Sparc_TLS_LDM_CALL: + case VK_Sparc_TLS_LDO_HIX22: + case VK_Sparc_TLS_LDO_LOX10: + case VK_Sparc_TLS_LDO_ADD: