Silence warnings and simplify code. Eliminate a 32/64 bit portability issue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111201 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2010-08-16 23:00:12 +00:00
parent 3620ff9a8b
commit 1f8aa7bf08

View File

@ -545,14 +545,13 @@ void ELFObjectWriterImpl::RecordRelocation(const MCAssembler &Asm,
if (IsPCRel) {
Type = ELF::R_X86_64_PC32;
} else {
switch (Fixup.getKind()) {
switch ((unsigned)Fixup.getKind()) {
default: llvm_unreachable("invalid fixup kind!");
case FK_Data_8: Type = ELF::R_X86_64_64; break;
case X86::reloc_pcrel_4byte:
case FK_Data_4:
long Offset;
Offset = Target.getConstant();
// check that the offset fits within a signed long
if (!(((long) -1 << 31) & Offset) || (((long) -1 << 31) & Offset) == ((long) -1 << 31))
if (isInt<32>(Target.getConstant()))
Type = ELF::R_X86_64_32S;
else
Type = ELF::R_X86_64_32;