[OE-core] [PATCH] syslinux: always use the BFD linker

Allen Wild allenwild93 at gmail.com
Sat Dec 16 18:57:05 UTC 2017


>   LD='${LD} -fuse-ld=bfd"

This doesn't work because the -fuse-ld option is only relevant when using
gcc as a wrapper for the linker.  The Makefile calls x86_64-oe-linux-ld
directly (which is a hardlink of x86_64-oe-linux-ld.gold or
x86_64-oe-linux-ld.bfd) so when the linker starts up it's already Gold,
rather than letting gcc call ld automatically.

Syslinux calls LD directly to use a custom linker script and avoids linking
with system libraries (not uncommon for bare-metal programs like a
bootloader). The -nostdlib gcc option can be used to get the same effect
when linking with gcc as a wrapper, but doing that involves patching many
syslinux makefiles to prefix LDFLAGS options with -Wl.

I have a working version of a patch that does this (19 changes in 15
makefiles), I can submit it here after some more testing if others think
it's an acceptable fix. I ignored the EFI targets for now, but such a patch
could be upstreamed after updating and testing the EFI code too.

>That's a terrible implementation of "install"

I agree, and I think that the fact that libgpl.elf and ldlinux.elf are
getting rebuilt at all means the current recipe violates upstream's "don't
recompile the bootloader itself" wishes in doc/distrib.txt. The tarball we
use includes shipped versions of those elf files and a bunch of c32 files,
but for some reason make is deciding to rebuild them from source when we
run make install. I haven't been able to determine why that's the case.

Allen

On Wed, Dec 13, 2017 at 6:53 AM, Burton, Ross <ross.burton at intel.com> wrote:

> On 13 December 2017 at 02:42, Allen Wild <allenwild93 at gmail.com> wrote:
>
>> Oops, forgot mail the list when sending my first reply.
>>
>> I tried appending LDFLAGS, but it doesn't work for syslinux. It's
>> during do_install, not do_compile, that $(LD) is called directly to
>> link libutil.elf, libcom32.elf, libgpl.elf, and ldlinux.elf.
>>
>
> That's a terrible implementation of "install" and it should be using
> LDFLAGS, so that's an upstreamable patch.  As Andre says, adding the flag
> to LD directly should work.
>
> Ross
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20171216/a572ce6e/attachment-0002.html>


More information about the Openembedded-core mailing list