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

Wolfgang Denk wd at denx.de
Thu Nov 18 22:44:48 CET 2010


Dear Sebastien Carlier,

In message <20101117133056.GB23875 at safe.home.local> you wrote:
> 
> > 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'
> > ...
> > 
> > Have you seen that, too?
> 
> Unfortunately I have not been able to reproduce these errors with the
> toolchain I am using (gcc 4.4.5 and binutils 2.20.1.20100303, based on
> emdebian squeeze packages).  Can you please point me to the toolchain
> you are using?

Are you sure this doesn't happen with your tool chain?

I found out why this happens, and I think the effect should be
independent of the used tool chain:

For example, in "board/tqc/tqm8xx/u-boot.lds" we arrange to have the
environment located in one of the "small" NOR flash sectors:

...
 53   .text      :
 54   {
 55     /* WARNING - the following is hand-optimized to fit within  */
 56     /* the sector layout of our flash chips!    XXX FIXME XXX   */
 57
 58     arch/powerpc/cpu/mpc8xx/start.o             (.text)
 59     arch/powerpc/cpu/mpc8xx/traps.o             (.text)
 60     common/dlmalloc.o           (.text)
 61     arch/powerpc/lib/ppcstring.o                (.text)
 62     lib/vsprintf.o      (.text)
 63     lib/crc32.o         (.text)
 64     lib/zlib.o          (.text)
 65     arch/powerpc/lib/cache.o            (.text)
 66
 67     . = DEFINED(env_offset) ? env_offset : .;
 68     common/env_embedded.o       (.ppcenv)
 69
 70     *(.text)
 71     *(.got1)
...

That means, the linker script pulls in certain object files directly.
Before, when linking with libraries, this was no problem, as the
linker would pull only (so far) unresolved symbols from the libraries
specified on the command line.  Now, we include these individual
object files through the linker script, and then again when specifying
the "library" objects on the command line - which necessarily results
in "multiple definition" errors.

Unfortunately I don't know how to solve this yet.  Does anybody know of
a way how to manually arrange the objects (or symbols) in the linked
image?


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
My challenge to the goto-less programmer  is  to  recode  tcp_input()
without any gotos ... without any loss of efficiency (there has to be
a catch).                                             - W. R. Stevens


More information about the U-Boot mailing list