patches/gcc/3.3/sh4-pthread.patch
changeset 1 eeea35fbf182
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/gcc/3.3/sh4-pthread.patch	Sat Feb 24 11:00:05 2007 +0000
     1.3 @@ -0,0 +1,42 @@
     1.4 +Patch to fix following test case failure:
     1.5 +
     1.6 +		=== libstdc++-v3 tests ===
     1.7 +FAIL: thread/pthread1.cc (test for excess errors)
     1.8 +Excess errors:
     1.9 +/opt/cegl-2.0/sh4-unknown-linux-gnu/gcc-ss-3_3-20030714-glibc-2.2.5/sh4-unknown-linux-gnu/bin/ld: cannot find -lthread
    1.10 +collect2: ld returned 1 exit status
    1.11 +
    1.12 +Note that *any* program compiled with -pthread fails:
    1.13 +
    1.14 +/opt/cegl-2.0/sh4-unknown-linux-gnu/gcc-ss-3_3-20030714-glibc-2.2.5/bin/sh4-unknown-linux-gnu-gcc hello.c  -pthread
    1.15 +/opt/cegl-2.0/sh4-unknown-linux-gnu/gcc-ss-3_3-20030714-glibc-2.2.5/lib/gcc-lib/sh4-unknown-linux-gnu/3.3.1/../../../../sh4-unknown-linux-gnu/bin/ld: cannot find -lthread
    1.16 +collect2: ld returned 1 exit status
    1.17 +
    1.18 +Compiling with -lpthread on the other hand works fine:
    1.19 +/opt/cegl-2.0/sh4-unknown-linux-gnu/gcc-ss-3_3-20030714-glibc-2.2.5/bin/sh4-unknown-linux-gnu-gcc hello.c  -lpthread
    1.20 +
    1.21 +So -pthread is broken in some trivial way; it should invoke -lpthread, not -lthread,
    1.22 +at least when targeting Linux. 
    1.23 +
    1.24 +http://www.sh-linux.org/rpm-2003/SRPMS/gcc-3.2.3-3.src.rpm contains a jumbo patch,
    1.25 +gcc-20030210-sh-linux-1.patch, that includes a fix for this.  Here's the
    1.26 +appropriate hunk (brings in a fix for the documented -mieee option).
    1.27 +No idea if this fix is completely right, but it works for me...
    1.28 +- dank@kegel.com  20 Jul 2003
    1.29 +
    1.30 +Index: linux.h
    1.31 +===================================================================
    1.32 +RCS file: /cvsroot/gcc/gcc/gcc/config/sh/linux.h,v
    1.33 +retrieving revision 1.9.20.1
    1.34 +diff -u -d -u -r1.9.20.1 linux.h
    1.35 +--- gcc-ss-3_3-20030714/gcc/config/sh/linux.h.old	6 Jun 2003 02:30:59 -0000	1.9.20.1
    1.36 ++++ gcc-ss-3_3-20030714/gcc/config/sh/linux.h	20 Jul 2003 23:36:50 -0000
    1.37 +@@ -59,7 +59,7 @@
    1.38 + #undef LIB_SPEC
    1.39 + #define LIB_SPEC \
    1.40 +   "%{shared: -lc} \
    1.41 +-   %{!shared: %{pthread:-lthread} \
    1.42 ++   %{!shared: %{mieee:-lieee} %{pthread:-lpthread} \
    1.43 +      %{profile:-lc_p} %{!profile: -lc}}"
    1.44 + 
    1.45 + #undef STARTFILE_SPEC