[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
Wed Feb 8 06:21:18 PST 2017


> Are you sure these are sign extended? That is unexpected given the names.

Not sure I understood question right, but assuming next code:

.byte  und-1

.section .und, "ax"
und:

First line produces R_386_8 relocation with addend == -1 = 0xFF.
Before this patch we read is as 0x000000FF.

And target VA for us was out section address + offset = 0x3 + 0x000000FF = 0x102.

With this patch addend is correct -1 32 bit value: 0xFFFFFFFF, what gives VA = 
0x3 + 0xFFFFFFFF = 0x02.

I think it is correct and expected, am I missing something ?

George.


More information about the llvm-commits mailing list