patches/glibc/ports-2.10.1/600-mips_librt-mips.patch
author Johannes Stezenbach <js@sig21.net>
Thu Jul 29 19:47:16 2010 +0200 (2010-07-29)
changeset 2045 fdaa6c7f6dea
permissions -rw-r--r--
cc/gcc: add option to compile against static libstdc++, for gcc-4.4 and newer

Idea and know-how taken from CodeSourcery build script.

Normal build:
$ ldd arm-unknown-linux-uclibcgnueabi-gcc
linux-gate.so.1 => (0xb77f3000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb76e8000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb75a1000)
libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb757a000)
/lib/ld-linux.so.2 (0xb77f4000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb755c000)

CC_STATIC_LIBSTDCXX=y:
$ ldd arm-unknown-linux-uclibcgnueabi-gcc
linux-gate.so.1 => (0xb7843000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb76e6000)
/lib/ld-linux.so.2 (0xb7844000)

I made CC_STATIC_LIBSTDCXX default=y since I think
it is always desirable.

Signed-off-by: Johannes Stezenbach <js@sig21.net>
     1 we kind of screwed ourselves into a corner by having the clock symbols
     2 exported only with the glibc-2.0 version ... this patch fixes the
     3 export so all new binaries built against librt will use the correct
     4 glibc-2.2 symbol version
     5 
     6 one day, we'll just drop this on the floor (maybe after 2006.1)
     7 
     8 diff -durN glibc-2.10.1.orig/Versions.def glibc-2.10.1/Versions.def
     9 --- glibc-2.10.1.orig/Versions.def	2008-12-03 05:19:06.000000000 +0100
    10 +++ glibc-2.10.1/Versions.def	2009-11-13 00:51:27.000000000 +0100
    11 @@ -98,6 +98,7 @@
    12    GLIBC_PRIVATE
    13  }
    14  librt {
    15 +  GLIBC_2.0
    16    GLIBC_2.1
    17    GLIBC_2.2
    18    GLIBC_2.3
    19 diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/mips/Versions glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/mips/Versions
    20 --- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/mips/Versions	2009-05-16 10:36:20.000000000 +0200
    21 +++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/mips/Versions	2009-11-13 00:51:27.000000000 +0100
    22 @@ -35,3 +35,9 @@
    23      _test_and_set;
    24    }
    25  }
    26 +librt {
    27 +  GLIBC_2.0 {
    28 +    # c*
    29 +    clock_gettime; clock_settime;
    30 +  }
    31 +}
    32 diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/mips/Versions glibc-2.10.1/ports/sysdeps/unix/sysv/linux/mips/Versions
    33 diff -durN glibc-2.10.1.orig/sysdeps/unix/clock_gettime.c glibc-2.10.1/sysdeps/unix/clock_gettime.c
    34 --- glibc-2.10.1.orig/sysdeps/unix/clock_gettime.c	2007-07-28 22:36:04.000000000 +0200
    35 +++ glibc-2.10.1/sysdeps/unix/clock_gettime.c	2009-11-13 00:51:27.000000000 +0100
    36 @@ -23,6 +23,7 @@
    37  #include <sys/time.h>
    38  #include <libc-internal.h>
    39  #include <ldsodefs.h>
    40 +#include <shlib-compat.h>
    41  
    42  
    43  #if HP_TIMING_AVAIL
    44 @@ -90,7 +91,7 @@
    45  
    46  /* Get current value of CLOCK and store it in TP.  */
    47  int
    48 -clock_gettime (clockid_t clock_id, struct timespec *tp)
    49 +__clock_gettime (clockid_t clock_id, struct timespec *tp)
    50  {
    51    int retval = -1;
    52  
    53 @@ -133,4 +134,10 @@
    54  
    55    return retval;
    56  }
    57 -librt_hidden_def (clock_gettime)
    58 +versioned_symbol (librt, __clock_gettime, clock_gettime, GLIBC_2_2);
    59 +librt_hidden_ver (__clock_gettime, clock_gettime)
    60 +
    61 +#if defined __mips__ && defined SHARED
    62 +strong_alias (__clock_gettime, __mips_clock_gettime)
    63 +compat_symbol (librt, __mips_clock_gettime, clock_gettime, GLIBC_2_0);
    64 +#endif
    65 diff -durN glibc-2.10.1.orig/sysdeps/unix/clock_settime.c glibc-2.10.1/sysdeps/unix/clock_settime.c
    66 --- glibc-2.10.1.orig/sysdeps/unix/clock_settime.c	2007-08-14 05:19:33.000000000 +0200
    67 +++ glibc-2.10.1/sysdeps/unix/clock_settime.c	2009-11-13 00:51:27.000000000 +0100
    68 @@ -21,6 +21,7 @@
    69  #include <sys/time.h>
    70  #include <libc-internal.h>
    71  #include <ldsodefs.h>
    72 +#include <shlib-compat.h>
    73  
    74  
    75  #if HP_TIMING_AVAIL && !defined HANDLED_CPUTIME
    76 @@ -73,7 +74,7 @@
    77  
    78  /* Set CLOCK to value TP.  */
    79  int
    80 -clock_settime (clockid_t clock_id, const struct timespec *tp)
    81 +__clock_settime (clockid_t clock_id, const struct timespec *tp)
    82  {
    83    int retval;
    84  
    85 @@ -125,3 +126,9 @@
    86  
    87    return retval;
    88  }
    89 +versioned_symbol (librt, __clock_settime, clock_settime, GLIBC_2_2);
    90 +
    91 +#if defined __mips__ && defined SHARED
    92 +strong_alias (__clock_settime, __mips_clock_settime)
    93 +compat_symbol (librt, __mips_clock_settime, clock_settime, GLIBC_2_0);
    94 +#endif