patches/gcc/3.3/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... :-(
yann@1
     1
Patch to fix following test case failure:
yann@1
     2
yann@1
     3
		=== libstdc++-v3 tests ===
yann@1
     4
FAIL: thread/pthread1.cc (test for excess errors)
yann@1
     5
Excess errors:
yann@1
     6
/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
yann@1
     7
collect2: ld returned 1 exit status
yann@1
     8
yann@1
     9
Note that *any* program compiled with -pthread fails:
yann@1
    10
yann@1
    11
/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
yann@1
    12
/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
yann@1
    13
collect2: ld returned 1 exit status
yann@1
    14
yann@1
    15
Compiling with -lpthread on the other hand works fine:
yann@1
    16
/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
yann@1
    17
yann@1
    18
So -pthread is broken in some trivial way; it should invoke -lpthread, not -lthread,
yann@1
    19
at least when targeting Linux. 
yann@1
    20
yann@1
    21
http://www.sh-linux.org/rpm-2003/SRPMS/gcc-3.2.3-3.src.rpm contains a jumbo patch,
yann@1
    22
gcc-20030210-sh-linux-1.patch, that includes a fix for this.  Here's the
yann@1
    23
appropriate hunk (brings in a fix for the documented -mieee option).
yann@1
    24
No idea if this fix is completely right, but it works for me...
yann@1
    25
- dank@kegel.com  20 Jul 2003
yann@1
    26
yann@1
    27
Index: linux.h
yann@1
    28
===================================================================
yann@1
    29
RCS file: /cvsroot/gcc/gcc/gcc/config/sh/linux.h,v
yann@1
    30
retrieving revision 1.9.20.1
yann@1
    31
diff -u -d -u -r1.9.20.1 linux.h
yann@1
    32
--- gcc-ss-3_3-20030714/gcc/config/sh/linux.h.old	6 Jun 2003 02:30:59 -0000	1.9.20.1
yann@1
    33
+++ gcc-ss-3_3-20030714/gcc/config/sh/linux.h	20 Jul 2003 23:36:50 -0000
yann@1
    34
@@ -59,7 +59,7 @@
yann@1
    35
 #undef LIB_SPEC
yann@1
    36
 #define LIB_SPEC \
yann@1
    37
   "%{shared: -lc} \
yann@1
    38
-   %{!shared: %{pthread:-lthread} \
yann@1
    39
+   %{!shared: %{mieee:-lieee} %{pthread:-lpthread} \
yann@1
    40
      %{profile:-lc_p} %{!profile: -lc}}"
yann@1
    41
 
yann@1
    42
 #undef STARTFILE_SPEC