[PATCH] D29392: [ELF] - Change value checks to checkUInt for R_386_8/R_386_PC8/R_386_16/R_386_PC16 relocations.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 3 06:44:08 PST 2017
grimar added a comment.
In https://reviews.llvm.org/D29392#665226, @ruiu wrote:
> I'm sorry I didn't understand that.
> So, back to the example. You have this expression in assembly. This expression clearly needs overflow checking in some form for its operand because if it overflows (i.e. the jump target is too far), this jump instruction jumps to a wrong address. Is this OK?
> jmp trampoline_start
I think issue here is the same as https://reviews.llvm.org/D29490. Just need to signextend the addend. Output is correct:
125a: e9 a3 fd f4 eb jmp ebf51002 <intcall+0xebf4bdaa>
Above is 2 bytes relative jump (disasm just reads it as 4 bytes, but we know it is 2 bytes here), so it is:
JMP rel16, where rel16 = 0xFDA3 = -605.
0x125a - 605 + 3 bytes = 0xFFD + 3 = 0x1000
And at this adress I see:
1000: fa cli
So we produce correct output, but error out because of wrong addend,
I'll prepare a patch for addend, the same like for PC8 (https://reviews.llvm.org/D29490).
More information about the llvm-commits