patches/gcc/3.3.1/sh4-pthread.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue May 08 17:48:32 2007 +0000 (2007-05-08)
changeset 78 c3868084d81a
permissions -rw-r--r--
Huge fixes to glibc build, so that we can build at least (and at last):
- use ports addon even when installing headers,
- use optimisation (-O) when installing headers, to avoid unnecessary warnings (thanks Robert P. J. DAY for pointing this out!),
- lowest kernel version to use is only X.Y.Z, not X.Y.Z.T,
- a bit of preparations for NPTL (RSN I hope),
- fix fixing the linker scripts (changing the backup file is kind of useless and stupid);

Shut uClibc finish step: there really is nothing to do;

Add a patch for glibc-2.3.6 weak aliases handling on some archs (ARM and ALPHA at least);

Did not catch the make errors: fixed the pattern matching in scripts/functions;

Introduce a new log level, ALL:
- send components' build messages there,
- DEBUG log level is destined only for crosstool-NG debug messages,
- migrate sub-actions to use appropriate log levels;

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