This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
On Tue, 13 Oct 1998, Dony wrote: > Yeah, I suspect also the same, since even main function reference > wasn't found. > > x---------- > main.o(.text+0x18):main.c undefined reference to '__main' > x---------- __main (which executes C++ static constructors) resides in libgcc.a. It's not needed in a C-only program, but including it allows a mixture of C and C++ modules to be used with a C main program (although that's not, in fact, required by the ISO standard). In general, libgcc.a is needed for certain (target-dependent) builtins for which gcc does not emit open-code. > > I don't know what I have done wrong. > I have already included the directory of std. header file > during compiling, and also the library during linking. > My makefile like this : > > X---------- > > CC = m68k-coff-gcc > LD = m68k-coff-ld > # Here located all the standard header files > INC = c:/gcc-m68k/m68k-coff/include > # Here located all the 'lib*.a' > LIB = c:/gcc-m68k/m68k-coff/lib/m68000 > > CFLAGS = -m68000 -ansi -Wall -O2 -I$(INC) > LDFLAGS = -s -n -Tmsdsl.ld -L$(LIB) I don't know is this has changed in recent releases, but libgcc.a depends on the specific version of the compiler, and is not found along with the usual runtime library stuff. I had to add an explicit path to it in my makefile when I started using linker directive files (like your msdsl.ld); for some reason that seems to turn off all of the standard library paths that are available by defaut, including the one to libgcc.a. My LDFLAGS is LDFLAGS = -t -L /usr/local/lib/gcc-lib/mips64orion-idt-elf/2.7.2 and I explicitly include libgcc.a in the list of modules in my .ld file. Details will differ for you. > > PROG = crt0.o control.o extern.o gti_avm.o gti_be.o gti_cof.o gti_ipu.o > \ > gti_sas.o gti_tr.o gtidebug.o gtifram.o gtihip.o gtiinit.o \ > gtiparam.o gtiram.o gtixcvr.o hdlc.o hic.o main.o malloc.o \ > scc.o uart.o vers.o > > driver: msdsl.ld $(PROG) > $(LD) $(LDFLAGS) -Map=driver.map -o driver.x $(PROG) > > crt0.o: crt0.S asm.h mc68302.h > $(CC) $(CFLAGS) $< -c -o $@ > > ............... > ............... > ............... > > X---------- > > > -- > Dony > Email : dony@willowglen.com.sg Mike -- C. M. Heard/VVNET, Inc. heard@vvnet.com ________________________________________________ To get help for the crossgcc list, send mail to crossgcc-request@cygnus.com with the text 'help' (without the quotes) in the body of the message.