[Mips] Use standard relocations R_MIPS_HI16/LO16 instead of custom variants
authorSimon Atanasyan <simon@atanasyan.com>
Sat, 13 Jun 2015 14:48:04 +0000 (14:48 +0000)
committerSimon Atanasyan <simon@atanasyan.com>
Sat, 13 Jun 2015 14:48:04 +0000 (14:48 +0000)
No functional changes.

llvm-svn: 239676

lld/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp
lld/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h
lld/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp

index 70a8104..0124b7b 100644 (file)
@@ -126,8 +126,6 @@ const Registry::KindStrings kindStrings[] = {
   LLD_KIND_STRING_ENTRY(LLD_R_MIPS_32_HI16),
   LLD_KIND_STRING_ENTRY(LLD_R_MIPS_64_HI16),
   LLD_KIND_STRING_ENTRY(LLD_R_MIPS_GLOBAL_26),
-  LLD_KIND_STRING_ENTRY(LLD_R_MIPS_HI16),
-  LLD_KIND_STRING_ENTRY(LLD_R_MIPS_LO16),
   LLD_KIND_STRING_ENTRY(LLD_R_MIPS_STO_PLT),
   LLD_KIND_STRING_ENTRY(LLD_R_MICROMIPS_GLOBAL_26_S1),
   LLD_KIND_STRING_END
index 61b3ba1..123458d 100644 (file)
@@ -22,10 +22,6 @@ enum {
   LLD_R_MIPS_32_HI16 = 1025,
   /// \brief The same as R_MIPS_26 but for global symbols.
   LLD_R_MIPS_GLOBAL_26 = 1026,
-  /// \brief Setup hi 16 bits using the symbol this reference refers to.
-  LLD_R_MIPS_HI16 = 1027,
-  /// \brief Setup low 16 bits using the symbol this reference refers to.
-  LLD_R_MIPS_LO16 = 1028,
   /// \brief Represents a reference between PLT and dynamic symbol.
   LLD_R_MIPS_STO_PLT = 1029,
   /// \brief The same as R_MICROMIPS_26_S1 but for global symbols.
index 9fb7c40..0a4a452 100644 (file)
@@ -119,8 +119,6 @@ static MipsRelocationParams getRelocationParams(uint32_t rType) {
   case R_MIPS_TLS_DTPREL_LO16:
   case R_MIPS_TLS_TPREL_HI16:
   case R_MIPS_TLS_TPREL_LO16:
-  case LLD_R_MIPS_HI16:
-  case LLD_R_MIPS_LO16:
     return {4, 0xffff, 0, false, dummyCheck};
   case R_MICROMIPS_GOT_HI16:
   case R_MICROMIPS_GOT_LO16:
@@ -226,8 +224,7 @@ static int32_t reloc26ext(uint64_t S, int32_t A, uint32_t shift) {
 }
 
 /// \brief R_MIPS_HI16, R_MIPS_TLS_DTPREL_HI16, R_MIPS_TLS_TPREL_HI16,
-/// R_MICROMIPS_HI16, R_MICROMIPS_TLS_DTPREL_HI16, R_MICROMIPS_TLS_TPREL_HI16,
-/// LLD_R_MIPS_HI16
+/// R_MICROMIPS_HI16, R_MICROMIPS_TLS_DTPREL_HI16, R_MICROMIPS_TLS_TPREL_HI16
 /// local/external: hi16 (AHL + S) - (short)(AHL + S) (truncate)
 /// _gp_disp      : hi16 (AHL + GP - P) - (short)(AHL + GP - P) (verify)
 static int32_t relocHi16(uint64_t P, uint64_t S, int64_t AHL, bool isGPDisp) {
@@ -241,8 +238,7 @@ static int32_t relocPcHi16(uint64_t P, uint64_t S, int64_t AHL) {
 }
 
 /// \brief R_MIPS_LO16, R_MIPS_TLS_DTPREL_LO16, R_MIPS_TLS_TPREL_LO16,
-/// R_MICROMIPS_LO16, R_MICROMIPS_TLS_DTPREL_LO16, R_MICROMIPS_TLS_TPREL_LO16,
-/// LLD_R_MIPS_LO16
+/// R_MICROMIPS_LO16, R_MICROMIPS_TLS_DTPREL_LO16, R_MICROMIPS_TLS_TPREL_LO16
 /// local/external: lo16 AHL + S (truncate)
 /// _gp_disp      : lo16 AHL + GP - P + 4 (verify)
 static int32_t relocLo16(uint64_t P, uint64_t S, int64_t AHL, bool isGPDisp,
@@ -560,10 +556,6 @@ static ErrorOr<int64_t> calculateRelocation(Reference::KindValue kind,
     return reloc26ext(tgtAddr, addend, 2);
   case LLD_R_MICROMIPS_GLOBAL_26_S1:
     return reloc26ext(tgtAddr, addend, isCrossJump ? 2 : 1);
-  case LLD_R_MIPS_HI16:
-    return relocHi16(0, tgtAddr, 0, false);
-  case LLD_R_MIPS_LO16:
-    return relocLo16(0, tgtAddr, 0, false, false);
   case LLD_R_MIPS_STO_PLT:
   case LLD_R_MIPS_GLOBAL_GOT:
     // Do nothing.
index 03f512c..944e07d 100644 (file)
@@ -184,9 +184,9 @@ class PLT0Atom : public PLTAtom {
 public:
   PLT0Atom(const Atom *got, const File &f) : PLTAtom(f, ".plt") {
     // Setup reference to fixup the PLT0 entry.
-    addReferenceELF_Mips(LLD_R_MIPS_HI16, 0, got, 0);
-    addReferenceELF_Mips(LLD_R_MIPS_LO16, 4, got, 0);
-    addReferenceELF_Mips(LLD_R_MIPS_LO16, 8, got, 0);
+    addReferenceELF_Mips(R_MIPS_HI16, 0, got, 0);
+    addReferenceELF_Mips(R_MIPS_LO16, 4, got, 0);
+    addReferenceELF_Mips(R_MIPS_LO16, 8, got, 0);
   }
 
   ArrayRef<uint8_t> rawContent() const override {
@@ -212,9 +212,9 @@ class PLTAAtom : public PLTAtom {
 public:
   PLTAAtom(const GOTPLTAtom *got, const File &f) : PLTAtom(f, ".plt") {
     // Setup reference to fixup the PLT entry.
-    addReferenceELF_Mips(LLD_R_MIPS_HI16, 0, got, 0);
-    addReferenceELF_Mips(LLD_R_MIPS_LO16, 4, got, 0);
-    addReferenceELF_Mips(LLD_R_MIPS_LO16, 12, got, 0);
+    addReferenceELF_Mips(R_MIPS_HI16, 0, got, 0);
+    addReferenceELF_Mips(R_MIPS_LO16, 4, got, 0);
+    addReferenceELF_Mips(R_MIPS_LO16, 12, got, 0);
   }
 
   ArrayRef<uint8_t> rawContent() const override {