This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: x86-64 push / jmp / mov of undefined label results in bad relocation for position-independent code


>>> On 22.08.17 at 13:25, <bruno.loff@gmail.com> wrote:
> When compiling an x86-64 assembly file which contains a `push`, `jmp`
> or `mov` instruction having an undefined label as an operand, `as`
> generates a relocation of type `R_X86_64_32S`, which is only 32bit
> long, i.e., it is too short for position-independent code (since such
> code might be loaded onto a position outside the 32-bit address
> space).

Of course. All three named mnemonics have only 32-bit immediate
operands, so a wider relocation cannot possibly be used with them.
You'll need to go through a register, using movabs or lea to load
the intended value into it.

Jan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]