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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 05:42:20 PDT 2019

ruiu 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:
> 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?
Maybe it's not a big deal in practice. But identifying a symbol by name always rings a bell, so it'd probably easier to identify by a pointer comparison than explaining why this is not a big deal.

  rLLD LLVM Linker



More information about the llvm-commits mailing list