diff options
author | Akira Hatanaka <ahatanaka@mips.com> | 2011-11-23 22:18:04 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@mips.com> | 2011-11-23 22:18:04 +0000 |
commit | f5ddf13f79b1d83c14a8a9b6c8df3f2f053a4088 (patch) | |
tree | 93892c51dea4ec5d419e522aa59fde588471806e /llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp | |
parent | 4f9a8081c370543c568a098138bcb785a7143469 (diff) | |
download | bcm5719-llvm-f5ddf13f79b1d83c14a8a9b6c8df3f2f053a4088.tar.gz bcm5719-llvm-f5ddf13f79b1d83c14a8a9b6c8df3f2f053a4088.zip |
This patch addresses gp relative fixups/relocations for jump tables.
llvm-svn: 145112
Diffstat (limited to 'llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp')
-rw-r--r-- | llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp index 4f017d0b203..7bc5fe4a6e4 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp +++ b/llvm/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; } } |