[PATCH] D93331: [ELF] Reject local-exec TLS relocations for -shared

Ryan Prichard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 02:24:34 PST 2020


rprichard added a comment.

It looks OK to me.



================
Comment at: lld/ELF/Relocations.cpp:1401
+  // R_TLS relocations are resolved in processRelocAux.
+  if (expr == R_TLS) {
+    if (config->shared) {
----------------
I think this should also check for R_NEG_TLS. AFAIK R_NEG_TLS/R_386_TLS_LE_32 is only used on 32-bit x86, and compilers usually prefer R_TLS/R_386_TLS_LE, but it's possible to bypass the new error with assembly:

`movl	%gs:TlsVar at NTPOFF, %eax` ==> R_TLS
`movl	%gs:TlsVar at TPOFF, %eax` ==> R_NEG_TLS



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93331



More information about the llvm-commits mailing list