patches/gcc/4.4.5/330-libmudflap-susv3-legacy.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>
     1 diff -durN gcc-4.4.5.orig/libmudflap/mf-hooks2.c gcc-4.4.5/libmudflap/mf-hooks2.c
     2 --- gcc-4.4.5.orig/libmudflap/mf-hooks2.c	2009-04-10 01:23:07.000000000 +0200
     3 +++ gcc-4.4.5/libmudflap/mf-hooks2.c	2010-10-09 23:11:52.000000000 +0200
     4 @@ -421,7 +421,7 @@
     5  {
     6    TRACE ("%s\n", __PRETTY_FUNCTION__);
     7    MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
     8 -  bzero (s, n);
     9 +  memset (s, 0, n);
    10  }
    11  
    12  
    13 @@ -431,7 +431,7 @@
    14    TRACE ("%s\n", __PRETTY_FUNCTION__);
    15    MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
    16    MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
    17 -  bcopy (src, dest, n);
    18 +  memmove (dest, src, n);
    19  }
    20  
    21  
    22 @@ -441,7 +441,7 @@
    23    TRACE ("%s\n", __PRETTY_FUNCTION__);
    24    MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
    25    MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
    26 -  return bcmp (s1, s2, n);
    27 +  return n == 0 ? 0 : memcmp (s1, s2, n);
    28  }
    29  
    30  
    31 @@ -450,7 +450,7 @@
    32    size_t n = strlen (s);
    33    TRACE ("%s\n", __PRETTY_FUNCTION__);
    34    MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
    35 -  return index (s, c);
    36 +  return strchr (s, c);
    37  }
    38  
    39  
    40 @@ -459,7 +459,7 @@
    41    size_t n = strlen (s);
    42    TRACE ("%s\n", __PRETTY_FUNCTION__);
    43    MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
    44 -  return rindex (s, c);
    45 +  return strrchr (s, c);
    46  }
    47  
    48  /* XXX:  stpcpy, memccpy */