[lld] r221602 - [Mips] Do not read addends for relocations which do not use them
Simon Atanasyan
simon at atanasyan.com
Mon Nov 10 07:50:01 PST 2014
Author: atanasyan
Date: Mon Nov 10 09:50:01 2014
New Revision: 221602
URL: http://llvm.org/viewvc/llvm-project?rev=221602&view=rev
Log:
[Mips] Do not read addends for relocations which do not use them
No functional changes.
Modified:
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h?rev=221602&r1=221601&r2=221602&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h Mon Nov 10 09:50:01 2014
@@ -207,14 +207,16 @@ private:
case llvm::ELF::R_MIPS_HI16:
case llvm::ELF::R_MIPS_LO16:
case llvm::ELF::R_MIPS_GOT16:
- case llvm::ELF::R_MIPS_TLS_GD:
- case llvm::ELF::R_MIPS_TLS_LDM:
- case llvm::ELF::R_MIPS_TLS_GOTTPREL:
case llvm::ELF::R_MIPS_TLS_DTPREL_HI16:
case llvm::ELF::R_MIPS_TLS_DTPREL_LO16:
case llvm::ELF::R_MIPS_TLS_TPREL_HI16:
case llvm::ELF::R_MIPS_TLS_TPREL_LO16:
return *(int16_t *)ap;
+ case llvm::ELF::R_MIPS_CALL16:
+ case llvm::ELF::R_MIPS_TLS_GD:
+ case llvm::ELF::R_MIPS_TLS_LDM:
+ case llvm::ELF::R_MIPS_TLS_GOTTPREL:
+ return 0;
default:
return 0;
}
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=221602&r1=221601&r2=221602&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp Mon Nov 10 09:50:01 2014
@@ -85,8 +85,7 @@ static void relocLo16(uint8_t *location,
/// \brief R_MIPS_GOT16, R_MIPS_CALL16
/// rel16 G (verify)
-static void relocGOT(uint8_t *location, uint64_t P, uint64_t S, int64_t A,
- uint64_t GP) {
+static void relocGOT(uint8_t *location, uint64_t S, uint64_t GP) {
int32_t G = (int32_t)(S - GP);
applyReloc(location, G, 0xffff);
}
@@ -152,17 +151,13 @@ std::error_code MipsTargetRelocationHand
relocLo16(location, relocVAddress, targetVAddress, ref.addend(), isGpDisp);
break;
case R_MIPS_GOT16:
- relocGOT(location, relocVAddress, targetVAddress, ref.addend(), gpAddr);
- break;
case R_MIPS_CALL16:
- relocGOT(location, relocVAddress, targetVAddress, ref.addend(), gpAddr);
+ relocGOT(location, targetVAddress, gpAddr);
break;
case R_MIPS_TLS_GD:
- relocGOT(location, relocVAddress, targetVAddress, ref.addend(), gpAddr);
- break;
case R_MIPS_TLS_LDM:
case R_MIPS_TLS_GOTTPREL:
- relocGOT(location, relocVAddress, targetVAddress, ref.addend(), gpAddr);
+ relocGOT(location, targetVAddress, gpAddr);
break;
case R_MIPS_TLS_DTPREL_HI16:
case R_MIPS_TLS_TPREL_HI16:
More information about the llvm-commits
mailing list