aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@mips.com>2011-11-23 22:18:04 +0000
committerAkira Hatanaka <ahatanaka@mips.com>2011-11-23 22:18:04 +0000
commit84bfc2f090639f933df06cc675c4385511516bef (patch)
tree561304baa9c37c15c3e12961eca893c046c19cae /lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
parente73db4e2a79a6999d20fdba881bfb39d89b5397d (diff)
downloadexternal_llvm-84bfc2f090639f933df06cc675c4385511516bef.zip
external_llvm-84bfc2f090639f933df06cc675c4385511516bef.tar.gz
external_llvm-84bfc2f090639f933df06cc675c4385511516bef.tar.bz2
This patch addresses gp relative fixups/relocations for jump tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145112 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp')
-rw-r--r--lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp b/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
index 4f017d0..7bc5fe4 100644
--- a/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
+++ b/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
@@ -58,6 +58,7 @@ static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) {
switch (Kind) {
default:
break;
+ case FK_GPRel_4:
case FK_Data_4:
Value &= 0xffffffff;
break;
@@ -68,6 +69,9 @@ static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) {
case Mips::fixup_Mips_PC16:
Value &= 0x0000ffff;
break;
+ case Mips::fixup_Mips_HI16:
+ Value >>= 16;
+ break;
}
return Value;
@@ -104,15 +108,17 @@ public:
llvm_unreachable("Unknown fixup kind!");
case Mips::fixup_Mips_GOT16: // This will be fixed up at link time
break;
+ case FK_GPRel_4:
case FK_Data_4:
case Mips::fixup_Mips_26:
case Mips::fixup_Mips_LO16:
case Mips::fixup_Mips_PC16:
+ case Mips::fixup_Mips_HI16:
// For each byte of the fragment that the fixup touches, mask i
// the fixup value. The Value has been "split up" into the appr
// bitfields above.
for (unsigned i = 0; i != 4; ++i) // FIXME - Need to support 2 and 8 bytes
- Data[Offset + i] |= uint8_t((Value >> (i * 8)) & 0xff);
+ Data[Offset + i] += uint8_t((Value >> (i * 8)) & 0xff);
break;
}
}