[PATCH] D92959: [ELF][PPC64] Detect missing R_PPC64_TLSGD/R_PPC64_TLSLD and disable TLS relaxation

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 10 16:21:36 PST 2020


MaskRay added a comment.

In D92959#2447003 <https://reviews.llvm.org/D92959#2447003>, @stefanp wrote:

> Thank you for your help!
>
> It make sense what you have written but I would still prefer to explicitly check for calls to `__tls_get_addr` and look at the relocations on the call.
>
> How would you like to proceed from here? Do you want me to take the patch over and make changes?

This patch is essentially a rewrite.
If this patch looks fine, I'd like if we take this route instead....

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=727fc41e077139570ea8b8ddfd6c546b2a55627c introduced the R_PPC64_TLSGD/R_PPC64_TLSLD behavior in 2009 so assumably the problem existed before 2009. It made feel pretty uneasy that you are needing the pre-2009 workaround....

I am not sure checking `"__tls_get_addr"` is useful. R_PPC64_TLSGD/R_PPC64_TLSLD is only used by `"__tls_get_addr"`. GD/LD GOT relocations are not used otherwise, are they?
So a simple check like this patch should work. We don't necessarily bring all the complexity from GNU ld.



================
Comment at: lld/ELF/Relocations.cpp:1566
+      if (expr == R_TLSGD_GOT && expr != R_TLSLD_GOT)
+        continue;
+    }
----------------
stefanp wrote:
> I'm not sure what the code after the switch is for.
Thanks for the catch. It is unneeded.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92959



More information about the llvm-commits mailing list