help in linking std libraries pls
Tamamontu M <[email protected]> Thu, 18 Nov 2010 18:46:48 -0800 (PST)
| Newsgroups | gmane.linux.ports.arm.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Guys, I am having problems while linking to std libraries using arm-linux-ld. I am trying to compile and link my source code which is using stdio,stdflib,string libraries. But I get errors at the linking stage. To link to the std libraries I use -lc (ldflag). Which is causing the error. My make file is like this ------------------------------------------------------------------------- TOPDIR := $(shell /bin/pwd) export TOPDIR export CC=arm-linux-gcc export LD=arm-linux-ld OBJCOPY=arm-linux-objcopy OBJDUMP=arm-linux-objdump export TOP_CFLAGS= -O2 -Wall -fPIC -mcpu=arm9tdmi -I../include export LDFLAGS = -L/usr/local/arm/3.4/lib -T SDcard_bootloader_fat16.lnk -Map SDcard_bootloader_fat16.map -lc #export LDFLAGS = -T SDcard_bootloader_fat16.lnk -Map SDcard_bootloader_fat16.map -L/usr/local/arm/4.1.1-920t/lib -lc ASFLAGS = SDcard_bootloader: make -C main $(LD) $(LDFLAGS) -o SDcard_bootloader_fat16.elf main/mainrom.o $(OBJCOPY) -j rom -O binary SDcard_bootloader_fat16.elf SDcard_bootloader_fat16.bin $(OBJDUMP) -D SDcard_bootloader_fat16.elf > SDcard_bootloader_fat16.diss clean: make clean -C main rm -f $(OBJS) SDcard_bootloader_fat16.bin SDcard_bootloader_fat16.elf SDcard_bootloader_fat16.diss SDcard_bootloader_fat16.map ------------------------------------------------------------------------- I get this error arm-linux-ld: BFD 2.16.1 assertion fail. I tried 2 different tool chains. 1) arm-linux-gcc 3.4.3 , arm-linux-ld 2.16 2) arm-linux-gcc 4.1.1 , arm-linux-ld 2.17 I am getting slightly less errors with the newer tool chain. ------------------------------------------------------------------------- make make -C main make[1]: Entering directory `/home/pritam/spi_boot_example/SDcard_bootloader_fat16/main' arm-linux-gcc -MM -O2 -Wall -fPIC -mcpu=arm9tdmi -I../include head.S main.c print.c spi.c sd_raw.c 1>.depend echo $PWD /home/pritam/spi_boot_example/SDcard_bootloader_fat16/main arm-linux-ld -L/usr/local/arm/3.4/lib -T SDcard_bootloader_fat16.lnk -Map SDcard_bootloader_fat16.map -lc -r -o mainrom.o head.o main.o print.o spi.o sd_raw.o make[1]: Leaving directory `/home/pritam/spi_boot_example/SDcard_bootloader_fat16/main' arm-linux-ld -L/usr/local/arm/3.4/lib -T SDcard_bootloader_fat16.lnk -Map SDcard_bootloader_fat16.map -lc -o SDcard_bootloader_fat16.elf main/mainrom.o main/mainrom.o: In function `start_C': sd_raw.c:(rom+0x230): relocation truncated to fit: R_ARM_PLT32 against symbol `puts' defined in .plt section in /usr/local/arm/3.4/lib/libc.so arm-linux-ld: BFD 2.16.1 assertion fail /opt/buildroot/toolchain_build_arm_nofpu/binutils-2.16.1/bfd/elf32-arm.c:5013 /usr/local/arm/3.4/lib/libc.so: undefined reference to `main' arm-linux-ld: BFD 2.16.1 assertion fail /opt/buildroot/toolchain_build_arm_nofpu/binutils-2.16.1/bfd/elf32-arm.c:5203 make: *** [SDcard_bootloader] Segmentation fault ------------------------------------------------------------------------ Can some one please share some info on how to use and std libraries please. Thanks Tama