patches/glibc/ports-2.10.1/130-i386-no-fallocate.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
Fix building on x86 when older linux headers lack __NR_fallocate define.
yann@1625
     2
yann@1625
     3
URL: http://bugs.gentoo.org/274269
yann@1625
     4
Reported-by: Mikael Magnusson <mikachu@gmail.com>
yann@1625
     5
yann@1625
     6
2009-11-09  Mike Frysinger  <vapier@gentoo.org>
yann@1625
     7
yann@1625
     8
	* sysdeps/unix/sysv/linux/i386/fallocate.c: Include errno.h.
yann@1625
     9
	(fallocate): Return ENOSYS if __NR_fallocate is not defined.
yann@1625
    10
	* sysdeps/unix/sysv/linux/i386/fallocate64.c: Likewise.
yann@1625
    11
yann@1625
    12
diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/fallocate.c glibc-2.10.1/sysdeps/unix/sysv/linux/i386/fallocate.c
yann@1625
    13
--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/fallocate.c	2009-03-02 17:11:06.000000000 +0100
yann@1625
    14
+++ glibc-2.10.1/sysdeps/unix/sysv/linux/i386/fallocate.c	2009-11-13 00:49:47.000000000 +0100
yann@1625
    15
@@ -16,6 +16,7 @@
yann@1625
    16
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
yann@1625
    17
    02111-1307 USA.  */
yann@1625
    18
 
yann@1625
    19
+#include <errno.h>
yann@1625
    20
 #include <fcntl.h>
yann@1625
    21
 #include <sysdep.h>
yann@1625
    22
 
yann@1625
    23
@@ -28,5 +29,10 @@
yann@1625
    24
 int
yann@1625
    25
 fallocate (int fd, int mode, __off_t offset, __off_t len)
yann@1625
    26
 {
yann@1625
    27
+#ifdef __NR_fallocate
yann@1625
    28
   return __call_fallocate (fd, mode, offset, len);
yann@1625
    29
+#else
yann@1625
    30
+  __set_errno (ENOSYS);
yann@1625
    31
+  return -1;
yann@1625
    32
+#endif
yann@1625
    33
 }
yann@1625
    34
diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/fallocate64.c glibc-2.10.1/sysdeps/unix/sysv/linux/i386/fallocate64.c
yann@1625
    35
--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/fallocate64.c	2009-03-02 17:10:29.000000000 +0100
yann@1625
    36
+++ glibc-2.10.1/sysdeps/unix/sysv/linux/i386/fallocate64.c	2009-11-13 00:49:47.000000000 +0100
yann@1625
    37
@@ -16,6 +16,7 @@
yann@1625
    38
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
yann@1625
    39
    02111-1307 USA.  */
yann@1625
    40
 
yann@1625
    41
+#include <errno.h>
yann@1625
    42
 #include <fcntl.h>
yann@1625
    43
 #include <sysdep.h>
yann@1625
    44
 
yann@1625
    45
@@ -28,5 +29,10 @@
yann@1625
    46
 int
yann@1625
    47
 __fallocate64_l64 (int fd, int mode, __off64_t offset, __off64_t len)
yann@1625
    48
 {
yann@1625
    49
+#ifdef __NR_fallocate
yann@1625
    50
   return __call_fallocate (fd, mode, offset, len);
yann@1625
    51
+#else
yann@1625
    52
+  __set_errno (ENOSYS);
yann@1625
    53
+  return -1;
yann@1625
    54
+#endif
yann@1625
    55
 }