[lld] r269597 - [ELF][MIPS] Rename R_MIPS_GOT_xxx relocation expression kinds

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Sun May 15 11:13:51 PDT 2016


Author: atanasyan
Date: Sun May 15 13:13:50 2016
New Revision: 269597

URL: http://llvm.org/viewvc/llvm-project?rev=269597&view=rev
Log:
[ELF][MIPS] Rename R_MIPS_GOT_xxx relocation expression kinds

New names reflect purpose of corresponding GOT entries better.
Both expression types related to entries allocated in the 'local'
part of MIPS GOT. R_MIPS_GOT_LOCAL_PAGE is for entries contain 'page'
addresses. R_MIPS_GOT_LOCAL is for entries contain 'full' address.

Modified:
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/ELF/InputSection.h
    lld/trunk/ELF/Target.cpp
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=269597&r1=269596&r2=269597&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Sun May 15 13:13:50 2016
@@ -191,12 +191,12 @@ getSymVA(uint32_t Type, typename ELFT::u
     return Body.getVA<ELFT>(A);
   case R_GOT_OFF:
     return Body.getGotOffset<ELFT>() + A;
-  case R_MIPS_GOT_LOCAL:
+  case R_MIPS_GOT_LOCAL_PAGE:
     // If relocation against MIPS local symbol requires GOT entry, this entry
     // should be initialized by 'page address'. This address is high 16-bits
     // of sum the symbol's value and the addend.
     return Out<ELFT>::Got->getMipsLocalPageOffset(Body.getVA<ELFT>(A));
-  case R_MIPS_GOT:
+  case R_MIPS_GOT_LOCAL:
     // For non-local symbols GOT entries should contain their full
     // addresses. But if such symbol cannot be preempted, we do not
     // have to put them into the "global" part of GOT and use dynamic

Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=269597&r1=269596&r2=269597&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Sun May 15 13:13:50 2016
@@ -36,8 +36,8 @@ enum RelExpr {
   R_GOT_PAGE_PC,
   R_GOT_PC,
   R_HINT,
-  R_MIPS_GOT,
   R_MIPS_GOT_LOCAL,
+  R_MIPS_GOT_LOCAL_PAGE,
   R_NEG_TLS,
   R_PAGE_PC,
   R_PC,
@@ -61,8 +61,8 @@ enum RelExpr {
 };
 
 inline bool refersToGotEntry(RelExpr Expr) {
-  return Expr == R_GOT || Expr == R_GOT_OFF || Expr == R_MIPS_GOT ||
-         Expr == R_MIPS_GOT_LOCAL || Expr == R_GOT_PAGE_PC ||
+  return Expr == R_GOT || Expr == R_GOT_OFF || Expr == R_MIPS_GOT_LOCAL ||
+         Expr == R_MIPS_GOT_LOCAL_PAGE || Expr == R_GOT_PAGE_PC ||
          Expr == R_GOT_PC || Expr == R_GOT_FROM_END || Expr == R_TLSGD ||
          Expr == R_TLSGD_PC;
 }

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=269597&r1=269596&r2=269597&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Sun May 15 13:13:50 2016
@@ -1281,15 +1281,15 @@ RelExpr MipsTargetInfo<ELFT>::getRelExpr
     return R_PC;
   case R_MIPS_GOT16:
     if (S.isLocal())
-      return R_MIPS_GOT_LOCAL;
+      return R_MIPS_GOT_LOCAL_PAGE;
   // fallthrough
   case R_MIPS_CALL16:
   case R_MIPS_GOT_DISP:
     if (!S.isPreemptible())
-      return R_MIPS_GOT;
+      return R_MIPS_GOT_LOCAL;
     return R_GOT_OFF;
   case R_MIPS_GOT_PAGE:
-    return R_MIPS_GOT_LOCAL;
+    return R_MIPS_GOT_LOCAL_PAGE;
   }
 }
 

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=269597&r1=269596&r2=269597&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Sun May 15 13:13:50 2016
@@ -457,9 +457,10 @@ template <class ELFT>
 static bool isStaticLinkTimeConstant(RelExpr E, uint32_t Type,
                                      const SymbolBody &Body) {
   // These expressions always compute a constant
-  if (E == R_SIZE || E == R_GOT_FROM_END || E == R_GOT_OFF || E == R_MIPS_GOT ||
-      E == R_MIPS_GOT_LOCAL || E == R_GOT_PAGE_PC || E == R_GOT_PC ||
-      E == R_PLT_PC || E == R_TLSGD_PC || E == R_TLSGD || E == R_PPC_PLT_OPD)
+  if (E == R_SIZE || E == R_GOT_FROM_END || E == R_GOT_OFF ||
+      E == R_MIPS_GOT_LOCAL || E == R_MIPS_GOT_LOCAL_PAGE ||
+      E == R_GOT_PAGE_PC || E == R_GOT_PC || E == R_PLT_PC || E == R_TLSGD_PC ||
+      E == R_TLSGD || E == R_PPC_PLT_OPD)
     return true;
 
   // These never do, except if the entire file is position dependent or if




More information about the llvm-commits mailing list