[PATCH] D47379: [lld] Rename R_TLSGD/R_TLSLD to R_TLSGD_FROM_END/R_TLSLD_FROM_END [NFC]

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 31 11:11:17 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD333674: Rename R_TLSGD/R_TLSLD to add _GOT_FROM_END. NFC. (authored by sfertile, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D47379?vs=148630&id=149321#toc

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D47379

Files:
  ELF/Arch/X86.cpp
  ELF/InputSection.cpp
  ELF/Relocations.cpp
  ELF/Relocations.h


Index: ELF/Relocations.h
===================================================================
--- ELF/Relocations.h
+++ ELF/Relocations.h
@@ -77,10 +77,10 @@
   R_TLSDESC,
   R_TLSDESC_CALL,
   R_TLSDESC_PAGE,
-  R_TLSGD,
   R_TLSGD_GOT,
+  R_TLSGD_GOT_FROM_END,
   R_TLSGD_PC,
-  R_TLSLD,
+  R_TLSLD_GOT_FROM_END,
   R_TLSLD_PC,
 };
 
Index: ELF/Arch/X86.cpp
===================================================================
--- ELF/Arch/X86.cpp
+++ ELF/Arch/X86.cpp
@@ -73,9 +73,9 @@
   case R_386_TLS_LDO_32:
     return R_ABS;
   case R_386_TLS_GD:
-    return R_TLSGD;
+    return R_TLSGD_GOT_FROM_END;
   case R_386_TLS_LDM:
-    return R_TLSLD;
+    return R_TLSLD_GOT_FROM_END;
   case R_386_PLT32:
     return R_PLT_PC;
   case R_386_PC8:
Index: ELF/InputSection.cpp
===================================================================
--- ELF/InputSection.cpp
+++ ELF/InputSection.cpp
@@ -631,13 +631,13 @@
   case R_TLSDESC_PAGE:
     return getAArch64Page(InX::Got->getGlobalDynAddr(Sym) + A) -
            getAArch64Page(P);
-  case R_TLSGD:
-    return InX::Got->getGlobalDynOffset(Sym) + A - InX::Got->getSize();
   case R_TLSGD_GOT:
     return InX::Got->getGlobalDynOffset(Sym) + A;
+  case R_TLSGD_GOT_FROM_END:
+    return InX::Got->getGlobalDynOffset(Sym) + A - InX::Got->getSize();
   case R_TLSGD_PC:
     return InX::Got->getGlobalDynAddr(Sym) + A - P;
-  case R_TLSLD:
+  case R_TLSLD_GOT_FROM_END:
     return InX::Got->getTlsIndexOff() + A - InX::Got->getSize();
   case R_TLSLD_PC:
     return InX::Got->getTlsIndexVA() + A - P;
Index: ELF/Relocations.cpp
===================================================================
--- ELF/Relocations.cpp
+++ ELF/Relocations.cpp
@@ -198,7 +198,7 @@
     return 1;
   }
 
-  if (isRelExprOneOf<R_TLSLD_PC, R_TLSLD>(Expr)) {
+  if (isRelExprOneOf<R_TLSLD_PC, R_TLSLD_GOT_FROM_END>(Expr)) {
     // Local-Dynamic relocs can be relaxed to Local-Exec.
     if (!Config->Shared) {
       C.Relocations.push_back(
@@ -213,13 +213,14 @@
   }
 
   // Local-Dynamic relocs can be relaxed to Local-Exec.
-  if (isRelExprOneOf<R_ABS, R_TLSLD, R_TLSLD_PC>(Expr) && !Config->Shared) {
+  if (isRelExprOneOf<R_ABS, R_TLSLD_GOT_FROM_END, R_TLSLD_PC>(Expr) &&
+      !Config->Shared) {
     C.Relocations.push_back({R_RELAX_TLS_LD_TO_LE, Type, Offset, Addend, &Sym});
     return 1;
   }
 
-  if (isRelExprOneOf<R_TLSDESC, R_TLSDESC_PAGE, R_TLSDESC_CALL, R_TLSGD,
-                     R_TLSGD_GOT, R_TLSGD_PC>(Expr)) {
+  if (isRelExprOneOf<R_TLSDESC, R_TLSDESC_PAGE, R_TLSDESC_CALL, R_TLSGD_GOT,
+                     R_TLSGD_GOT_FROM_END, R_TLSGD_PC>(Expr)) {
     if (Config->Shared) {
       if (InX::Got->addDynTlsEntry(Sym)) {
         uint64_t Off = InX::Got->getGlobalDynOffset(Sym);
@@ -348,8 +349,8 @@
                      R_MIPS_GOTREL, R_MIPS_GOT_OFF, R_MIPS_GOT_OFF32,
                      R_MIPS_GOT_GP_PC, R_MIPS_TLSGD, R_GOT_PAGE_PC, R_GOT_PC,
                      R_GOTONLY_PC, R_GOTONLY_PC_FROM_END, R_PLT_PC, R_TLSGD_GOT,
-                     R_TLSGD_PC, R_TLSGD, R_PPC_CALL_PLT, R_TLSDESC_CALL,
-                     R_TLSDESC_PAGE, R_HINT>(E))
+                     R_TLSGD_GOT_FROM_END, R_TLSGD_PC, R_PPC_CALL_PLT,
+                     R_TLSDESC_CALL, R_TLSDESC_PAGE, R_HINT>(E))
     return true;
 
   // These never do, except if the entire file is position dependent or if


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47379.149321.patch
Type: text/x-patch
Size: 3357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180531/61b05c65/attachment.bin>


More information about the llvm-commits mailing list