[edk2-devel] [PATCH v4 01/10] BaseTools: add BASETOOLS define

Gerd Hoffmann kraxel at redhat.com
Tue Apr 18 13:20:15 UTC 2023


On Tue, Apr 18, 2023 at 01:59:43PM +0200, Ard Biesheuvel wrote:
> On Tue, 18 Apr 2023 at 13:52, Gerd Hoffmann <kraxel at redhat.com> wrote:
> >
> > Seems to work fine on fedora 37, even without adding --relax, maybe this
> > is enabled by default (there is a --no-relax switch after all).  I'll go
> > try older distros / compilers / binutils too.
> >
> > What would be the failure mode?  Errors on ELF -> PE conversion because
> > a GOT is present?  Or will things break at runtime?
> >
> 
> The problem here is that we rely on --emit-relocs to get at the
> relocations in the binary, in order to convert the absolute ones into
> PE/COFF relocations.
> 
> However, --emit-relocs did not use to cover the GOT, as those are
> added at the end by the linker and not by the compiler. So if the GOT
> is non-empty, the resulting PE executable will be corrupt.

So no build error.  And at runtime probably random effects, depending on
whenever the execution path happens to hit a bad relocation or not.  So
compile + boot testing doesn't cut it.  Lovely.

So, what can I do instead?  Check **/DEBUG/*.debug and see whenever a
.got section is present?

> Of course, the answer here is to dump GenFw altogether for ELF to PE
> conversion, and implement something that consumes the dynamic
> relocations generated when linking in PIE mode.

Marvin's ImageTool is exactly that I think ...

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103162): https://edk2.groups.io/g/devel/message/103162
Mute This Topic: https://groups.io/mt/98257896/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list