COFF vs ELF handling of undefined symbols
Jan Beulich
jbeulich@suse.com
Sun Jun 29 13:35:54 GMT 2025
On 29.06.2025 14:02, Paul Edwards wrote:
> I passed your message on to the authors of pdld and slink
> (both of which are now capable of producing libraries that
> Microsoft's linker will accept - after a lot of effort, emails
> and debate), and the author (Robert Pengelly) of slink
> replied with the below. I'm not close to the issue myself, so
> I'm not claiming to understand/agree (or disagree) with it,
> nor the original issue - I'm merely passing it back in case
> it is useful.
Thanks. I have to admit that I'm quite puzzled by the reply, though.
>> Does anyone have knowledge or pointers that could help address the question
>> of how we _should_ behave?
>
> Unless there's a standard that I'm unware of then it should be up to
> the developer and not any signel person. If there developer wants to
> only search referenced symbols then they should be allowed to and
> people should just adapt to it (e.g. Using another flag like in the
> case of pdld). In slink I just create a link compatible library if
> creating a PE/COFF library and again that's my choice.
>
>> Therefore, if we deemed resolution of undefined symbols to be wrong for the COFF
>> world
>
> Again, like I said it's not a COFF problem it's a PE/COFF problem
> cause it's Microsoft's implementations that cause issues. COFF and
> PE/COFF are two different things as Microsoft added a bunch of stuff
> and made up there own rules about stuff regarding. We can't say that
> COFF in gernal is wrong as it worked fine in the Unix world until ELF
> was created to address some of the sort fails with COFF (e.g.
> Supporting different endianess).
>
> That's my take on it but of course your perfectly entitled to have
> your own views/opinions but like I said unless there actually is a
> standard then I think no-one should be forced into one way or another
> just because a few people think something. In fact we've had the same
> conversation about COFF vs PE/COFF, I wanted (pdld author) to
> distinguish between the two but he wont and that's his choice.
I'm having a hard time seeing how this could be converted into anything
practical. The linker has to behave in one of the two possible ways; it
can't do it "both ways". Even if we added a command line option, we'd
still need to settle on a default.
Apart from this, short of the behavior spelled out anywhere, I'm inclined
to think that for PE/COFF the behavior of Microsoft's linker then would
need to serve as the reference.
Jan
More information about the Binutils
mailing list