[PATCH 0/5] Add support for R_386_GOT32X/R_X86_64_[REX_]GOTPCRELX

Alan Modra amodra@gmail.com
Tue Jan 19 01:32:00 GMT 2016


On Mon, Jan 18, 2016 at 01:16:35PM -0500, Rafael Espíndola wrote:
> It needs to convert an 0x8b to an 0x8c. So I guess the unwritten
> requirement of R_X86_64_GOTPCREL is that it can only be used at least
> 2 bytes after the start of an actual instruction, and not, for
> example, in a table:
> 
> bar:
>         .byte 0x8b
>         .byte 0x42
>         .long bar@GOTPCREL

It's worse than that.  You generally can't find the start of an x86
instruction from the relocation offset.  If you scan backwards, a byte
that looks like a prefix may in fact just be part of the previous insn
immediate or other fields.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list