Building for target sh-netbsdelf with current mainline (20030820) fails linking libgcc: /tmp/mainline/objdir/gcc/xgcc -B/tmp/mainline/objdir/gcc/ -B/tmp/dara//sh-netbsdelf1.6.1/bin/ -B/tmp/dara//sh-netbsdelf1.6.1/lib/ -isystem /tmp/dara//sh-netbsdelf1.6.1/include -isystem /tmp/dara//sh-netbsdelf1.6.1/sys-include -O2 -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem ./include -fpic -g -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc/./libgcc.map -o libgcc_s.so.1 libgcc/./_ashiftrt.o libgcc/./_ashiftrt_n.o libgcc/./_ashiftlt.o libgcc/./_lshiftrt.o libgcc/./_movstr.o libgcc/./_movstr_i4.o libgcc/./_mulsi3.o libgcc/./_sdivsi3.o libgcc/./_sdivsi3_i4.o libgcc/./_udivsi3.o libgcc/./_udivsi3_i4.o libgcc/./_set_fpscr.o libgcc/./_ic_invalidate.o libgcc/./_muldi3.o libgcc/./_negdi2.o libgcc/./_lshrdi3.o libgcc/./_ashldi3.o libgcc/./_ashrdi3.o libgcc/./_cmpdi2.o libgcc/./_ucmpdi2.o libgcc/./_floatdidf.o libgcc/./_floatdisf.o libgcc/./_fixunsdfsi.o libgcc/./_fixunssfsi.o libgcc/./_fixunsdfdi.o libgcc/./_fixdfdi.o libgcc/./_fixunssfdi.o libgcc/./_fixsfdi.o libgcc/./_fixxfdi.o libgcc/./_fixunsxfdi.o libgcc/./_floatdixf.o libgcc/./_fixunsxfsi.o libgcc/./_fixtfdi.o libgcc/./_fixunstfdi.o libgcc/./_floatditf.o libgcc/./_clear_cache.o libgcc/./_trampoline.o libgcc/./__main.o libgcc/./_absvsi2.o libgcc/./_absvdi2.o libgcc/./_addvsi3.o libgcc/./_addvdi3.o libgcc/./_subvsi3.o libgcc/./_subvdi3.o libgcc/./_mulvsi3.o libgcc/./_mulvdi3.o libgcc/./_negvsi2.o libgcc/./_negvdi2.o libgcc/./_ctors.o libgcc/./_ffssi2.o libgcc/./_ffsdi2.o libgcc/./_clz.o libgcc/./_clzsi2.o libgcc/./_clzdi2.o libgcc/./_ctzsi2.o libgcc/./_ctzdi2.o libgcc/./_popcount_tab.o libgcc/./_popcountsi2.o libgcc/./_popcountdi2.o libgcc/./_paritysi2.o libgcc/./_paritydi2.o libgcc/./_divdi3.o libgcc/./_moddi3.o libgcc/./_udivdi3.o libgcc/./_umoddi3.o libgcc/./_udiv_w_sdiv.o libgcc/./_udivmoddi4.o libgcc/./unwind-dw2.o libgcc/./unwind-dw2-fde.o libgcc/./unwind-sjlj.o libgcc/./gthr-gnat.o libgcc/./unwind-c.o -lc && rm -f libgcc_s.so && ln -s libgcc_s.so.1 libgcc_s.so /tmp/dara//sh-netbsdelf1.6.1/bin/ld: cannot open crtbeginS.o: No such file or directory collect2: ld returned 1 exit status make[1]: *** [libgcc_s.so] Error 1 A quick search shows that crt*.o have not been built yet, so the failed link isn't a big surprise. Compiler was configure with ../gcc/configure --prefix=/tmp/dara --target=sh-netbsdelf1.6.1 --with-sysroot=/tmp/dara/sh-netbsdelf1.6.1/sysroot --enable-languages=c,c++,objc
Dara, can you try this patch, this should fix it (note I have not tried it yet): Index: t-netbsd ============================================================ ======= RCS file: /cvs/gcc/gcc/gcc/config/sh/t-netbsd,v retrieving revision 1.2 diff -u -d -b -w -u -r1.2 t-netbsd --- t-netbsd 18 Jun 2002 19:56:54 -0000 1.2 +++ t-netbsd 20 Aug 2003 20:58:30 -0000 @@ -3,7 +3,7 @@ LIB2FUNCS_EXTRA= -EXTRA_MULTILIB_PARTS= +EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o # NetBSD's C library includes a fast software FP library that # has support for setting/setting the rounding mode, exception I here by put this patch in the public domain.
Thanks Andrew, your patch fixes the link errors.
Note for the patch I compared the t-linux with t-netbsd in the gcc/config/sh directory to see if anything could be missing and I saw that t-netbsd did able to build crtbeginS.o. I will submit patch in the first week of September. Thanks for trying the patch.
I am going to take my patch back since the crtbeginS.o made by GCC is the wrong one, I think you have to build the one that comes with netbsd but I still could be wrong again. I would ask the netbsd guys about this just to be sure.
This is only a bug for pre NetBSD 1.7 (2.0). Anything older than that was not setup to use GCC's crtstuff and really bug a not. Since NetBSD 2.0 was released in 2004, this is a won't fix. Plus this might have been fixed along the way when libgcc configuration went into its own directory.