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: Rafael EspÃndola <rafael dot espindola at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Mon, 18 Jan 2016 13:16:35 -0500
- 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>
>> The byte stream before the R_X86_64_GOTPCREL location does. Checking
>> for the REX prefix is not that different from checking if the
>> instruction in a mov when converting mov to lea.
>>
>
> For mov to lea, linker doesn't need to rewrite the REX byte. When linker
> does need to rewrite the REX byte, it must be sure that the byte before
> the opcode is the REX byte, not the part of the displacement of the
> previous instruction.
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
R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX add far more strict requirements.
Thanks,
Rafael