[PATCH v3] elf/x86-64: Subtract __ImageBase for R_AMD64_IMAGEBASE
Alan Modra
amodra@gmail.com
Mon Mar 1 12:19:26 GMT 2021
On Sat, Feb 27, 2021 at 06:38:24PM -0800, H.J. Lu wrote:
> On Wed, Feb 24, 2021 at 6:09 PM Alan Modra <amodra@gmail.com> wrote:
> >
> > On Tue, Feb 23, 2021 at 09:50:20AM -0800, H.J. Lu via Binutils wrote:
> > > * reloc.c (bfd_perform_relocation): Add a link_info argument.
> > > Subtract __ImageBase for R_AMD64_IMAGEBASE.
> >
> > H.J., did you consider moving all of this, including the code you
> > added in git commit 36068e2fa54, to the relevant howto special
> > functions? None of it really belongs in bfd_perform_relocation.
>
> The howto special function, coff_amd64_reloc, isn't changed since
>
> 1. Any changes to coff_amd64_reloc may break Windows x86-64 linker.
I am sure you are capable of making those changes without breaking
windows.
> 2. bfd_perform_relocation changes are safe since they are limited to
> generating x86-64 ELF executable from Windows x86-64 relocatable object
> files.
It is the wrong place. Every time bfd_perform_relocation is called
with a coff input it now needs to test for output to ELF. If you did
this properly in a howto function then the extra tests would only be
done for x86_64 coff. Besides the performance impact, nobody
maintaining reloc.c wants to deal with code specially for pe-x86-64
and elf64-x84-64. The special case for coff there is already
horrible. It shouldn't be made worse.
Did anyone review your commit 36068e2fa54?
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list