[PATCH] D92959: [ELF][PPC64] Add --fix-ppc64-tls-reloc to detect and fix missing R_PPC64_TLSGD/R_PPC64_TLSLD

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 10 13:33:11 PST 2020


stefanp added a comment.

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?



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


================
Comment at: lld/ELF/Relocations.cpp:1568
+    }
+    // If the option is set we should check all calls to __tls_get_addr for
+    // missing relocations.
----------------
The issue is that we don't actually check for calls to `__tls_get_addr`.
We just check that if there exists some `R_PPC64_GOT_TLS...` we also have at least one `R_PPC64_TLSLD/R_PPC64_TLSGD`. My concern with this is that we can have a place where the relocations are specified correctly and another place where they are not and this is not going to be detected. 



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