I have successfully cross-compiled the test hello-world app and run it on my target ARM system (MC9328MXL) with the following crosstools setup in arm9tdmi.sh:
eval `cat arm9tdmi.dat gcc-3.3.2-glibc-2.3.2.dat` sh all.sh –notest eval `cat arm9tdmi.dat gcc-3.4.1-glibc-2.3.3.dat` sh all.sh --notest
Both environments produced a successful test app whch ran on the target system.
However, when I try to compile the patched 2.4.26 kernel with a patched serial routine to access the specific serial console port on the MC9328MXL it fails at the end of the compile, when linking the various objects to the kernel image with an undefined reference:
/opt/crosstool/gcc-3.3.2-glibc-2.3.2/arm-9tdmi-linux-gnu/bin/arm-9tdmi-linux-gnu-ld -p -X -T arch/arm/vmlinux.lds arch/arm/kernel/head-armv.o arch/arm/kernel/init_task.o init/main.o init/version.o init/do_mounts.o \ --start-group \ arch/arm/kernel/kernel.o arch/arm/mm/mm.o arch/arm/mach-mx1ads/mx1ads.o kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o \ drivers/l3/l3.o drivers/serial/serial.o drivers/char/char.o drivers/block/block.o drivers/misc/misc.o drivers/media/media.o drivers/net/net.o drivers/mtd/mtdlink.o drivers/media/media.o drivers/net/irda/irda.o \ net/network.o \ arch/arm/fastfpe/fast-math-emu.o arch/arm/lib/lib.a /home/icecool/i-droid/linux-2.4.26/lib/lib.a \ --end-group \ -o vmlinux drivers/serial/serial.o(.text.init+0x41c): In function `$a': : undefined reference to `mx1_register_gpios' drivers/serial/serial.o(.text.init+0x438): In function `$a': : undefined reference to `mx1_register_gpios' drivers/serial/serial.o(.text.init+0x49c): In function `$a': : undefined reference to `mx1_unregister_gpios' drivers/serial/serial.o(.text.init+0x4a8): In function `$a': : undefined reference to `mx1_unregister_gpios' make: *** [vmlinux] Error 1
The function mx1_register_gpios is defined and the header is present in the arm asm dir – in fact the mx1ads.c compiles successfully: … make all_targets make[3]: Entering directory `/home/icecool/i-droid/linux-2.4.26/drivers/serial' /opt/crosstool/gcc-3.3.2-glibc-2.3.2/arm-9tdmi-linux-gnu/bin/arm-9tdmi-linux-gnu-gcc -D__KERNEL__ -I/home/icecool/i-droid/linux-2.4.26/include -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -Uarm -fno-common -pipe -mapcs-32 -D__LINUX_ARM_ARCH__=4 -march=armv4 -mtune=arm9tdmi -msoft-float -Uarm -nostdinc -iwithprefix include -DKBUILD_BASENAME=core -DEXPORT_SYMTAB -c core.c core.c:57:1: warning: "pm_unregister" redefined In file included from /home/icecool/i-droid/linux-2.4.26/include/linux/modversions.h:253, from /home/icecool/i-droid/linux-2.4.26/include/linux/module.h:21, from core.c:29: /home/icecool/i-droid/linux-2.4.26/include/linux/modules/pm.ver:4:1: warning: this is the location of the previous definition /opt/crosstool/gcc-3.3.2-glibc-2.3.2/arm-9tdmi-linux-gnu/bin/arm-9tdmi-linux-gnu-gcc -D__KERNEL__ -I/home/icecool/i-droid/linux-2.4.26/include -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -Uarm -fno-common -pipe -mapcs-32 -D__LINUX_ARM_ARCH__=4 -march=armv4 -mtune=arm9tdmi -msoft-float -Uarm -nostdinc -iwithprefix include -DKBUILD_BASENAME=mx1ads -c -o mx1ads.o mx1ads.c mx1ads.c: In function `mx1ads_tx_chars': mx1ads.c:344: warning: unused variable `len' mx1ads.c: In function `mx1ads_rts_int': mx1ads.c:417: warning: unused variable `ucr2' mx1ads.c: At top level: mx1ads.c:1073: warning: initialization from incompatible pointer type mx1ads.c:1085: warning: initialization from incompatible pointer type mx1ads.c:1096: warning: initialization from incompatible pointer type mx1ads.c:1173: warning: `mx1ads_console_wait_key' defined but not used rm -f serial.o /opt/crosstool/gcc-3.3.2-glibc-2.3.2/arm-9tdmi-linux-gnu/bin/arm-9tdmi-linux-gnu-ld -r -o serial.o core.o mx1ads.o make[3]: Leaving directory `/home/icecool/i-droid/linux-2.4.26/drivers/serial' make[2]: Leaving directory `/home/icecool/i-droid/linux-2.4.26/drivers/serial'
However when the serial.o object is linked in the end to build the kernel, I get the above reported error. A ‘readelf -s mx1ads.o | grep register_gpios’ (or linked serial.o) gives the following output:
107: 00000000 0 NOTYPE GLOBAL DEFAULT UND mx1_register_gpios 110: 00000000 0 NOTYPE GLOBAL DEFAULT UND mx1_unregister_gpios
I don’t get this – why would it be unreferenced when the definition header is present in the arm-asm directory and the serial.o is linked correctly? It seems the cross-compiler linker is failing to notice something. Any ideas?
Luke
|