summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2015-06-22 09:25:57 +0000
committerSimon Atanasyan <simon@atanasyan.com>2015-06-22 09:25:57 +0000
commite55110454d649d9f644b0ce9c72557784d3285e9 (patch)
tree3f95c3f0db25a70aea906976bb9d2363b35eb06d /lld/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
parentd78609a7acb3b06e70bf7e0bd38223faf1db1a43 (diff)
downloadbcm5719-llvm-e55110454d649d9f644b0ce9c72557784d3285e9.tar.gz
bcm5719-llvm-e55110454d649d9f644b0ce9c72557784d3285e9.zip
[Mips] Support R_MIPS_HIGHER / R_MIPS_HIGHEST relocations handling
llvm-svn: 240259
Diffstat (limited to 'lld/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp')
-rw-r--r--lld/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
index e7a57e63e59..42fdc7726b7 100644
--- a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
+++ b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
@@ -100,6 +100,8 @@ static MipsRelocationParams getRelocationParams(uint32_t rType) {
case R_MIPS_HI16:
return {4, 0xffff, 0, false, gpDispCheck<16>};
case R_MIPS_LO16:
+ case R_MIPS_HIGHER:
+ case R_MIPS_HIGHEST:
return {4, 0xffff, 0, false, dummyCheck};
case R_MIPS_16:
case R_MIPS_PCHI16:
@@ -195,6 +197,14 @@ static int64_t getHi16(int64_t value) {
return ((value + 0x8000) >> 16) & 0xffff;
}
+static int64_t getHigher16(int64_t value) {
+ return ((value + 0x80008000ull) >> 32) & 0xffff;
+}
+
+static int64_t getHighest16(int64_t value) {
+ return ((value + 0x800080008000ull) >> 48) & 0xffff;
+}
+
static int64_t maskLow16(int64_t value) {
return (value + 0x8000) & ~0xffff;
}
@@ -382,6 +392,10 @@ static ErrorOr<int64_t> calculateRelocation(Reference::KindValue kind,
case R_MICROMIPS_GOT_HI16:
case R_MICROMIPS_CALL_HI16:
return getHi16(tgtAddr - gpAddr);
+ case R_MIPS_HIGHER:
+ return getHigher16(tgtAddr + addend);
+ case R_MIPS_HIGHEST:
+ return getHighest16(tgtAddr + addend);
case R_MIPS_EH:
case R_MIPS_GOT16:
case R_MIPS_CALL16:
OpenPOWER on IntegriCloud