patches/glibc/ports-2.10.1/600-mips_librt-mips.patch
author "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
Fri Jan 27 13:31:16 2012 +0100 (2012-01-27)
changeset 2854 a70abdbfa342
permissions -rw-r--r--
complibs/cloog: fix linking with libm

In Ubuntu 11.04 and 11.10, the default options for ld have changed.
--no-copy-dt-needed-entries and --as-needed are now enabled by default, which
causes errors like:

[EXTRA] Checking CLooG/ppl
[DEBUG] ==> Executing: 'make' '-j3' '-s' 'check'
[ALL ] Making check in .
[ALL ] config.status: creating include/cloog/cloog-config.h
[ALL ] config.status: include/cloog/cloog-config.h is unchanged
[ALL ] libtool: link: i686-build_pc-linux-gnu-gcc -Wall -fomit-frame-pointer
-pipe -o cloog cloog.o -L/<snip>/build/static/lib ./.libs/libcloog.a -lm
/<snip>/build/static/lib/libppl_c.a /<snip>/build/static/lib/libpwl.a
/<snip>/build/static/lib/libppl.a /<snip>/build/static/lib/libgmpxx.a
/<snip>/build/static/lib/libgmp.a -lstdc++
[ALL ] /usr/bin/ld: /<snip>/build/static/lib/libppl.a(MIP_Problem.o):
undefined reference to symbol 'sqrt@@GLIBC_2.0'
[ALL ] /usr/bin/ld: note: 'sqrt@@GLIBC_2.0' is defined in DSO
/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/libm.so so try adding
it to the linker command line
[ALL ] /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/libm.so:
could not read symbols: Invalid operation
[ALL ] collect2: ld returned 1 exit status
[ERROR] make[2]: *** [cloog] Error 1
[ERROR] make[1]: *** [check-recursive] Error 1

See:
https://wiki.ubuntu.com/NattyNarwhal/ToolchainTransition

This patch fixes these errors by placing '-lm' at the right place on the command
line as libppl requires libm when linking cloog.

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