help in linking standard libraries please

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Guys,

I am having problem in linking my source code. I am using arm-linux-gcc 3.4 tool chain to compile my source code. This tool chain came with the dev kit. 

I want to use standard libraries in my source code by at the time of linking i get segfault error. 

This project had got 2 make files. The top level which defines 
--------------------------------------------------------------------------
 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 -nostdlib
 
 export LDFLAGS = -nostdlib -T SDcard_bootloader_fat16.lnk -Map
 SDcard_bootloader_fat16.map 
 
 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
 -------------------------------------------------------------------------
 
 There is a second make file in the c source directory 
 -------------------------------------------------------------------------
CC=arm-linux-gcc
CFLAGS = $(TOP_CFLAGS)
ASFLAGS = $(TOP_CFLAGS)
#LDFLAGS = 
 
OBJ_y = head.o main.o print.o spi.o sd_raw.o
SRCS = head.S main.c print.c spi.c sd_raw.c
mainrom.o: dep $(OBJ_y)
     echo $$PWD
     $(CC) $(CFLAGS) -r -o mainrom.o $(OBJ_y)
 clean:
     rm -f *.o
 
 dep:    depend
 
 depend:
     $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend
 
 #
 # include dependency files if they exist
 #
 ifneq ($(wildcard .depend),)
 include .depend
 endif
-------------------------------------------------------------------------

This file has got a option -r "$(CC) $(CFLAGS) -o mainrom.o
 $(OBJ_y)"
 
 This option is causing the problem. If i take out this
 option i dont get a segfault linking error. I am not a
 advance c user.
 
 If i take -r option along with -nostdlib options. I can compile and link the source code but itis not executing. I searched for this
 option on google and its something to do partial linking.
 Couldn't get more info on this option. 
 
Can some one please tell what this option does. How to use stdlib with this option.
Any pointers would help a lot .
 
 Thanks
 Tama






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux