[U-Boot] [PATCH v2] makefiles: fixes for building build tools

Scott Wood scottwood at freescale.com
Thu Dec 3 20:09:45 CET 2009


Stefan Roese wrote:
> On Thursday 03 December 2009 18:49:26 Scott Wood wrote:
>> Git bisect says:
>> 4649913ea5f440d756d150a6fdf2fb2e8ecb75fd is the first bad commit
>> commit 4649913ea5f440d756d150a6fdf2fb2e8ecb75fd
>> Author: Stefan Roese <sr at denx.de>
>> Date:   Tue Oct 27 16:11:26 2009 +0100
>>
>>      ppc4xx: Add common ppc4xx linker script
>>
>>      This linker script can be used by all PPC4xx platforms. It works for
>>      PPC405 and PPC440 platforms. Boards which need a board specific linker
>>      script can override this default linker script in board/*/config.mk.
>>
>>      Signed-off-by: Stefan Roese <sr at denx.de>
> 
> Hmmm. I don't see this here. Do you only see this for katmai, or for other
> 4xx targets as well? kilauea, sequoia?

Looks like all of them.

> make[1]: Entering directory `/home/stefan/git/u-boot/u-boot/tools'                
> powerpc-linux-gcc  -g  -Os   -mrelocatable -fPIC -ffixed-r14 -meabi -D__KERNEL__ -
> DTEXT_BASE=0xFFFA0000 -I/home/stefan/git/u-boot/u-boot/include -fno-builtin -
> ffreestanding -nostdinc -isystem /opt/eldk-4.2/usr/bin/../lib/gcc/powerpc-
> linux/4.2.2/include -pipe  -DCONFIG_PPC -D__powerpc__ -DCONFIG_4xx -ffixed-r2 -mstring -
> msoft-float -Wa,-m405 -mcpu=405 -Wall -Wstrict-prototypes -fno-stack-protector   -o 
> crc32.o crc32.c -c
> powerpc-linux-gcc  -g  -Os   -mrelocatable -fPIC -ffixed-r14 -meabi -D__KERNEL__ -
> DTEXT_BASE=0xFFFA0000 -I/home/stefan/git/u-boot/u-boot/include -fno-builtin -
> ffreestanding -nostdinc -isystem /opt/eldk-4.2/usr/bin/../lib/gcc/powerpc-
> linux/4.2.2/include -pipe  -DCONFIG_PPC -D__powerpc__ -DCONFIG_4xx -ffixed-r2 -mstring -
> msoft-float -Wa,-m405 -mcpu=405 -Wall -Wstrict-prototypes -fno-stack-protector   -o 
> env_embedded.o env_embedded.c -c
> gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -idirafter /home/stefan/git/u-
> boot/u-boot/include -idirafter /home/stefan/git/u-boot/u-boot/include2 -idirafter 
> /home/stefan/git/u-boot/u-boot/include -I /home/stefan/git/u-boot/u-boot/libfdt -I 
> /home/stefan/git/u-boot/u-boot/tools -DTEXT_BASE=0xFFFA0000 -DUSE_HOSTCC -
> D__KERNEL_STRICT_NAMES -pedantic   -o envcrc.o envcrc.c -c
> powerpc-linux-gcc  -g  -Os   -mrelocatable -fPIC -ffixed-r14 -meabi -D__KERNEL__ -
> DTEXT_BASE=0xFFFA0000 -I/home/stefan/git/u-boot/u-boot/include -fno-builtin -
> ffreestanding -nostdinc -isystem /opt/eldk-4.2/usr/bin/../lib/gcc/powerpc-
> linux/4.2.2/include -pipe  -DCONFIG_PPC -D__powerpc__ -DCONFIG_4xx -ffixed-r2 -mstring -
> msoft-float -Wa,-m405 -mcpu=405 -Wall -Wstrict-prototypes -fno-stack-protector   -o 
> sha1.o sha1.c -c
> gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -idirafter /home/stefan/git/u-
> boot/u-boot/include -idirafter /home/stefan/git/u-boot/u-boot/include2 -idirafter 
> /home/stefan/git/u-boot/u-boot/include -I /home/stefan/git/u-boot/u-boot/libfdt -I 
> /home/stefan/git/u-boot/u-boot/tools -DTEXT_BASE=0xFFFA0000 -DUSE_HOSTCC -
> D__KERNEL_STRICT_NAMES -pedantic  -o envcrc crc32.o env_embedded.o envcrc.o sha1.o
> /usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)
> /usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)
> /usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)
> /usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)
> /usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)
> /usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)
> /usr/bin/ld: crc32.o: Relocations in generic ELF (EM: 20)
> crc32.o: could not read symbols: File in wrong format
> collect2: ld returned 1 exit status
> make[1]: *** [envcrc] Error 1
> make[1]: Leaving directory `/home/stefan/git/u-boot/u-boot/tools'
> make: *** [tools] Error 2
> [stefan at stefan-desktop u-boot (next)]$ file tools/crc32.o
> tools/crc32.o: ELF 32-bit MSB relocatable, PowerPC or cisco 4500, version 1 (SYSV), not 
> stripped
> 
> So the complete tools directory is compiled for powerpc!

Actually, it looks like it's just the files whose sources live somewhere else 
(look at envcrc.c, for example).  Those files should be hitting these rules 
inside tools/Makefile:

# Some of the tool objects need to be accessed from outside the tools directory
$(obj)%.o: $(SRCTREE)/common/%.c
         $(HOSTCC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $<

$(obj)%.o: $(SRCTREE)/lib_generic/%.c
         $(HOSTCC) -g $(HOSTCFLAGS) -c -o $@ $<

Do you by any chance have a copy of/link to crc32.c, env_embedded.c, etc. 
sitting in your tools directory, allowing it to match the normal pattern rule?

-Scott


More information about the U-Boot mailing list