patches/gcc/3.3.1/sh4-pthread.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Feb 24 11:00:05 2007 +0000 (2007-02-24)
changeset 1 eeea35fbf182
permissions -rw-r--r--
Add the full crosstool-NG sources to the new repository of its own.
You might just say: 'Yeah! crosstool-NG's got its own repo!".
Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup.
That means I'm putting backups in place in the afternoon.
That also means we've lost history... :-(
     1 See http://gcc.gnu.org/PR11903
     2 
     3 Patch to fix following test case failure:
     4 
     5 		=== libstdc++-v3 tests ===
     6 FAIL: thread/pthread1.cc (test for excess errors)
     7 Excess errors:
     8 /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
     9 collect2: ld returned 1 exit status
    10 
    11 Note that *any* program compiled with -pthread fails:
    12 
    13 /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
    14 /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
    15 collect2: ld returned 1 exit status
    16 
    17 Compiling with -lpthread on the other hand works fine:
    18 /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
    19 
    20 So -pthread is broken in some trivial way; it should invoke -lpthread, not -lthread,
    21 at least when targeting Linux. 
    22 
    23 http://www.sh-linux.org/rpm-2003/SRPMS/gcc-3.2.3-3.src.rpm contains a jumbo patch,
    24 gcc-20030210-sh-linux-1.patch, that includes a fix for this.  Here's the
    25 appropriate hunk (brings in a fix for the documented -mieee option).
    26 No idea if this fix is completely right, but it works for me...
    27 - dank@kegel.com  20 Jul 2003
    28 
    29 Index: linux.h
    30 ===================================================================
    31 RCS file: /cvsroot/gcc/gcc/gcc/config/sh/linux.h,v
    32 retrieving revision 1.9.20.1
    33 diff -u -d -u -r1.9.20.1 linux.h
    34 --- gcc-ss-3_3-20030714/gcc/config/sh/linux.h.old	6 Jun 2003 02:30:59 -0000	1.9.20.1
    35 +++ gcc-ss-3_3-20030714/gcc/config/sh/linux.h	20 Jul 2003 23:36:50 -0000
    36 @@ -59,7 +59,7 @@
    37  #undef LIB_SPEC
    38  #define LIB_SPEC \
    39    "%{shared: -lc} \
    40 -   %{!shared: %{pthread:-lthread} \
    41 +   %{!shared: %{mieee:-lieee} %{pthread:-lpthread} \
    42       %{profile:-lc_p} %{!profile: -lc}}"
    43  
    44  #undef STARTFILE_SPEC