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

Khem Raj raj.khem at gmail.com
Tue Jan 23 22:43:06 UTC 2018


On 12/16/17 12:57 PM, Allen Wild wrote:
>>   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.

you need to override LD in recipe much like how KERNEL_LD is setup and
then ensure that LD is honored by makefiles
and sets LD to weakly assign to 'ld' to fix it properly.

> 
> 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
> <mailto:ross.burton at intel.com>> wrote:
> 
>     On 13 December 2017 at 02:42, Allen Wild <allenwild93 at gmail.com
>     <mailto: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 
> 
> 
> 




More information about the Openembedded-core mailing list