[PATCH] D62106: [X86] Support -fno-plt __tls_get_addr calls

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 02:00:02 PDT 2019


MaskRay added a comment.

https://ewontfix.com/18/ was enlightening. I read it two or three years ago for the first time but apparently I lacked background knowledge to understand these stuff then :) Now I understand how `-fno-plt` benefits people who don't care about lazy binding...

  call    __x86.get_pc_thunk.cx
  jmp *bar at GOT+_GLOBAL_OFFSET_TABLE_(%ecx)

I think the relocation type is unavailable. This requires something like `G+GOT+A-*` (think `R_X86_64_GOTPCREL` `G+GOT+A-P`) but that is not in the psABI.

We can still do better by switching to `%eax`, `%ecx` or `%edx`, but I think this function does not have information to make the decision. We should probably propagate the `-fno-plt` (`RtLibUseGot`) information to several levels above but I know really little about the x86 codegen to achieve that...

I have to add a TODO item in the description to note down this future improvement.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62106/new/

https://reviews.llvm.org/D62106





More information about the llvm-commits mailing list