Bart De VOS pointed out that removing absolute paths from the libc linker scripts is plainly wrong.
It dates from dawn ages of the original crosstool code, and is not well explained. At that time, binutils might not understand the sysroot stuff, and it was necessary to remove absolute paths in that case.
/trunk/scripts/build/libc/glibc.sh | 14 2 12 0 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
1 diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc
2 --- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200
3 +++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:31:54.000000000 +0200
5 __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
6 const __c_locale& __cloc)
8 - if (!(__err & ios_base::failbit))
12 - float __f = __strtof_l(__s, &__sanity, __cloc);
13 - if (__sanity != __s && errno != ERANGE)
16 - __err |= ios_base::failbit;
20 + float __f = __strtof_l(__s, &__sanity, __cloc);
21 + if (__sanity != __s && errno != ERANGE)
24 + __err |= ios_base::failbit;
29 __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
30 const __c_locale& __cloc)
32 - if (!(__err & ios_base::failbit))
36 - double __d = __strtod_l(__s, &__sanity, __cloc);
37 - if (__sanity != __s && errno != ERANGE)
40 - __err |= ios_base::failbit;
44 + double __d = __strtod_l(__s, &__sanity, __cloc);
45 + if (__sanity != __s && errno != ERANGE)
48 + __err |= ios_base::failbit;
53 __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
54 const __c_locale& __cloc)
56 - if (!(__err & ios_base::failbit))
60 - long double __ld = __strtold_l(__s, &__sanity, __cloc);
61 - if (__sanity != __s && errno != ERANGE)
64 - __err |= ios_base::failbit;
68 + long double __ld = __strtold_l(__s, &__sanity, __cloc);
69 + if (__sanity != __s && errno != ERANGE)
72 + __err |= ios_base::failbit;
78 locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
80 - if (_S_get_c_locale() != __cloc)
81 + if (__cloc && _S_get_c_locale() != __cloc)
85 diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h
86 --- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200
87 +++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:31:54.000000000 +0200
89 #pragma GCC system_header
91 #include <cstring> // get std::strlen
92 -#include <cstdio> // get std::snprintf or std::sprintf
93 +#include <cstdio> // get std::vsnprintf or std::vsprintf
95 #include <langinfo.h> // For codecvt
96 #ifdef __UCLIBC_MJN3_ONLY__
99 -#ifdef __UCLIBC_HAS_LOCALE__
100 +#ifdef _GLIBCXX_USE_ICONV
101 #include <iconv.h> // For codecvt using iconv, iconv_t
103 -#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
104 -#include <libintl.h> // For messages
105 +#ifdef HAVE_LIBINTL_H
106 +#include <libintl.h> // For messages
110 #ifdef __UCLIBC_MJN3_ONLY__
111 #warning what is _GLIBCXX_C_LOCALE_GNU for
112 +// psm: used in os/gnu-linux/ctype_noninline.h
114 #define _GLIBCXX_C_LOCALE_GNU 1
118 // #define _GLIBCXX_NUM_CATEGORIES 6
119 #define _GLIBCXX_NUM_CATEGORIES 0
122 #ifdef __UCLIBC_HAS_XLOCALE__
126 typedef int* __c_locale;
129 - // Convert numeric value of type _Tv to string and return length of
130 - // string. If snprintf is available use it, otherwise fall back to
131 - // the unsafe sprintf which, in general, can be dangerous and should
132 + // Convert numeric value of type double to string and return length of
133 + // string. If vsnprintf is available use it, otherwise fall back to
134 + // the unsafe vsprintf which, in general, can be dangerous and should
136 - template<typename _Tv>
138 - __convert_from_v(char* __out,
139 - const int __size __attribute__ ((__unused__)),
141 -#ifdef __UCLIBC_HAS_XCLOCALE__
142 - _Tv __v, const __c_locale& __cloc, int __prec)
144 + __convert_from_v(const __c_locale&
145 +#ifndef __UCLIBC_HAS_XCLOCALE__
146 + __cloc __attribute__ ((__unused__))
151 + const char* __fmt, ...)
154 +#ifdef __UCLIBC_HAS_XCLOCALE__
155 __c_locale __old = __gnu_cxx::__uselocale(__cloc);
157 - _Tv __v, const __c_locale&, int __prec)
159 # ifdef __UCLIBC_HAS_LOCALE__
160 char* __old = std::setlocale(LC_ALL, NULL);
161 char* __sav = new char[std::strlen(__old) + 1];
166 - const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
167 + va_start(__args, __fmt);
168 + const int __ret = std::vsnprintf(__out, __size, __fmt, __args);
171 #ifdef __UCLIBC_HAS_XCLOCALE__
172 __gnu_cxx::__uselocale(__old);
173 diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc
174 --- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200
175 +++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:31:54.000000000 +0200
178 // Written by Benjamin Kosnik <bkoz@redhat.com>
180 +#include <features.h>
181 +#ifdef __UCLIBC_HAS_LOCALE__
188 #include <bits/c++locale_internal.h>
191 @@ -138,20 +143,34 @@
193 do_is(mask __m, wchar_t __c) const
195 - // Highest bitmask in ctype_base == 10, but extra in "C"
196 - // library for blank.
197 + // The case of __m == ctype_base::space is particularly important,
198 + // due to its use in many istream functions. Therefore we deal with
199 + // it first, exploiting the knowledge that on GNU systems _M_bit[5]
200 + // is the mask corresponding to ctype_base::space. NB: an encoding
201 + // change would not affect correctness!
203 - const size_t __bitmasksize = 11;
204 - for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
205 - if (__m & _M_bit[__bitcur]
206 - && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
211 + if (__m == _M_bit[5])
212 + __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
215 + // Highest bitmask in ctype_base == 10, but extra in "C"
216 + // library for blank.
217 + const size_t __bitmasksize = 11;
218 + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
219 + if (__m & _M_bit[__bitcur])
221 + if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
226 + else if (__m == _M_bit[__bitcur])
236 do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
237 diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h
238 --- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200
239 +++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200
241 template<typename _CharT>
242 messages<_CharT>::messages(size_t __refs)
243 : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
244 - _M_name_messages(_S_get_c_name())
245 + _M_name_messages(_S_get_c_name())
248 template<typename _CharT>
249 messages<_CharT>::messages(__c_locale __cloc, const char* __s,
251 - : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
252 - _M_name_messages(__s)
253 + : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL)
255 - char* __tmp = new char[std::strlen(__s) + 1];
256 - std::strcpy(__tmp, __s);
257 + const size_t __len = std::strlen(__s) + 1;
258 + char* __tmp = new char[__len];
259 + std::memcpy(__tmp, __s, __len);
260 _M_name_messages = __tmp;
262 + // Last to avoid leaking memory if new throws.
263 + _M_c_locale_messages = _S_clone_c_locale(__cloc);
266 template<typename _CharT>
267 diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc
268 --- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200
269 +++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:54.000000000 +0200
272 // Written by Benjamin Kosnik <bkoz@redhat.com>
274 +#include <features.h>
275 +#ifdef __UCLIBC_HAS_LOCALE__
282 #include <bits/c++locale_internal.h>
284 #ifdef __UCLIBC_MJN3_ONLY__
294 diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc
295 --- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200
296 +++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:54.000000000 +0200
299 // Written by Benjamin Kosnik <bkoz@redhat.com>
301 +#include <features.h>
302 +#ifdef __UCLIBC_HAS_LOCALE__
309 #include <bits/c++locale_internal.h>
311 #ifdef __UCLIBC_MJN3_ONLY__
312 diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h
313 --- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200
314 +++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200
316 template<typename _CharT>
317 __timepunct<_CharT>::__timepunct(size_t __refs)
318 : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
319 - _M_name_timepunct(_S_get_c_name())
320 + _M_name_timepunct(_S_get_c_name())
321 { _M_initialize_timepunct(); }
323 template<typename _CharT>
324 __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
325 : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
326 - _M_name_timepunct(_S_get_c_name())
327 + _M_name_timepunct(_S_get_c_name())
328 { _M_initialize_timepunct(); }
330 template<typename _CharT>
331 __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
333 : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
334 - _M_name_timepunct(__s)
335 + _M_name_timepunct(NULL)
337 - char* __tmp = new char[std::strlen(__s) + 1];
338 - std::strcpy(__tmp, __s);
339 + const size_t __len = std::strlen(__s) + 1;
340 + char* __tmp = new char[__len];
341 + std::memcpy(__tmp, __s, __len);
342 _M_name_timepunct = __tmp;
343 - _M_initialize_timepunct(__cloc);
346 + { _M_initialize_timepunct(__cloc); }
349 + delete [] _M_name_timepunct;
350 + __throw_exception_again;
354 template<typename _CharT>