[llvm-commits] [llvm] r136855 - in /llvm/trunk: lib/MC/ELFObjectWriter.cpp lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp test/MC/ELF/x86_64-reloc-sizetest.s

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Thu Aug 4 05:18:13 PDT 2011


nit: remove trailing white space:
> +
> +    // Check that the upper bits are either all 0 or all 1's
> +    switch (Size) {
> +    case 1:
> +      assert((isInt<8>(Value) || isUInt<8>(Value))&&
> +             "Value does not fit in a 1Byte Reloc");
> +      break;
> +    case 2:
> +      assert((isInt<16>(Value) || isUInt<16>(Value))&&
> +             "Value does not fit in a 2Byte Reloc");
> +      break;
> +    case 4:
> +      assert((isInt<32>(Value) || isUInt<32>(Value))&&
> +             "Value does not fit in a 4Byte Reloc");
> +      break;
> +    }
> +

Note that this is asserting on the symbol value, not the addend as the 
old assert was. The assert for the addend should only depend on the ELF 
format being 32 (isInt<32>) or 64 bits (isInt<64>), since that is the 
only real constraint that the file format has.

For the symbol value your asserts looks correct, but you might want to 
account for the relocation being signed or unsigned too.

This also found a bug on the elf dumper, since it is only printing 32 
bits of the addend.

I will try to take a look at adding back an assert for the addend and 
the elf dumper problem. Can you take a look at the making the symbol 
value assert more strict?

Cheers,
Rafael



More information about the llvm-commits mailing list