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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 09:39:22 PST 2020


MaskRay marked an inline comment as done.
MaskRay added inline comments.


================
Comment at: lld/ELF/Relocations.cpp:1401
+  // R_TLS relocations are resolved in processRelocAux.
+  if (expr == R_TLS) {
+    if (config->shared) {
----------------
rprichard wrote:
> 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
> 
Thanks. R_386_TLS_LE_32 is an obsoleted Solaris TLS relocation type. 


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