This is an archive of the discontinued LLVM Phabricator instance.

[X86] Fix x86-64 call *foo@tlsdesc(reg) and support R_386_TLSGOTDESC R_386_TLS_DESC_CALL
ClosedPublic

Authored by MaskRay on May 28 2019, 2:29 AM.

Details

Summary

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

Diff Detail

Repository
rL LLVM

Event Timeline

MaskRay created this revision.May 28 2019, 2:29 AM
MaskRay updated this revision to Diff 201636.May 28 2019, 4:18 AM

Change symbol type

compnerd accepted this revision.May 28 2019, 11:47 AM

This looks good

This revision is now accepted and ready to land.May 28 2019, 11:47 AM
This revision was automatically updated to reflect the committed changes.
llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp