diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-04-01 23:36:56 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-04-01 23:36:56 +0000 |
| commit | cf3b04dab91fec6b336a1a8ee56e5f26dc14e12f (patch) | |
| tree | dcf1f6379561d4b6fb33dcfd931fc22042796f3e | |
| parent | 24ae22c04796c14ff6cbda32619f88079070ee2d (diff) | |
| download | bcm5719-llvm-cf3b04dab91fec6b336a1a8ee56e5f26dc14e12f.tar.gz bcm5719-llvm-cf3b04dab91fec6b336a1a8ee56e5f26dc14e12f.zip | |
Don't create a PLT when we optimize out the plt use.
llvm-svn: 265202
| -rw-r--r-- | lld/ELF/Writer.cpp | 2 | ||||
| -rw-r--r-- | lld/test/ELF/tls-opt-no-plt.s | 24 |
2 files changed, 25 insertions, 1 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 8585287be6d..81c7bd36001 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -302,7 +302,7 @@ static unsigned handleTlsRelocation(uint32_t Type, SymbolBody &Body, return 1; } if (!Body.isPreemptible()) - return 1; + return 2; if (!Body.isInGot()) { Out<ELFT>::Got->addEntry(Body); Out<ELFT>::RelaDyn->addReloc( diff --git a/lld/test/ELF/tls-opt-no-plt.s b/lld/test/ELF/tls-opt-no-plt.s new file mode 100644 index 00000000000..c0ec9ab35bf --- /dev/null +++ b/lld/test/ELF/tls-opt-no-plt.s @@ -0,0 +1,24 @@ +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/tls-opt-gdie.s -o %t2.o +// RUN: ld.lld %t2.o -o %t2.so -shared +// RUN: ld.lld %t.o %t2.so -o %t.exe +// RUN: llvm-readobj -s %t.exe | FileCheck %s + +// CHECK-NOT: .plt + + .global _start +_start: + data16 + leaq foo@TLSGD(%rip), %rdi + data16 + data16 + rex64 + callq __tls_get_addr@PLT + + + .type foo,@object + .section .tdata,"awT",@progbits + .globl foo + .align 8 +foo: + .long 42 |

