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

Sebastien Carlier sebastien.carlier at gmail.com
Mon Nov 15 12:35:01 CET 2010


Dear Wolfgang,

On 2010-11-15 11:54:07, Wolfgang Denk wrote:
> 
> I notice that the patch affects the size of the resulting U-Boot
> images.
> 
> For example:
> 
> Configuring for MiniFAP - Board: TQM5200, Options: MINIFAP
>    text    data     bss     dec     hex filename
>  358144   35208  303248  696600   aa118 ./u-boot	before
>  361340   35824  303332  700496   ab050 ./u-boot	after
> -------------------------------
> 		Delta:   +3896 Bytes
> 
> For other boards it's only a few hundred bytes, but why do we see
> such big increase here?

With archive library linking, definitions that were not used were not
included in the final binary.  This changes with partial linking (like
it would if we passed the --whole-archive flag to ld).

For this board (TQM5200), I am not sure exactly what happens yet, but
this looks suspect to me:

# ls -l ./post/lib_powerpc/fpu/mul-subnormal-single-1.[co] 
-rw-r--r-- 1 sebc sebc  2309 Nov  1 21:33 ./post/lib_powerpc/fpu/mul-subnormal-single-1.c
-rw-r--r-- 1 sebc sebc 30288 Nov 15 12:09 ./post/lib_powerpc/fpu/mul-subnormal-single-1.o

I would expect the object file to be much smaller based on source code
size.

> MPC8xx boards break with long lists of multiple definitions of
> symbols, like that:
> 
> Configuring for FPS860L board...
> lib/libgeneric.o: In function `vsprintf':
> /home/wd/git/u-boot/work/lib/vsprintf.c:480: multiple definition of `vsprintf'
> lib/vsprintf.o:/home/wd/git/u-boot/work/lib/vsprintf.c:480: first defined here
> lib/libgeneric.o: In function `ustrtoul':
> /home/wd/git/u-boot/work/lib/vsprintf.c:74: multiple definition of `ustrtoul'
> lib/vsprintf.o:/home/wd/git/u-boot/work/lib/vsprintf.c:74: first defined here
> lib/libgeneric.o: In function `simple_strtol':
> /home/wd/git/u-boot/work/lib/vsprintf.c:67: multiple definition of `simple_strtol'
> lib/vsprintf.o:/home/wd/git/u-boot/work/lib/vsprintf.c:67: first defined here
> lib/libgeneric.o: In function `inflate':
> /home/wd/git/u-boot/work/lib/zlib.c:1385: multiple definition of `inflate'
> lib/zlib.o:/home/wd/git/u-boot/work/lib/zlib.c:1385: first defined here
> lib/libgeneric.o: In function `inflate_fast':
> /home/wd/git/u-boot/work/lib/zlib.c:448: multiple definition of `inflate_fast'
> lib/zlib.o:/home/wd/git/u-boot/work/lib/zlib.c:448: first defined here
> ...
> 
> Have you seen that, too?

No, I had not seen that.  It seems that some bits of U-Boot get included
twice in this case... I will investigate this after looking a bit more
at the code size increase for the TQM5200 board.

-- 
Sebastien


More information about the U-Boot mailing list