On 9/22/14 2:09, Michael Eager wrote: > On 09/21/14 03:46, Chen Gang wrote: >> Excuse me, I want to consult one thing: I installed raw microblaze cross >> compiler, binutils and glibc into one directory (/upstream/release), and >> try to build a "Hello world" C program for microblaze under x86_64 host. >> >> I guess it is OK, but I am not quite sure about it (I use raw compiler, >> and have to point out "/upstream/release/lib/ld.so.1" explicitly, and >> receive a warning related with 'ld'). >> >> Is it really OK? can I still use raw compiler for our testsuite? Is >> 'LinkScr.ld' for ldscript related with current case? > > >> [root@localhost test]# /upstream/release/bin/microblaze-gchen-linux-gcc >> -nostdinc -c -o test.o test.c >> [root@localhost test]# /upstream/release/bin/microblaze-gchen-linux-ld -o >> test test.o /upstream/release/lib/ld.so.1 -lc -L/upstream/release/lib >> >> /upstream/release/bin/microblaze-gchen-linux-ld: warning: cannot find >> entry symbol _start; defaulting to 0000000010000180 > > Generally, you should use "gcc" to link programs, not "ld". gcc is > a driver which will select the appropriate libraries and support routines > (such as crt0.o, which contains _start) and pass them to the linker. >
OK, thanks. When gcc, it misses the root directory for "crt1.o" and "crtn.o": e.g. "/lib/ld.so.1", "crt1.o", "crtn.o" when gcc -v, but we need "/upstream/ release/lib/ld.so.1", "/upstream/lib/crt1.o", "/upstream/libcrtn.o". I guess, we need additional flag to mark the default system link path for gcc. But after check the all parameters of gcc, I can not find (-L is for normal library linkage, but not for crt1.o and crtn.o). I shall continue trying for it, and hope I can finish within this month. Welcome any ideas, suggestions or completions. Thanks. -- Chen Gang Open, share, and attitude like air, water, and life which God blessed
