mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-17 15:38:40 +00:00
[Mips64][mcjit] Add R_MIPS_PC32 relocation
This patch adds R_MIPS_PC32 relocation for Mips64. Patch by Vladimir Radosavljevic. Differential Revision: http://reviews.llvm.org/D10235 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239301 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
17e24879cb
commit
f8aad6c1ef
@ -631,6 +631,10 @@ RuntimeDyldELF::evaluateMIPS64Relocation(const SectionEntry &Section,
|
|||||||
uint64_t FinalAddress = (Section.LoadAddress + Offset);
|
uint64_t FinalAddress = (Section.LoadAddress + Offset);
|
||||||
return ((Value + Addend - FinalAddress - 4) >> 2) & 0xffff;
|
return ((Value + Addend - FinalAddress - 4) >> 2) & 0xffff;
|
||||||
}
|
}
|
||||||
|
case ELF::R_MIPS_PC32: {
|
||||||
|
uint64_t FinalAddress = (Section.LoadAddress + Offset);
|
||||||
|
return Value + Addend - FinalAddress;
|
||||||
|
}
|
||||||
case ELF::R_MIPS_PC18_S3: {
|
case ELF::R_MIPS_PC18_S3: {
|
||||||
uint64_t FinalAddress = (Section.LoadAddress + Offset);
|
uint64_t FinalAddress = (Section.LoadAddress + Offset);
|
||||||
return ((Value + Addend - ((FinalAddress | 7) ^ 7)) >> 3) & 0x3ffff;
|
return ((Value + Addend - ((FinalAddress | 7) ^ 7)) >> 3) & 0x3ffff;
|
||||||
@ -669,6 +673,7 @@ void RuntimeDyldELF::applyMIPS64Relocation(uint8_t *TargetPtr,
|
|||||||
break;
|
break;
|
||||||
case ELF::R_MIPS_32:
|
case ELF::R_MIPS_32:
|
||||||
case ELF::R_MIPS_GPREL32:
|
case ELF::R_MIPS_GPREL32:
|
||||||
|
case ELF::R_MIPS_PC32:
|
||||||
writeBytesUnaligned(CalculatedValue & 0xffffffff, TargetPtr, 4);
|
writeBytesUnaligned(CalculatedValue & 0xffffffff, TargetPtr, 4);
|
||||||
break;
|
break;
|
||||||
case ELF::R_MIPS_64:
|
case ELF::R_MIPS_64:
|
||||||
|
@ -2,6 +2,15 @@
|
|||||||
# RUN: llc -mtriple=mips64el-unknown-linux -relocation-model=pic -filetype=obj -o %T/test_ELF_ExternalFunction_Mips64N64.o %S/Inputs/ExternalFunction.ll
|
# RUN: llc -mtriple=mips64el-unknown-linux -relocation-model=pic -filetype=obj -o %T/test_ELF_ExternalFunction_Mips64N64.o %S/Inputs/ExternalFunction.ll
|
||||||
# RUN: llvm-rtdyld -triple=mips64el-unknown-linux -verify -map-section test_ELF_Mips64N64.o,.text=0x1000 -map-section test_ELF_ExternalFunction_Mips64N64.o,.text=0x10000 -check=%s %/T/test_ELF_Mips64N64.o %T/test_ELF_ExternalFunction_Mips64N64.o
|
# RUN: llvm-rtdyld -triple=mips64el-unknown-linux -verify -map-section test_ELF_Mips64N64.o,.text=0x1000 -map-section test_ELF_ExternalFunction_Mips64N64.o,.text=0x10000 -check=%s %/T/test_ELF_Mips64N64.o %T/test_ELF_ExternalFunction_Mips64N64.o
|
||||||
|
|
||||||
|
.data
|
||||||
|
# Test R_MIPS_PC32 relocation.
|
||||||
|
# rtdyld-check: *{4}(R_MIPS_PC32) = (foo - R_MIPS_PC32)[31:0]
|
||||||
|
R_MIPS_PC32:
|
||||||
|
.word foo-.
|
||||||
|
# rtdyld-check: *{4}(R_MIPS_PC32 + 4) = (foo - tmp1)[31:0]
|
||||||
|
tmp1:
|
||||||
|
.4byte foo-tmp1
|
||||||
|
|
||||||
.text
|
.text
|
||||||
.abicalls
|
.abicalls
|
||||||
.section .mdebug.abi64,"",@progbits
|
.section .mdebug.abi64,"",@progbits
|
||||||
|
Loading…
x
Reference in New Issue
Block a user