[lld] r270657 - Reduce code duplication.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue May 24 21:10:14 PDT 2016
Author: ruiu
Date: Tue May 24 23:10:14 2016
New Revision: 270657
URL: http://llvm.org/viewvc/llvm-project?rev=270657&view=rev
Log:
Reduce code duplication.
Modified:
lld/trunk/ELF/Target.cpp
Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=270657&r1=270656&r2=270657&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Tue May 24 23:10:14 2016
@@ -700,15 +700,6 @@ void X86_64TargetInfo::relocateOne(uint8
case R_X86_64_32S:
case R_X86_64_TPOFF32:
case R_X86_64_GOT32:
- checkInt<32>(Val, Type);
- write32le(Loc, Val);
- break;
- case R_X86_64_64:
- case R_X86_64_DTPOFF64:
- case R_X86_64_SIZE64:
- case R_X86_64_PC64:
- write64le(Loc, Val);
- break;
case R_X86_64_GOTPCREL:
case R_X86_64_GOTPCRELX:
case R_X86_64_REX_GOTPCRELX:
@@ -722,6 +713,12 @@ void X86_64TargetInfo::relocateOne(uint8
checkInt<32>(Val, Type);
write32le(Loc, Val);
break;
+ case R_X86_64_64:
+ case R_X86_64_DTPOFF64:
+ case R_X86_64_SIZE64:
+ case R_X86_64_PC64:
+ write64le(Loc, Val);
+ break;
default:
fatal("unrecognized reloc " + Twine(Type));
}
@@ -1075,14 +1072,17 @@ void AArch64TargetInfo::relocateOne(uint
uint64_t Val) const {
switch (Type) {
case R_AARCH64_ABS16:
+ case R_AARCH64_PREL16:
checkIntUInt<16>(Val, Type);
write16le(Loc, Val);
break;
case R_AARCH64_ABS32:
+ case R_AARCH64_PREL32:
checkIntUInt<32>(Val, Type);
write32le(Loc, Val);
break;
case R_AARCH64_ABS64:
+ case R_AARCH64_PREL64:
write64le(Loc, Val);
break;
case R_AARCH64_ADD_ABS_LO12_NC:
@@ -1093,6 +1093,8 @@ void AArch64TargetInfo::relocateOne(uint
or32le(Loc, (Val & 0xFFF) << 10);
break;
case R_AARCH64_ADR_GOT_PAGE:
+ case R_AARCH64_ADR_PREL_PG_HI21:
+ case R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
checkInt<33>(Val, Type);
updateAArch64Addr(Loc, (Val >> 12) & 0x1FFFFF); // X[32:12]
break;
@@ -1100,11 +1102,6 @@ void AArch64TargetInfo::relocateOne(uint
checkInt<21>(Val, Type);
updateAArch64Addr(Loc, Val & 0x1FFFFF);
break;
- case R_AARCH64_ADR_PREL_PG_HI21:
- case R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
- checkInt<33>(Val, Type);
- updateAArch64Addr(Loc, (Val >> 12) & 0x1FFFFF); // X[32:12]
- break;
case R_AARCH64_CALL26:
case R_AARCH64_JUMP26:
checkInt<28>(Val, Type);
@@ -1134,17 +1131,6 @@ void AArch64TargetInfo::relocateOne(uint
case R_AARCH64_LDST64_ABS_LO12_NC:
or32le(Loc, (Val & 0xFF8) << 7);
break;
- case R_AARCH64_PREL16:
- checkIntUInt<16>(Val, Type);
- write16le(Loc, Val);
- break;
- case R_AARCH64_PREL32:
- checkIntUInt<32>(Val, Type);
- write32le(Loc, Val);
- break;
- case R_AARCH64_PREL64:
- write64le(Loc, Val);
- break;
case R_AARCH64_TSTBR14:
checkInt<16>(Val, Type);
or32le(Loc, (Val & 0xFFFC) << 3);
More information about the llvm-commits
mailing list