[PATCH] x86: Restore PC16 relocation overflow check
Jan Beulich
jbeulich@suse.com
Fri May 28 11:56:53 GMT 2021
On 28.05.2021 13:40, H.J. Lu wrote:
> On Thu, May 27, 2021 at 11:48 PM Jan Beulich <jbeulich@suse.com> wrote:
>>
>> On 27.05.2021 19:38, H.J. Lu wrote:
>>> The x86-64 psABI has
>>>
>>> ---
>>> A program or object file using R_X86_64_8, R_X86_64_16, R_X86_64_PC16
>>> or R_X86_64_PC8 relocations is not conformant to this ABI, these
>>> relocations are only added for documentation purposes.
>>> ---
>>>
>>> Since x86 PC16 relocations were intended for 16-bit programs in an ELF32
>>> or ELF64 container, PC16 relocation should wrap-around in 16-bit address
>>> space.
>>
>> This, to me at least, does not follow from the ABI wording. Or else
>> the same would apply to PC8.
>
> Since x86 doesn't support 8-bit mode, PC8 is different from PC16.
>
>>> Revert
>>>
>>> commit a7664973b24a242cd9ea17deb5eaf503065fc0bd
>>> Author: Jan Beulich <jbeulich@suse.com>
>>> Date: Mon Apr 26 10:41:35 2021 +0200
>>>
>>> x86: correct overflow checking for 16-bit PC-relative relocs
>>
>> I disagree with this revert, at least as long as there's no clear
>> plan for an alternative. As long as PC8 and PC16 aren't specifically
>> called out as _intentionally_ having different behavior, their
>
> PC16 is different and used for 16-bit programs.
PC8 when used by 16-bit programs is also different from PC8 when
used by 32- or 64-bit ones. Yet one and the same relocation shouldn't
have different meaning.
Jan
More information about the Binutils
mailing list