[lld] r265203 - Don't create a plt when LD access is optimized.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 1 17:19:22 PDT 2016


Author: rafael
Date: Fri Apr  1 19:19:22 2016
New Revision: 265203

URL: http://llvm.org/viewvc/llvm-project?rev=265203&view=rev
Log:
Don't create a plt when LD access is optimized.

Modified:
    lld/trunk/ELF/Writer.cpp
    lld/trunk/test/ELF/tls-opt-no-plt.s

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=265203&r1=265202&r2=265203&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Fri Apr  1 19:19:22 2016
@@ -279,7 +279,7 @@ static unsigned handleTlsRelocation(uint
                                     InputSectionBase<ELFT> &C, RelT &RI) {
   if (Target->pointsToLocalDynamicGotEntry(Type)) {
     if (Target->canRelaxTls(Type, nullptr))
-      return 1;
+      return 2;
     if (Out<ELFT>::Got->addTlsIndex())
       Out<ELFT>::RelaDyn->addReloc({Target->TlsModuleIndexRel,
                                     DynamicReloc<ELFT>::Off_LTlsIndex,

Modified: lld/trunk/test/ELF/tls-opt-no-plt.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/tls-opt-no-plt.s?rev=265203&r1=265202&r2=265203&view=diff
==============================================================================
--- lld/trunk/test/ELF/tls-opt-no-plt.s (original)
+++ lld/trunk/test/ELF/tls-opt-no-plt.s Fri Apr  1 19:19:22 2016
@@ -15,6 +15,16 @@ _start:
         rex64
         callq   __tls_get_addr at PLT
 
+        leaq    bar at TLSLD(%rip), %rdi
+        callq   __tls_get_addr at PLT
+        leaq    bar at DTPOFF(%rax), %rax
+
+        .type   bar, at object
+        .section        .tdata,"awT", at progbits
+        .align  8
+bar:
+        .long   42
+
 
         .type   foo, at object
         .section        .tdata,"awT", at progbits




More information about the llvm-commits mailing list