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

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 14 00:24:06 PST 2017


>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.

George.


More information about the llvm-commits mailing list