link error while u-boot-spl build : undefined ref to `printf` or `strcmp` etc.

Chan Kim ckim at etri.re.kr
Sun Nov 21 12:45:13 CET 2021


Hello,

When I build u-boot, I get this error at the end. (during u-boot-spl build).

I've been fixing some link errors by adding config values but I can't figure
out what is wrong with this.

Below is the final command for u-boot-spl build and the error messages.

Can any expert tell me what can be wrong here?

 

( cd spl && aarch64-none-elf-gcc -nostdlib -nostartfiles
-fuse-linker-plugin -flto=28 -Wall -Wstrict-prototypes -Wno-format-security
-fno-builtin -ffreestanding -std=gnu11 -fshort-wchar -fno-strict-aliasing
-fno-PIE -Os  -flto=28 -fno-stack-protector -fno-delete-null-pointer-checks
-Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds
-Wno-array-bounds -Wno-stringop-overflow -Wno-maybe-uninitialized
-fmacro-prefix-map=./= -g -fstack-usage -Wno-format-nonliteral
-Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=date-time
-Wno-packed-not-aligned  -ffunction-sections -fdata-sections
-fno-stack-protector -D__KERNEL__ -D__UBOOT__  -DCONFIG_SPL_BUILD  -D__ARM__
-mstrict-align  -fno-common -ffixed-r9  -mgeneral-regs-only    -fno-common
-ffixed-x18 -pipe -march=armv8-a+crc -D__LINUX_ARM_ARCH__=8   -Ispl/include
-Iinclude   -I./arch/arm/include -include ./include/linux/kconfig.h
-nostdinc -isystem
/opt/arm-toolchains/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/../lib/
gcc/aarch64-none-elf/10.2.1/include  -Wl,-T -Wl,u-boot-spl.lds
-Wl,--gc-sections -Wl,-Bstatic -Wl,--gc-sections -Wl,--no-dynamic-linker
-Wl,--build-id=none -Wl,-Ttext -Wl,0x4000000 arch/arm/cpu/armv8/start.o
-Wl,--whole-archive arch/arm/cpu/armv8/built-in.o arch/arm/cpu/built-in.o
arch/arm/lib/built-in.o board/etri/ab21m/built-in.o common/spl/built-in.o
common/init/built-in.o common/built-in.o cmd/built-in.o env/built-in.o
disk/built-in.o drivers/built-in.o dts/built-in.o fs/built-in.o
keep-syms-lto.o -L
/opt/arm-toolchains/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/../lib/
gcc/aarch64-none-elf/10.2.1 -lgcc -Wl,--no-whole-archive
-Wl,-Map,u-boot-spl.map -o u-boot-spl )

/opt/arm-toolchains/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/../lib/
gcc/aarch64-none-elf/10.2.1/../../../../aarch64-none-elf/bin/ld:
/tmp/u-boot-spl.GeKfJh.ltrans0.ltrans.o: in function `alloc_simple':

/home/ckim/U-BOOT/u-boot/spl/../common/malloc_simple.c:29: undefined
reference to `printf'

/opt/arm-toolchains/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/../lib/
gcc/aarch64-none-elf/10.2.1/../../../../aarch64-none-elf/bin/ld:
/tmp/u-boot-spl.GeKfJh.ltrans0.ltrans.o: in function `device_bind_by_name':

/home/ckim/U-BOOT/u-boot/spl/../drivers/core/lists.c:31: undefined reference
to `strcmp'

/opt/arm-toolchains/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/../lib/
gcc/aarch64-none-elf/10.2.1/../../../../aarch64-none-elf/bin/ld:
/tmp/u-boot-spl.GeKfJh.ltrans0.ltrans.o: in function `board_init_r': 

/home/ckim/U-BOOT/u-boot/spl/../common/spl/spl.c:697: undefined reference to
`timer_init'

/opt/arm-toolchains/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/../lib/
gcc/aarch64-none-elf/10.2.1/../../../../aarch64-none-elf/bin/ld:
/home/ckim/U-BOOT/u-boot/spl/../common/spl/spl.c:690: undefined reference to
`hang'

/opt/arm-toolchains/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/../lib/
gcc/aarch64-none-elf/10.2.1/../../../../aarch64-none-elf/bin/ld:
/home/ckim/U-BOOT/u-boot/spl/../common/spl/spl.c:633: undefined reference to
`printf'

collect2: error: ld returned 1 exit status

make[1]: *** [scripts/Makefile.spl:509: spl/u-boot-spl] Error 1

make: *** [Makefile:1984: spl/u-boot-spl] Error 2

 

Thank you.

Chan Kim



More information about the U-Boot mailing list