diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-01-17 20:45:01 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-01-17 20:45:01 +0000 |
commit | 706b4fc47bbc608932d3b491ae19a3b9cde9497b (patch) | |
tree | 4adf86a776049cbf7f69a1929c4babcbbef925eb /llvm/lib/Object/RelocationResolver.cpp | |
parent | 7cc9cf2bf09f069cb2dd947ead05d0b54301fb71 (diff) |
Notes
Diffstat (limited to 'llvm/lib/Object/RelocationResolver.cpp')
-rw-r--r-- | llvm/lib/Object/RelocationResolver.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Object/RelocationResolver.cpp b/llvm/lib/Object/RelocationResolver.cpp index ca89f5671b8a..31478be7899e 100644 --- a/llvm/lib/Object/RelocationResolver.cpp +++ b/llvm/lib/Object/RelocationResolver.cpp @@ -105,6 +105,7 @@ static bool supportsMips64(uint64_t Type) { case ELF::R_MIPS_32: case ELF::R_MIPS_64: case ELF::R_MIPS_TLS_DTPREL64: + case ELF::R_MIPS_PC32: return true; default: return false; @@ -119,6 +120,8 @@ static uint64_t resolveMips64(RelocationRef R, uint64_t S, uint64_t A) { return S + getELFAddend(R); case ELF::R_MIPS_TLS_DTPREL64: return S + getELFAddend(R) - 0x8000; + case ELF::R_MIPS_PC32: + return S + getELFAddend(R) - R.getOffset(); default: llvm_unreachable("Invalid relocation type"); } @@ -336,6 +339,7 @@ static bool supportsRISCV(uint64_t Type) { switch (Type) { case ELF::R_RISCV_NONE: case ELF::R_RISCV_32: + case ELF::R_RISCV_32_PCREL: case ELF::R_RISCV_64: case ELF::R_RISCV_SET6: case ELF::R_RISCV_SUB6: @@ -360,12 +364,14 @@ static uint64_t resolveRISCV(RelocationRef R, uint64_t S, uint64_t A) { return A; case ELF::R_RISCV_32: return (S + RA) & 0xFFFFFFFF; + case ELF::R_RISCV_32_PCREL: + return (S + RA - R.getOffset()) & 0xFFFFFFFF; case ELF::R_RISCV_64: return S + RA; case ELF::R_RISCV_SET6: - return (A + (S + RA)) & 0xFF; + return (A & 0xC0) | ((S + RA) & 0x3F); case ELF::R_RISCV_SUB6: - return (A - (S + RA)) & 0xFF; + return (A & 0xC0) | (((A & 0x3F) - (S + RA)) & 0x3F); case ELF::R_RISCV_ADD8: return (A + (S + RA)) & 0xFF; case ELF::R_RISCV_SUB8: |