[SeaBIOS] Re: recent ld built for x86_64 fails to accept 16bit code as input (seabios build)

Fangrui Song maskray@google.com
Sat Jul 11 01:01:16 GMT 2020


On 2020-07-10, Kevin O'Connor wrote:
>On Fri, Jul 10, 2020 at 11:58:06AM +0100, Nick Clifton wrote:
>> Hi Guys,
>>
>>   I have just updated PR 26047 with a suggested patch which I think could resolve
>>   this situation.  (Patch attached here as well in order to save time).  It adds
>>   a new linker command line option: -z allowexec  which will disable the warnings
>>   about linking in executable files.  The default is still to have these warnings
>>   as I think that in most cases this behaviour makes sense.
>>
>>   Will this solve the problem for you ?
>
>Hi Nick,
>
>Thanks for looking at this.
>
>I think the main issue is going to be the breaking of existing
>software builds.  In particular, as distros pull in the new version of
>binutils, they'll run into errors building their current version of
>SeaBIOS.  Even if we update SeaBIOS today, it will be some time before
>the distros will pull that change in.  It'll also be a problem for
>those trying to build older versions of SeaBIOS on newer toolchains.
>

>Unless I'm missing something, this will also be a problem for those
>building recent versions of the Linux kernel.  It's build used this
>ability of ld up until a few months ago (see
>https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=90ceddcb495008ac8ba7a3dce297841efcd7d584
>).  Although the latest Linux has changed, building older versions is
>fairly common.

There is no problem (reject linking ET_EXEC as input) for 5.4, 5.6 and
HEAD.  The fixes are in stable trees.

[PATCH 5.4 007/134] bpf: Support llvm-objcopy for vmlinux BTF
[PATCH 5.6 012/161] bpf: Support llvm-objcopy for vmlinux BTF

I haven't tested 5.2 (the first major release with potentially
problematic BTF commit) but if someone worries about 5.2 linkability
with GNU ld 2.35, the error can be downgraded to a warning.

>It's unclear to me if there are other common packages
>that use this ability of ld.

I don't think so.  There is no FreeBSD package which has been marked
LLD_UNSAFE for the sole reason that older GNU ld accepts ET_EXEC while
LLD rejects ET_EXEC.

Among the tens of thousands of ports,

% rg -l LLD_UNSAFE
75

> In the future there may be more ET_* types. I don't think linking them
> will be correct/intended
>
> https://groups.google.com/forum/#!topic/generic-abi/tJq7anc6WKs "RFC:
> Add ET_DEBUG"
> (the RFC has not been accepted but OSes can freely use ET_GNU_* )

The opinion in my other message
(https://sourceware.org/pipermail/binutils/2020-July/112283.html )
stands. allowexec will not be a suitable option name.


For seabios and Linux 5.2 (this major release only), a linker warning
should not hurt.
In a future release of GNU ld, the warning can be upgraded to an error.


More information about the Binutils mailing list