[PATCH] D62577: [ELF] Support Local Dynamic style TLSDESC for x86-64

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 05:31:39 PDT 2019

grimar added inline comments.

Comment at: ELF/InputSection.cpp:599
+    // On targets that support TLSDESC, _TLS_MODULE_BASE_ at tpoff = 0.
+    if (S.getName() == "_TLS_MODULE_BASE_")
+      return 0;
grimar wrote:
> ruiu wrote:
> > This line can be expensive if we have a lot of thread-local local symbols. getName() computes symbol names lazily, so if you call it on a local symbol, the function can be expensive. Maybe you should store TLSModuleBase symbol somewhere and compare S with the pointer?
> I thought about that too, but supposed that TLS symbols are not that common. Am I wrong?
Also we can probably avoid this check if create the symbol with value of `alignTo(Out::TlsPhdr->p_memsz, Out::TlsPhdr->p_align)` it seems.

I.e. I am thinking about using original `getTlsTpOffset()` helper and creating a symbol with the value of `-getTlsTpOffset()`.
Will this work?

  rLLD LLVM Linker



More information about the llvm-commits mailing list