[llvm-commits] lld update to add support for some hexagon relocations.

Michael Spencer bigcheesegs at gmail.com
Mon Oct 8 13:29:14 PDT 2012


On Fri, Oct 5, 2012 at 7:06 PM, Sid Manning <sidneym at codeaurora.org> wrote:
> On 10/02/12 14:17, Michael Spencer wrote:
>>
>> On Tue, Oct 2, 2012 at 11:09 AM, Sid Manning<sidneym at codeaurora.org>
>> wrote:
>>>
>>> On 09/28/12 12:22, Sid Manning wrote:
>
>
> ...
>>>
>>> +
>>> +/// \brief Word32_B22: 0x01ff3ffe : (S + A - P)>>  2 : Verify
>>> +int reloc_B22_PCREL(uint8_t *location, uint64_t P, uint64_t S, uint64_t
>>> A) {
>>> +  int32_t result = (uint32_t)(((S + A) - P)>>2);
>>> +  if ((result<  0x200000)&&  (result>  -0x200000)) {
>>> +      result = ((result<<1)&  0x3ffe) | ((result<<3)&  0x01ff0000);
>>>
>>> +      *(uint32_t *)location |= result;
>>
>>
>> This assumes the target and host have the same endianess. Use somthing
>> equivelent to:
>>
>>    *reinterpret_cast<u{little,big}32_t*>(location) = result |
>> *reinterpret_cast<const u{little,big}32_t*>(location);
>>
>
> Hexagon is always little endian, so:
>
> *reinterpret_cast<llvm::support::ulittle32_t *>(location) = result |
>            *reinterpret_cast<llvm::support::ulittle32_t *>(location);
>
> is what I did.  I will also update make kindHandler pass
> llvm::support::endianness down.
>
> To better allow testing of target/host endian differences I added support
> for PowerPC and did one relocation, R_PPC_REL24.
>
> llvm-objdump doesn't support Hexagon or PPC so the testing is not awesome
> but I did confirm the output was correct using binutils objdump.
>
> I also added a, -endian to lld-core.
>
> I took care of the rest of the comments.
>
> Thanks,
>
>
>>
>> - Michael Spencer
>
>
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by
> The Linux Foundation

lgtm.

- Michael Spencer



More information about the llvm-commits mailing list