[U-Boot] [PATCH] Switch from archive libraries to partial linking

Kumar Gala galak at kernel.crashing.org
Tue Jan 25 01:03:50 CET 2011


On Jan 24, 2011, at 2:54 PM, Timur Tabi wrote:

> On Mon, Nov 8, 2010 at 4:04 PM, Sebastien Carlier
> <sebastien.carlier at gmail.com> wrote:
>> NOTE: This does not include the actual patch as it is too large for the mailing list (418 kB).
>> 
>> Before this commit, weak symbols were not overridden by non-weak symbols found in archive libraries
>> when linking with recent versions of binutils.  As stated in the System V ABI, "the link editor does
>> not extract archive members to resolve undefined weak symbols".
>> 
>> This commit changes all Makefiles to use partial linking (ld -r) instead of creating library archives,
>> which forces all symbols to participate in linking, allowing non-weak symbols to override weak symbols
>> as intended.  This approach is also used by Linux, from which the gmake function cmd_link_o_target
>> (added at the end of config.mk and used in all Makefiles) is inspired.
>> 
>> The name of each former library archive is preserved except for extensions which change from ".a" to
>> ".o".  This commit updates references accordingly where needed, in particular in some linker scripts.
>> 
>> This commit reveals board configurations that exclude some module but not all of its dependencies; for
>> example, disabling CMD_NET but not CMD_NFS results in undefined symbols at link time.
>> 
>> Signed-off-by: Sebastien Carlier <sebastien.carlier at gmail.com>
> 
> git-bisect tells me that your patch (or whatever version of it was
> actually applied) causes this linker warning:
> 
> powerpc-linux-gnu-ld: Warning: lib_powerpc/fpu/libpostpowerpcfpu.o
> uses hard float, libpost.o uses soft float
> 
> See this thread for details:
> http://lists.denx.de/pipermail/u-boot/2011-January/085811.html
> 
> I have no idea how to fix this.

The issue is that the code under post/lib_powerpc/fpu/* is compiled with:

CFLAGS := $(shell echo $(CFLAGS) | sed s/-msoft-float//)
CFLAGS += -mhard-float -fkeep-inline-functions

We need to see if we can avoid building the whole post/lib_powerpc/fpu/* dir if CONFIG_POST_FPU isn't set in CONFIG_POST.

- k


More information about the U-Boot mailing list