This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
# Rule for making # all: $(OBJS) $(LD) -$(ENDIAN) -T elf32ebmip.xn -Ttext $(LOADADDR) -G 0 $(OBJS) -o $(NAME).elf -L ../lib/el -lc
The linker script (a generic one taken from the binutils?) 'elf32ebmip.xn' really doesn't know which is your real target, only that the format is of 'elf' type...
F:\usr\local\mips-elf\lib>ls *.ld cfe.ld ddb-kseg0.ld ddb.ld idt.ld idtecoff.ld lsi.ld nullmon.ld pmon.ld
and you should have and use something similar with your own real target. These are linker scripts for the newlib- (the libgloss part) supported MIPS-based boards.
When I use -lc it crashes with undefined refenrences to _lseek,_close,_read,_sbrk etc..
Besides the 'libc.a', the newlib build produces 'glue libraries' for the target boards it supports :
F:\usr\local\mips-elf\lib>ls *.a libc.a libg.a liblsi.a libnosys.a libpmon.a libcfe.a libidt.a libm.a libnullmon.a
So if you look inside one of these, for instance the 'libpmon.a' (for the PMON-monitor firmware -using boards) and if 'lseek' etc. are in it, but first what the 'libc.a' says about this :
F:\usr\local\mips-elf\lib>..\bin\nm libc.a | grep lseek File STDIN: U lseek U lseek lseekr.o: 0000000000000000 T _lseek_r U lseek U _lseek_r
F:\usr\local\mips-elf\lib>..\bin\nm libpmon.a | grep lseek File STDIN: lseek.o: 0000000000000000 T lseek
You would see the 'lseek' being undefined in 'libc.a' but defined in 'libpmon.a'. And also in the other 'glue libraries' :
F:\usr\local\mips-elf\lib>..\bin\nm libidt.a | grep lseek File STDIN: lseek.o: 0000000000000000 T lseek
No 'underscored' symbol names here but maybe you have them for some reason. With the COFF format the names usually had that leading underscore but ELF doesn't use that usually. Maybe the '_lseek' is some intermediate function which then calls the final 'lseek'...
/* The following TEXT start address leaves space for the monitor workspace. i.e. the NEC VR4300 (IDT) first free address is actually 0xa001af20. */
ENTRY(_start) STARTUP(crt0.o) OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-littlemips") GROUP(-lc -lidt -lgcc) SEARCH_DIR(.) __DYNAMIC = 0;
This shows that three libraries 'libc.a', 'libidt.a' and 'libgcc.a' will be linked against and also a startup object, 'crt0.o', will be taken with. The entry symbol name is '_start' and so on... You should have something like this ('idt.ld') made for your own target board. But maybe that is one of the already supported boards and you could use the linker script for that.
I cannot figure out why ? Even when I use this make file iwth MIPS SDE> version from the MIPS website, it crashes with the same errors....
The added SDE support files should add quite many other MIPS boards to the 'already supported' list... New linker scripts, glue libraries etc.
Sent from the Sourceware - crossgcc list forum at Nabble.com: http://www.nabble.com/undefined-reference-errror-using-gcc-3.3.2-t691583.html#a1826012
------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |