[U-Boot-Users] link error on first compile

Yang Yang Yang.Yang at cyclades.com
Fri Feb 4 03:59:02 CET 2005




Hi Tim,

I also met this problem. When I use MV31 for MPC85xx cross-compiler to
compile for board MPC8560ADS, I was stuck at exactly the same place : can't
link examples/hello_world.o, however if I use ELDK's compiler everything is
fine. So I digged into them a little bit deeper. The problem happens at
examples/stubs.c, when compile it to generate stubs.o, no symbols like
dummy, or printf is in stubs.o, which is needed when link hello_world.o
later. If we look at stubs.c,
===========
static void __attribute__((unused)) dummy(void)
{
#include <_exports.h>
}
===========
this declaration makes dummy and all stubs functions not be included in
stubs.o if using yours and MV31 compiler, it's the cross-compiler's
optimization make this happen. Check the file u-boot/config.mk, and find
OPTFLAGS = -Os, which ask compiler to optimize for the purpose of reducing
code size. Some compilers, like yours arm-sony-linux-gcc (GCC) 3.4.3 and
mine ppc_85xx-gcc (GCC) 3.4.1 (MontaVista 3.4.1-2.0.14.0401563 2004-11-12),
optimize the stubs.c code by eliminating "unused" function "dummy" and of
course all stubs functions defined in dummy() out of the stubs.o. If I
change -Os to -O1, and compile again, then compiling was successful, in
this case I can't guarantee the obj files are working or not :). So you
should check your compiler documents on how to include those "unused"
functions while in -Os optimization level. Just my 2 cents, hope it works.

-----
Yang Yang
Software Engineer, R&D
Cyclades Corporation
Phone: +1-510-771-6100 x253
Fax: +1-510-771-6200
E-mail: yang.yang at cyclades.com



                                                                           
             Tim Bird                                                      
             <tim.bird at am.sony                                             
             .com>                                                      To 
             Sent by:                  u-boot-users at lists.sourceforge.net  
             u-boot-users-admi                                          cc 
             n at lists.sourcefor                                             
             ge.net                                                Subject 
                                       [U-Boot-Users] link error on first  
                                       compile                             
             02/03/2005 05:17                                              
             PM                                                            
                                                                           
                                                                           
                                                                           
                                                                           




Hi all,

On a fresh untar; make xxx_config; make all, I get an error linking
the example program hello_world with start.o.

This can be worked around by removing 'examples' from the list of
SUBDIRS in the top-level Makefile.

After building, I added 'examples' back in.  Strangely, for one set
of builds, this solved my problem (and hello_world linked OK, even
after a 'make distclean'), but for another set of builds, hello_world
wouldn't link even when cpu/arm925t/start.o was present.

I haven't been able to figure out the problem, but I thought I'd
report it.  This is with a home-built gcc:
arm-sony-linux-gcc (GCC) 3.4.3

 -- Tim

----------------
[tbird at timdesk u-boot-1.1.2]$ make all
make[1]: Entering directory `/home/tbird/work/innovator/u-boot-1.1.2/tools'
make[1]: `.depend' is up to date.
make[1]: Leaving directory `/home/tbird/work/innovator/u-boot-1.1.2/tools'
make[1]: Entering directory `/home/tbird/work/innovator/u-boot-1.1.2
/examples'
make[1]: `.depend' is up to date.
make[1]: Leaving directory `/home/tbird/work/innovator/u-boot-1.1.2
/examples'
make[1]: Entering directory `/home/tbird/work/innovator/u-boot-1.1.2/post'
make[1]: `.depend' is up to date.
make[1]: Leaving directory `/home/tbird/work/innovator/u-boot-1.1.2/post'
make[1]: Entering directory `/home/tbird/work/innovator/u-boot-1.1.2
/post/cpu'
make[1]: `.depend' is up to date.
make[1]: Leaving directory `/home/tbird/work/innovator/u-boot-1.1.2
/post/cpu'
make -C tools all
make[1]: Entering directory `/home/tbird/work/innovator/u-boot-1.1.2/tools'
gcc -Wall -pedantic -idirafter ../include -DTEXT_BASE=0x11080000
-DUSE_HOSTCC -O -c -o img2srec.o img2srec.c
gcc -Wall -pedantic -idirafter ../include -DTEXT_BASE=0x11080000
-DUSE_HOSTCC -O  -o img2srec img2srec.o
strip img2srec
gcc -g -Wall -pedantic -idirafter ../include -DTEXT_BASE=0x11080000
-DUSE_HOSTCC -O -c mkimage.c
gcc -g -Wall -pedantic -idirafter ../include -DTEXT_BASE=0x11080000
-DUSE_HOSTCC -O -c crc32.c
gcc -Wall -pedantic -idirafter ../include -DTEXT_BASE=0x11080000
-DUSE_HOSTCC -O  -o mkimage mkimage.o crc32.o
strip mkimage
gcc -g -Wall -pedantic -idirafter ../include -DTEXT_BASE=0x11080000
-DUSE_HOSTCC -O -c envcrc.c
gcc -g  -idirafter ../include -DTEXT_BASE=0x11080000 -DUSE_HOSTCC -c
environment.c
gcc -Wall -pedantic -idirafter ../include -DTEXT_BASE=0x11080000
-DUSE_HOSTCC -O -o envcrc envcrc.o crc32.o environment.o
gcc -g -Wall -pedantic -idirafter ../include -DTEXT_BASE=0x11080000
-DUSE_HOSTCC -O -c gen_eth_addr.c
gcc -Wall -pedantic -idirafter ../include -DTEXT_BASE=0x11080000
-DUSE_HOSTCC -O  -o gen_eth_addr gen_eth_addr.o
strip gen_eth_addr
gcc -Wall -pedantic -idirafter ../include -DTEXT_BASE=0x11080000
-DUSE_HOSTCC -O -c -o bmp_logo.o bmp_logo.c
gcc -Wall -pedantic -idirafter ../include -DTEXT_BASE=0x11080000
-DUSE_HOSTCC -O  -o bmp_logo bmp_logo.o
strip bmp_logo
./bmp_logo logos/denx.bmp >/home/tbird/work/innovator/u-boot-1.1.2
/include/bmp_logo.h
make[1]: Leaving directory `/home/tbird/work/innovator/u-boot-1.1.2/tools'
make -C examples all
make[1]: Entering directory `/home/tbird/work/innovator/u-boot-1.1.2
/examples'
arm-sony-linux-gcc -g  -Os   -fno-strict-aliasing  -fno-common -ffixed-r8
-malignment-traps -msoft-float -D__KERNEL__ -DTEXT_BASE=0x11080000
-I/home/tbird/work/innovator/u-boot-1.1.2/include
-fno-builtin -ffreestanding -nostdinc -isystem
/home/local/arm-sony-linux/devel/bin/../lib/gcc/arm-sony-linux/3.4.3
/include -pipe  -DCONFIG_ARM -D__ARM__ -mapcs-32 -march=armv4 -Wall
-Wstrict-prototypes -c -o stubs.o stubs.c
arm-sony-linux-ar crv libstubs.a  stubs.o
a - stubs.o
arm-sony-linux-gcc -g  -Os   -fno-strict-aliasing  -fno-common -ffixed-r8
-malignment-traps -msoft-float -D__KERNEL__ -DTEXT_BASE=0x11080000
-I/home/tbird/work/innovator/u-boot-1.1.2/include
-fno-builtin -ffreestanding -nostdinc -isystem
/home/local/arm-sony-linux/devel/bin/../lib/gcc/arm-sony-linux/3.4.3
/include -pipe  -DCONFIG_ARM -D__ARM__ -mapcs-32 -march=armv4 -Wall
-Wstrict-prototypes -g  -Os   -fno-strict-aliasing  -fno-common -ffixed-r8
-malignment-traps -msoft-float -D__KERNEL__ -DTEXT_BASE=0x11080000
-I/home/tbird/work/innovator/u-boot-1.1.2/include
-fno-builtin -ffreestanding -nostdinc -isystem
/home/local/arm-sony-linux/devel/bin/../lib/gcc/arm-sony-linux/3.4.3
/include -pipe  -DCONFIG_ARM -D__ARM__ -mapcs-32 -march=armv4 -I.. -Bstatic
-T
/home/tbird/work/innovator/u-boot-1.1.2/board/omap1510inn/u-boot.lds -Ttext
0x11080000   hello_world.c   -o hello_world
/home/local/arm-sony-linux/devel/bin/../lib/gcc/arm-sony-linux/3.4.3
/../../../../arm-sony-linux/bin/ld: cannot find cpu/arm925t/start.o
collect2: ld returned 1 exit status
make[1]: *** [hello_world] Error 1
make[1]: Leaving directory `/home/tbird/work/innovator/u-boot-1.1.2
/examples'
make: *** [examples] Error 2
-----

=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Electronics
=============================


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users






More information about the U-Boot mailing list