[lld] r233057 - [Mips] Support MIPS N64 relocation record format

Aaron Ballman aaron at aaronballman.com
Tue Mar 24 06:19:53 PDT 2015


On Tue, Mar 24, 2015 at 9:17 AM, Simon Atanasyan <simon at atanasyan.com> wrote:
> On Tue, Mar 24, 2015 at 4:02 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
>> On Tue, Mar 24, 2015 at 5:57 AM, Simon Atanasyan <simon at atanasyan.com> wrote:
>>> +  MipsELFReference(uint64_t symValue, const Elf_Rela &rel)
>>> +      : ELFReference<ELFT>(
>>> +            &rel, rel.r_offset - symValue, Reference::KindArch::Mips,
>>> +            rel.getType(_isMips64EL) & 0xff, rel.getSymbol(_isMips64EL)),
>>> +        _tag(rel.getType(_isMips64EL) >> 8) {}
>>
>> This code is causing a warning in MSVC because rel.getType() returns
>> an unsigned char, but you then >> by sizeof(unsigned char). Is that
>> intended?
>
> In general it is not a problem because rel.getType() has unsigned char
> return type
> in case of 32-bit variant of Elf_Rel_Impl only. For 32-bit MIPS ABI
> the _tag should
> be always zero. 64-bit variant of Elf_Rel_Impl has `uint32_t
> getType()` declaration.

Ah, so getType() really doesn't matter in the 32-bit case and can be
initialized to 0 directly.

> Anyway, thanks for the information. I will try to reorganize the code to escape
> the warning.

Thanks!

~Aaron



More information about the llvm-commits mailing list