[PATCH] D29714: [ELF] - Do sign extend for addends of R_386_8, R_386_16 relocations

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 14 05:29:06 PST 2017


George Rimar <grimar at accesssoftek.com> writes:

>>Looking more into the problem I think George is right that the addend
>>has to be sign extended, but I think it is a far more general issue.
>>
>>My confusion was from what it means for a relocation to be unsigned. I
>>think the answer is just that the value at runtime will be zero
>>extended. It should say nothing about the addend. In fact, I think the
>>correct solution is to say that addends on ELF are always signed. That
>>is true even for Elf_Rela.
>>
>>We were not hitting problems with Elf_Rela because we were very
>>careful to always use uintX_t, and that produces the same result. But
>>is easier and more explicit IMHO to use int64_t for both explicit and
>>implicit addends.
>>
>>So how about the attached patch?
>>
>>Sorry again for the delay and confusion.
>>
>>Cheers,
>>Rafael
>
> Thanks for looking, Rafael !
>
> Patch looks fine for me, though I would probably split it into two. First that changes interface
> and addend type and second for R_386_8/R_386_16 part with the testcase it already has.

OK. Can you commit your patch first? I will then commit the rest for
consistency and send just the s/uintX_t/int64_t/ for independent review.

Cheers,
Rafael


More information about the llvm-commits mailing list