diff options
| -rw-r--r-- | lld/ELF/Writer.cpp | 2 | ||||
| -rw-r--r-- | lld/test/ELF/tls-opt-no-plt.s | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 81c7bd36001..9e366a0b2cb 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -279,7 +279,7 @@ static unsigned handleTlsRelocation(uint32_t Type, SymbolBody &Body, 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, diff --git a/lld/test/ELF/tls-opt-no-plt.s b/lld/test/ELF/tls-opt-no-plt.s index c0ec9ab35bf..53655d0934d 100644 --- a/lld/test/ELF/tls-opt-no-plt.s +++ b/lld/test/ELF/tls-opt-no-plt.s @@ -15,6 +15,16 @@ _start: rex64 callq __tls_get_addr@PLT + leaq bar@TLSLD(%rip), %rdi + callq __tls_get_addr@PLT + leaq bar@DTPOFF(%rax), %rax + + .type bar,@object + .section .tdata,"awT",@progbits + .align 8 +bar: + .long 42 + .type foo,@object .section .tdata,"awT",@progbits |

