[U-Boot-Users] [PATCH] ColdFire: Get information from the correct GCC

Liew Tsi Chung Tsi-chung.Liew at freescale.com
Sat May 3 00:03:35 CEST 2008


Wolfgang, 

> Stop! We are not talking about "$(CC)gcc"!
>
> The change was this:
>
> -ifeq ($(findstring 4.2,$(shell $(CC) --version)),4.2)
> +ifeq ($(findstring 4.2,$(shell $(CROSS_COMPILE)gcc --version)),4.2)
>
> And ``$(CC)'' and ``$(CROSS_COMPILE)gcc'' should be really the same
here.
Sorry for the confusion, and yes both $(CC) and $(CROSS_COMPILE)gcc are
the same. It is unsolvable behavior in ifeq (...) where $(shell $(CC)
--version) does not match 4.2 and caused linking error.

Original:
ifeq ($(findstring 4.2,$(shell $(CC) --version)),4.2)
PLATFORM_CPPFLAGS += -mcpu=54455 -fPIC
else
PLATFORM_CPPFLAGS += -m5407 -fPIC
endif

As you can see below captured, -mcpu=54455 was selected in compiling
when gcc version is 4.2. When it comes to linking, the $(shell $(CC)
--version) becomes other value and select the -m5407 option with
different libgcc.

/snip
...
/opt/freescale/usr/local/gcc-4.2.47-uclibc-0.9.47/m68k-uclinux/bin/m68k-
uclinux-gcc -g  -Os   -ffixed-d7 -msep-data -D__KERNEL__
-DTEXT_BASE=0x04000000 -I/proj/u-boot/uboot133/u-boot-test/include
-fno-builtin -ffreestanding -nostdinc -isystem
/opt/freescale/usr/local/gcc-4.2.47-uclibc-0.9.47/m68k-uclinux/lib/gcc/m
68k-uclinux/4.2.1/include -pipe  -DCONFIG_M68K -D__M68K__ -Wa,
-mcpu=54455 -fPIC -DTEXT_BASE=0x04000000 -Wall -Wstrict-prototypes -c -o
cmd_mac.o cmd_mac.c
/opt/freescale/usr/local/gcc-4.2.47-uclibc-0.9.47/m68k-uclinux/bin/m68k-
uclinux-ar crv libcommon.a main.o ACEX1K.o altera.o bedbug.o circbuf.o
cmd_autoscript.o cmd_bdinfo.o image.o gunzip.o cmd_boot.o cmd_bootm.o
cmd_cache.o cmd_console.o cmd_date.o cmd_eeprom.o cmd_elf.o cmd_ext2.o
cmd_fat.o cmd_fdc.o cmd_flash.o cmd_i2c.o cmd_ide.o cmd_itest.o
cmd_jffs2.o cmd_load.o cmd_mem.o cmd_mii.o cmd_misc.o cmd_nand.o
cmd_net.o cmd_nvedit.o cmd_onenand.o cmd_pcmcia.o cmd_reginfo.o
cmd_ximg.o cmd_vfd.o command.o console.o cyclon2.o stratixII.o devices.o
dlmalloc.o docecc.o environment.o env_common.o env_nand.o
env_dataflash.o env_flash.o env_eeprom.o env_onenand.o env_nvram.o
env_nowhere.o exports.o flash.o fpga.o ft_build.o hush.o kgdb.o lcd.o
lists.o lynxkdi.o memsize.o miiphybb.o miiphyutil.o s_record.o serial.o
soft_i2c.o soft_spi.o spartan2.o spartan3.o usb.o usb_kbd.o
usb_storage.o virtex2.o xilinx.o crc16.o xyzModem.o cmd_mac.o
a - main.o
a - ACEX1K.o
...
a - cmd_mac.o
make[1]: Leaving directory `/proj/u-boot/uboot133/u-boot-test/common'
make -C libfdt/
make[1]: Entering directory `/proj/u-boot/uboot133/u-boot-test/libfdt'
/opt/freescale/usr/local/gcc-4.2.47-uclibc-0.9.47/m68k-uclinux/bin/m68k-
uclinux-ar crv libfdt.a 
make[1]: Leaving directory `/proj/u-boot/uboot133/u-boot-test/libfdt'
make -C api/
make[1]: Entering directory `/proj/u-boot/uboot133/u-boot-test/api'
/opt/freescale/usr/local/gcc-4.2.47-uclibc-0.9.47/m68k-uclinux/bin/m68k-
uclinux-ar crv libapi.a 
make[1]: Leaving directory `/proj/u-boot/uboot133/u-boot-test/api'
make -C post/
make[1]: Entering directory `/proj/u-boot/uboot133/u-boot-test/post'
(echo create libpost.a; for lib in   ; \
         do echo addlib $lib; done; echo save) \
        |
