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

llvm-svn: 111201
This commit is contained in:
Benjamin Kramer 2010-08-16 23:00:12 +00:00
parent 72106f71dc
commit 70e0faed21

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;