[lld] r204246 - [Mips] Handle R_MIPS_GOT16 relocation for external and local symbols in

Simon Atanasyan simon at atanasyan.com
Wed Mar 19 08:46:16 PDT 2014


Author: atanasyan
Date: Wed Mar 19 10:46:15 2014
New Revision: 204246

URL: http://llvm.org/viewvc/llvm-project?rev=204246&view=rev
Log:
[Mips] Handle R_MIPS_GOT16 relocation for external and local symbols in
a uniform way.

Modified:
    lld/trunk/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h
    lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
    lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
    lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp
    lld/trunk/test/elf/Mips/got16.test

Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h?rev=204246&r1=204245&r2=204246&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h Wed Mar 19 10:46:15 2014
@@ -18,8 +18,6 @@ namespace elf {
 enum {
   /// \brief Do nothing but mark GOT entry as a global one.
   LLD_R_MIPS_GLOBAL_GOT = 1024,
-  /// \brief The same as R_MIPS_GOT16 but for global symbols.
-  LLD_R_MIPS_GLOBAL_GOT16 = 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.

Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp?rev=204246&r1=204245&r2=204246&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp Wed Mar 19 10:46:15 2014
@@ -164,9 +164,6 @@ error_code MipsTargetRelocationHandler::
   case LLD_R_MIPS_GLOBAL_GOT:
     // Do nothing.
     break;
-  case LLD_R_MIPS_GLOBAL_GOT16:
-    relocGOT16(location, relocVAddress, targetVAddress, ref.addend(), gpAddr);
-    break;
   case LLD_R_MIPS_GLOBAL_26:
     reloc26ext(location, targetVAddress, ref.addend());
     break;

Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp?rev=204246&r1=204245&r2=204246&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp Wed Mar 19 10:46:15 2014
@@ -301,9 +301,6 @@ void RelocationPass::handlePLT(const Ref
 }
 
 void RelocationPass::handleGOT(const Reference &ref) {
-  if (ref.kindValue() == R_MIPS_GOT16 && !isLocal(ref.target()))
-    const_cast<Reference &>(ref).setKindValue(LLD_R_MIPS_GLOBAL_GOT16);
-
   if (requireLocalGOT(ref.target()))
     const_cast<Reference &>(ref).setTarget(getLocalGOTEntry(ref.target()));
   else

Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp?rev=204246&r1=204245&r2=204246&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp Wed Mar 19 10:46:15 2014
@@ -58,7 +58,6 @@ const Registry::KindStrings MipsTargetHa
   LLD_KIND_STRING_ENTRY(R_MIPS_COPY),
   LLD_KIND_STRING_ENTRY(R_MIPS_JUMP_SLOT),
   LLD_KIND_STRING_ENTRY(LLD_R_MIPS_GLOBAL_GOT),
-  LLD_KIND_STRING_ENTRY(LLD_R_MIPS_GLOBAL_GOT16),
   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),

Modified: lld/trunk/test/elf/Mips/got16.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/got16.test?rev=204246&r1=204245&r2=204246&view=diff
==============================================================================
--- lld/trunk/test/elf/Mips/got16.test (original)
+++ lld/trunk/test/elf/Mips/got16.test Wed Mar 19 10:46:15 2014
@@ -69,7 +69,7 @@
 # YAML:     - kind:            R_MIPS_LO16
 # YAML:       offset:          4
 # YAML:       target:          [[L003]]
-# YAML:     - kind:            LLD_R_MIPS_GLOBAL_GOT16
+# YAML:     - kind:            R_MIPS_GOT16
 # YAML:       offset:          8
 # YAML:       target:          [[L004]]
 # YAML:     - kind:            R_MIPS_CALL16





More information about the llvm-commits mailing list