[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
Fri Feb 10 05:46:13 PST 2017


George Rimar via Phabricator <reviews at reviews.llvm.org> writes:

> grimar added a comment.
>
> In https://reviews.llvm.org/D29714#671060, @ruiu wrote:
>
>> Maybe we need to sign extend everything? In other words, is there any relocation that we shouldn't sign extend?
>
>
> From my understanding we should extend only relocations that have addend value shorter than target size.
>
> I mean we return 64 bit value from getImplicitAddend(), it is then assigned to uintX_t. So for i386 case for example we want to extend all relocations that are not reading 32 bits, 
> as anyways value is truncated later.
> So I believe, for i386 this patch is all what else needed for it's relocations, all other ones are working with 32 bits already.

I am sure the rule is not that generic. X86_64 explicitly has
R_X86_64_32S since R_X86_64_32 is unsigned. I am sorry I haven't had the
time to look deeper at this, but I really think the problem is somewhere
else.

Cheers,
Rafael


More information about the llvm-commits mailing list