This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH 0/5] Add support for R_386_GOT32X/R_X86_64_[REX_]GOTPCRELX
- From: Alan Modra <amodra at gmail dot com>
- To: Rafael Espíndola <rafael dot espindola at gmail dot com>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>, Binutils <binutils at sourceware dot org>
- Date: Tue, 19 Jan 2016 12:02:16 +1030
- Subject: Re: [PATCH 0/5] Add support for R_386_GOT32X/R_X86_64_[REX_]GOTPCRELX
- Authentication-results: sourceware.org; auth=none
- References: <1445514099-20925-1-git-send-email-hjl dot tools at gmail dot com> <CAG3jReK+ViY071FL1EMKh5uqLydvDUgQjKL7EM--a1G23gof-g at mail dot gmail dot com> <CAMe9rOoTgGh3-z2KnVkZQvKeLeXgfEj-++9MpbxtVcUgPHZjKQ at mail dot gmail dot com> <CAG3jRe+LY9EMD3e8NrnpOv-HaQfRt1pYAgNMw-1cbxPKONLMow at mail dot gmail dot com> <CAMe9rOpiyAi63ZGTTNsrn2w+07rED8TZW1g12U+SW8OhqkwWLQ at mail dot gmail dot com> <CAG3jReKLxhQWzJ=5dEbsdkPZTDL5TNmmkCD5Qw4CwmXfwzqGEw at mail dot gmail dot com> <CAMe9rOoAdbTd6nkEWGaN9GRDia+YPvLLhbkSfwjg7sD2C3WMPw at mail dot gmail dot com> <CAG3jReLmopgKT=3mnxeKc5zUPX2GTm9L9LJxjJtAHcAUqjZzNA at mail dot gmail dot com>
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