[U-Boot] Makefile: Fix linking with modern binutils

Joel Stanley joel at jms.id.au
Fri Dec 16 05:53:17 CET 2016


On Tue, Dec 13, 2016 at 10:51 PM, Tom Rini <trini at konsulko.com> wrote:
> On Tue, Dec 13, 2016 at 03:31:24PM +1030, Joel Stanley wrote:
>> Hello Tom,
>>
>> On Sat, Dec 10, 2016 at 12:53 AM, Tom Rini <trini at konsulko.com> wrote:
>> >> -LDFLAGS_u-boot += $(LDFLAGS_FINAL)
>> >> +# Avoid Not enough room for program headers on binutils 2.28 onwards.
>> >> +# Flag was introduced in 2.26
>> >> +LDFLAGS_u-boot += $(LDFLAGS_FINAL) \
>> >> +     $(call ld-ifversion, -ge, 22600000, --no-dynamic-linker)
>> >
>> > This breaks on things like:
>> > $ arm-none-eabi-ld --version
>> > GNU ld (GNU Tools for ARM Embedded Processors) 2.24.0.20150921
>>
>> The flag will only be added when the version is >= 2.26. Which part of
>> that version string will break the test?
>
> The whole of the string breaks the test.  It comes out to 2037492100, is
> greater than is true, and tries to pass the flag which isn't know about
> in that version and fails.  Note that we're slightly behind the Linux
> kernel version of the ld-version script, but dropping that one in (which
> does have a bugfix) gives 224000000 for the version.  Perhaps it would
> give 226000000 or similar instead for what you've got and we need to
> update ld-version.sh in order to use this patch as-is?

Thanks for pointing that out. I don't have an old enough binutils
around to test that case.

You're correct; it does give 226000000 with the version of
ld-version.sh in the kernel tree. I recommend updating the u-boot copy
of the scripts to avoid this mistake in the future.

I will instead send a patch that tests for ld-option as Måns suggested.

Cheers,

Joel


More information about the U-Boot mailing list