Bug 11997 - libgcc build fails because crtbeginS.o not built for sh-netbsdelf
Summary: libgcc build fails because crtbeginS.o not built for sh-netbsdelf
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: build
Depends on:
Blocks:
 
Reported: 2003-08-20 19:55 UTC by Dara Hazeghi
Modified: 2021-11-28 03:26 UTC (History)
1 user (show)

See Also:
Host:
Target: sh-netsbdelf1.6.1
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-04-18 13:56:22


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dara Hazeghi 2003-08-20 19:55:42 UTC
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
Comment 1 Andrew Pinski 2003-08-20 20:59:11 UTC
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.
Comment 2 Dara Hazeghi 2003-08-20 22:43:11 UTC
Thanks Andrew, your patch fixes the link errors.
Comment 3 Andrew Pinski 2003-08-20 22:47:43 UTC
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.
Comment 4 Andrew Pinski 2003-08-21 01:34:06 UTC
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.
Comment 5 Andrew Pinski 2021-11-28 03:26:20 UTC
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.