[PATCH] D62512: [X86] Fix x86-64 call *foo at tlsdesc(reg) and support R_386_TLSGOTDESC R_386_TLS_DESC_CALL

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 28 02:31:57 PDT 2019


MaskRay created this revision.
MaskRay added reviewers: davide, compnerd, rnk.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

D18885 <https://reviews.llvm.org/D18885> emitted 5 bytes for call *foo at 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


Repository:
  rL LLVM

https://reviews.llvm.org/D62512

Files:
  lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp
  lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
  test/MC/ELF/relocation-tls.s
  test/MC/X86/tlsdesc-32.s
  test/MC/X86/tlsdesc-64.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62512.201624.patch
Type: text/x-patch
Size: 4457 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190528/75911e8d/attachment.bin>


More information about the llvm-commits mailing list