mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-07 12:18:32 +00:00
[mips][mips64r6] Add relocations R_MIPS_PC21_S2, R_MIPS_PC26_S2
Differential Revision: http://reviews.llvm.org/D3824 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209655 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -102,6 +102,22 @@ static unsigned adjustFixupValue(const MCFixup &Fixup, uint64_t Value,
|
||||
if (!isIntN(16, Value) && Ctx)
|
||||
Ctx->FatalError(Fixup.getLoc(), "out of range PC16 fixup");
|
||||
break;
|
||||
case Mips::fixup_MIPS_PC21_S2:
|
||||
Value -= 4;
|
||||
// Forcing a signed division because Value can be negative.
|
||||
Value = (int64_t) Value / 4;
|
||||
// We now check if Value can be encoded as a 21-bit signed immediate.
|
||||
if (!isIntN(21, Value) && Ctx)
|
||||
Ctx->FatalError(Fixup.getLoc(), "out of range PC21 fixup");
|
||||
break;
|
||||
case Mips::fixup_MIPS_PC26_S2:
|
||||
Value -= 4;
|
||||
// Forcing a signed division because Value can be negative.
|
||||
Value = (int64_t) Value / 4;
|
||||
// We now check if Value can be encoded as a 26-bit signed immediate.
|
||||
if (!isIntN(26, Value) && Ctx)
|
||||
Ctx->FatalError(Fixup.getLoc(), "out of range PC26 fixup");
|
||||
break;
|
||||
}
|
||||
|
||||
return Value;
|
||||
@@ -229,6 +245,8 @@ getFixupKindInfo(MCFixupKind Kind) const {
|
||||
{ "fixup_Mips_GOT_LO16", 0, 16, 0 },
|
||||
{ "fixup_Mips_CALL_HI16", 0, 16, 0 },
|
||||
{ "fixup_Mips_CALL_LO16", 0, 16, 0 },
|
||||
{ "fixup_MIPS_PC21_S2", 0, 21, MCFixupKindInfo::FKF_IsPCRel },
|
||||
{ "fixup_MIPS_PC26_S2", 0, 26, MCFixupKindInfo::FKF_IsPCRel },
|
||||
{ "fixup_MICROMIPS_26_S1", 0, 26, 0 },
|
||||
{ "fixup_MICROMIPS_HI16", 0, 16, 0 },
|
||||
{ "fixup_MICROMIPS_LO16", 0, 16, 0 },
|
||||
@@ -286,6 +304,8 @@ getFixupKindInfo(MCFixupKind Kind) const {
|
||||
{ "fixup_Mips_GOT_LO16", 16, 16, 0 },
|
||||
{ "fixup_Mips_CALL_HI16", 16, 16, 0 },
|
||||
{ "fixup_Mips_CALL_LO16", 16, 16, 0 },
|
||||
{ "fixup_MIPS_PC21_S2", 11, 21, MCFixupKindInfo::FKF_IsPCRel },
|
||||
{ "fixup_MIPS_PC26_S2", 6, 26, MCFixupKindInfo::FKF_IsPCRel },
|
||||
{ "fixup_MICROMIPS_26_S1", 6, 26, 0 },
|
||||
{ "fixup_MICROMIPS_HI16", 16, 16, 0 },
|
||||
{ "fixup_MICROMIPS_LO16", 16, 16, 0 },
|
||||
|
||||
Reference in New Issue
Block a user