[PATCH] elf/x86-64: Subtract __ImageBase for R_AMD64_IMAGEBASE
Jan Beulich
jbeulich@suse.com
Tue Feb 23 15:11:20 GMT 2021
On 23.02.2021 16:07, H.J. Lu wrote:
> On Tue, Feb 23, 2021 at 7:02 AM Jan Beulich <jbeulich@suse.com> wrote:
>>
>> On 23.02.2021 15:47, H.J. Lu wrote:
>>> On Tue, Feb 23, 2021 at 6:10 AM Jan Beulich <jbeulich@suse.com> wrote:
>>>>
>>>> On 23.02.2021 14:31, H.J. Lu wrote:
>>>>> On Tue, Feb 23, 2021 at 5:15 AM Jan Beulich <jbeulich@suse.com> wrote:
>>>>>>
>>>>>> On 23.02.2021 13:15, H.J. Lu via Binutils wrote:
>>>>>>> When linking PE/x86-64 inputs to generate ELF executable, we need to
>>>>>>> subtract __ImageBase, aka __executable_start, for R_AMD64_IMAGEBASE
>>>>>>> relocation.
>>>>>>
>>>>>> Do you really mean PE/x86-64, not the respective COFF objects? In the
>>>>>
>>>>> What is the difference? How should I call object files generated by
>>>>> Microsoft Visual Studio?
>>>>
>>>> The call them COFF themselves, I believe.
>>>
>>> I have an impression that Windows relocations are different from regular
>>> COFF relocations. coff-x86_64.c has COFF_WITH_PE in many places.
>>
>> Right - there are differences.
>>
>>> My patch is only for Windows/PE:
>>>
>>> && strcmp (abfd->xvec->name, "pe-x86-64") == 0
>>
>> That's (imo) bfd-internal naming that's not helpful to understand what
>> it really is that talk is about. Comments would hence likely benefit
>> from naming things like they are called commonly.
>
> Will "Windows x86-64 relocatable inputs" be better?
I think so, yes. Of course I continue to be puzzled by the x86-64
special casing here. The concept of image base and image base
relative relocations is architecture independent afaik.
Jan
More information about the Binutils
mailing list