[PATCH] D101381: [ELF][MIPS] Emit dynamic relocations for PIC non-preemptible static TLS

Jessica Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 27 10:10:32 PDT 2021


jrtc27 added inline comments.


================
Comment at: lld/ELF/SyntheticSections.cpp:1004
+      // be allocated before us in the static TLS block.
+      if (s->isPreemptible || config->isPic)
         mainPart->relaDyn->addReloc(target->tlsGotRel, this, offset, s);
----------------
MaskRay wrote:
> (Caveat: I know really little/nothing about mips)
> 
> `if (s->isPreemptible || config->shared)`?
> 
> For other targets, -pie don't need a dynamic relocation. See `bool isLocalInExecutable = !sym.isPreemptible && !config->shared;`
Ah that's a good point, in my head I had BFD's definition of isPic here which is our shared. This seems like a systematic inefficiency in the TLS code here (of course, isPic _is_ normally right for the GOT, just not TLS...).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101381



More information about the llvm-commits mailing list