> On 18. Apr 2023, at 15:20, Gerd Hoffmann <kra...@redhat.com> wrote:
> 
> On Tue, Apr 18, 2023 at 01:59:43PM +0200, Ard Biesheuvel wrote:
>> On Tue, 18 Apr 2023 at 13:52, Gerd Hoffmann <kra...@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 ...

Not quite, we actually didn't change anything about PIE vs non-PIE yet (X64 is 
PIE, rest is non-PIE). Though that was on the "long-term TODO" for sure. There 
are many other advantages though and if you're looking for an alternative to 
GenFw, I'm still happy to discuss things right now. As I develop this as part 
of a thesis and its deadline is in July, any efforts past that heavily depend 
on the workload at whatever job I will end up in. :)

Best regards,
Marvin

> 
> take care,
>  Gerd
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103164): https://edk2.groups.io/g/devel/message/103164
Mute This Topic: https://groups.io/mt/98257896/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to