[lld] r301290 - Define __tls_get_addr as a hidden symbol even for ARM or MIPS.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 24 21:44:55 PDT 2017


Author: ruiu
Date: Mon Apr 24 23:44:54 2017
New Revision: 301290

URL: http://llvm.org/viewvc/llvm-project?rev=301290&view=rev
Log:
Define __tls_get_addr as a hidden symbol even for ARM or MIPS.

addIgnored defines a given symbol even if there is no existing
symbol with the same name. So, even if libc provides __tls_get_addr,
we should still be able to call addIgnored.

Differential Revision: https://reviews.llvm.org/D32053

Modified:
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=301290&r1=301289&r2=301290&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Mon Apr 24 23:44:54 2017
@@ -858,11 +858,8 @@ template <class ELFT> void Writer<ELFT>:
   // __tls_get_addr is defined by the dynamic linker for dynamic ELFs. For
   // static linking the linker is required to optimize away any references to
   // __tls_get_addr, so it's not defined anywhere. Create a hidden definition
-  // to avoid the undefined symbol error. As usual special cases are ARM and
-  // MIPS - the libc for these targets defines __tls_get_addr itself because
-  // there are no TLS optimizations for these targets.
-  if (!In<ELFT>::DynSymTab &&
-      (Config->EMachine != EM_MIPS && Config->EMachine != EM_ARM))
+  // to avoid the undefined symbol error.
+  if (!In<ELFT>::DynSymTab)
     Symtab<ELFT>::X->addIgnored("__tls_get_addr");
 
   // If linker script do layout we do not need to create any standart symbols.




More information about the llvm-commits mailing list