/opt/freescale/usr/local/gcc-4.2.47-uclibc-0.9.47/m68k-uclinux/bin/m68k-
uclinux-ar -M
make[1]: Leaving directory `/proj/u-boot/uboot133/u-boot-test/post'
make -C /proj/u-boot/uboot133/u-boot-test/board/freescale/m54455evb/
u-boot.lds
make[1]: Entering directory
`/proj/u-boot/uboot133/u-boot-test/board/freescale/m54455evb'
make[1]: Nothing to be done for `u-boot.lds'.
make[1]: Leaving directory
`/proj/u-boot/uboot133/u-boot-test/board/freescale/m54455evb'
UNDEF_SYM=`/opt/freescale/usr/local/gcc-4.2.47-uclibc-0.9.47/m68k-uclinu
x/bin/m68k-uclinux-objdump -x lib_generic/libgeneric.a
board/freescale/common/libfreescale.a
board/freescale/m54455evb/libm54455evb.a cpu/mcf5445x/libmcf5445x.a
lib_m68k/libm68k.a fs/cramfs/libcramfs.a fs/fat/libfat.a
fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a
fs/ext2/libext2fs.a net/libnet.a disk/libdisk.a
drivers/bios_emulator/libatibiosemu.a drivers/block/libblock.a
drivers/dma/libdma.a drivers/hwmon/libhwmon.a drivers/i2c/libi2c.a
drivers/input/libinput.a drivers/misc/libmisc.a drivers/mtd/libmtd.a
drivers/mtd/nand/libnand.a drivers/mtd/nand_legacy/libnand_legacy.a
drivers/mtd/onenand/libonenand.a drivers/net/libnet.a
drivers/net/sk98lin/libsk98lin.a drivers/pci/libpci.a
drivers/pcmcia/libpcmcia.a drivers/spi/libspi.a drivers/rtc/librtc.a
drivers/serial/libserial.a drivers/usb/libusb.a drivers/video/libvideo.a
common/libcommon.a libfdt/libfdt.a api/libapi.a post/libpost.a |sed  -n
-e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
                cd /proj/u-boot/uboot133/u-boot-test &&
/opt/freescale/usr/local/gcc-4.2.47-uclibc-0.9.47/m68k-uclinux/bin/m68k-
uclinux-ld -Bstatic -T
/proj/u-boot/uboot133/u-boot-test/board/freescale/m54455evb/u-boot.lds
-n -Ttext 0x04000000 $UNDEF_SYM cpu/mcf5445x/start.o \
                        --start-group lib_generic/libgeneric.a
board/freescale/common/libfreescale.a
board/freescale/m54455evb/libm54455evb.a cpu/mcf5445x/libmcf5445x.a
lib_m68k/libm68k.a fs/cramfs/libcramfs.a fs/fat/libfat.a
fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a
fs/ext2/libext2fs.a net/libnet.a disk/libdisk.a
drivers/bios_emulator/libatibiosemu.a drivers/block/libblock.a
drivers/dma/libdma.a drivers/hwmon/libhwmon.a drivers/i2c/libi2c.a
drivers/input/libinput.a drivers/misc/libmisc.a drivers/mtd/libmtd.a
drivers/mtd/nand/libnand.a drivers/mtd/nand_legacy/libnand_legacy.a
drivers/mtd/onenand/libonenand.a drivers/net/libnet.a
drivers/net/sk98lin/libsk98lin.a drivers/pci/libpci.a
drivers/pcmcia/libpcmcia.a drivers/spi/libspi.a drivers/rtc/librtc.a
drivers/serial/libserial.a drivers/usb/libusb.a drivers/video/libvideo.a
common/libcommon.a libfdt/libfdt.a api/libapi.a post/libpost.a
--end-group -L
/opt/freescale/usr/local/gcc-4.2.47-uclibc-0.9.47/m68k-uclinux/lib/gcc/m
68k-uclinux/4.2.1/m5407/msep-data -lgcc \
                        -Map u-boot.map -o u-boot
/opt/freescale/usr/local/gcc-4.2.47-uclibc-0.9.47/m68k-uclinux/bin/m68k-
uclinux-ld.real: m68k:isa-b:nousp:mac architecture of input file
`/opt/freescale/usr/local/gcc-4.2.47-uclibc-0.9.47/m68k-uclinux/lib/gcc/
m68k-uclinux/4.2.1/m5407/msep-data/libgcc.a(_float.o)' is incompatible
with m68k:isa-c:emac output
/opt/freescale/usr/local/gcc-4.2.47-uclibc-0.9.47/m68k-uclinux/bin/m68k-
uclinux-ld.real: m68k:isa-b:nousp:mac architecture of input file
`/opt/freescale/usr/local/gcc-4.2.47-uclibc-0.9.47/m68k-uclinux/lib/gcc/
m68k-uclinux/4.2.1/m5407/msep-data/libgcc.a(_floatex.o)' is incompatible
with m68k:isa-c:emac output
/opt/freescale/usr/local/gcc-4.2.47-uclibc-0.9.47/m68k-uclinux/bin/m68k-
uclinux-ld.real: m68k:isa-b:nousp:mac architecture of input file
`/opt/freescale/usr/local/gcc-4.2.47-uclibc-0.9.47/m68k-uclinux/lib/gcc/
m68k-uclinux/4.2.1/m5407/msep-data/libgcc.a(fpgnulib.o)' is incompatible
with m68k:isa-c:emac output
make: *** [u-boot] Error 1
/Snip

> $(CC) is the CROSS compiler, so the version of gcc on the host system
should
> not play any role. The host compiler would be $(HOSTCC)
It does not involve any $(HOSTCC)

> Why should that be different?
It solves the linking error.

Regards,
TsiChung





More information about the U-Boot mailing list