patches/gcc/4.2.0/140-uclibc-locale-wchar_fix.patch
author "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
Fri Jan 27 13:31:16 2012 +0100 (2012-01-27)
changeset 2854 a70abdbfa342
parent 111 2e16b9fc302d
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 --- gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc.uclibc200_wchar~	2006-03-10 15:32:37 +0100
     2 +++ gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc	2006-03-10 15:37:27 +0100
     3 @@ -401,7 +401,7 @@
     4  # ifdef __UCLIBC_HAS_XLOCALE__
     5  	  _M_data->_M_decimal_point = __cloc->decimal_point_wc;
     6  	  _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
     7 -# else
     8 +# elif defined __UCLIBC_HAS_LOCALE__
     9  	  _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
    10  	  _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
    11  # endif
    12 @@ -556,7 +556,7 @@
    13  # ifdef __UCLIBC_HAS_XLOCALE__
    14  	  _M_data->_M_decimal_point = __cloc->decimal_point_wc;
    15  	  _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
    16 -# else
    17 +# elif defined __UCLIBC_HAS_LOCALE__
    18  	  _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
    19  	  _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
    20  # endif
    21 --- gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc.uclibc200_wchar~	2006-03-10 15:32:37 +0100
    22 +++ gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc	2006-03-10 15:37:27 +0100
    23 @@ -127,12 +127,25 @@
    24  	{
    25  	  // Named locale.
    26  	  // NB: In the GNU model wchar_t is always 32 bit wide.
    27 +#ifdef __UCLIBC_MJN3_ONLY__
    28 +#warning fix this... should be numeric
    29 +#endif
    30 +#ifdef __UCLIBC__
    31 +# ifdef __UCLIBC_HAS_XLOCALE__
    32 +	  _M_data->_M_decimal_point = __cloc->decimal_point_wc;
    33 +	  _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
    34 +# elif defined __UCLIBC_HAS_LOCALE__
    35 +	  _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
    36 +	  _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
    37 +# endif
    38 +#else
    39  	  union { char *__s; wchar_t __w; } __u;
    40  	  __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
    41  	  _M_data->_M_decimal_point = __u.__w;
    42  
    43  	  __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
    44  	  _M_data->_M_thousands_sep = __u.__w;
    45 +#endif
    46  
    47  	  if (_M_data->_M_thousands_sep == L'\0')
    48  	    _M_data->_M_grouping = "";