diff options
author | Fangrui Song <maskray@google.com> | 2019-05-29 02:02:59 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-05-29 02:02:59 +0000 |
commit | 656afe370df3ac374db7624e0b450f15a2212ab2 (patch) | |
tree | 207ecb0fceff3bdbf3220c9b3210f8ee86ba699e /llvm/lib/MC/MCELFStreamer.cpp | |
parent | 529118fc87c0ca274a4355c3f90ddd7b07215b2d (diff) | |
download | bcm5719-llvm-656afe370df3ac374db7624e0b450f15a2212ab2.tar.gz bcm5719-llvm-656afe370df3ac374db7624e0b450f15a2212ab2.zip |
[X86] Fix x86-64 call *foo@tlsdesc(%rax) and support R_386_TLSGOTDESC R_386_TLS_DESC_CALL
D18885 emitted 5 bytes for call *foo@tlsdesc(%rax). It should use the
2-byte form instead and let R_X86_64_TLSDESC_CALL apply to the beginning
of the call instruction.
The 2-byte form was deliberately chosen to make ->LE and ->IE relaxation work:
0: 48 8d 05 00 00 00 00 lea 0x0(%rip),%rax # 7 <.text+0x7>
3: R_X86_64_GOTPC32_TLSDESC a-0x4
7: ff 10 callq *(%rax)
7: R_X86_64_TLSDESC_CALL a
=>
0: 48 c7 c0 fc ff ff ff mov $0xfffffffffffffffc,%rax
7: 66 90 xchg %ax,%ax
Also change the symbol type to STT_TLS when VK_TLSCALL or VK_TLSDESC is
seen.
Reviewed By: compnerd
Differential Revision: https://reviews.llvm.org/D62512
llvm-svn: 361910
Diffstat (limited to 'llvm/lib/MC/MCELFStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/MCELFStreamer.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp index 6fe16abd5a3..245dd063004 100644 --- a/llvm/lib/MC/MCELFStreamer.cpp +++ b/llvm/lib/MC/MCELFStreamer.cpp @@ -400,6 +400,8 @@ void MCELFStreamer::fixSymbolsInTLSFixups(const MCExpr *expr) { case MCSymbolRefExpr::VK_INDNTPOFF: case MCSymbolRefExpr::VK_NTPOFF: case MCSymbolRefExpr::VK_GOTNTPOFF: + case MCSymbolRefExpr::VK_TLSCALL: + case MCSymbolRefExpr::VK_TLSDESC: case MCSymbolRefExpr::VK_TLSGD: case MCSymbolRefExpr::VK_TLSLD: case MCSymbolRefExpr::VK_TLSLDM: |