kumquat-buildroot/package/gcc/5.1.0/850-libstdcxx-uclibc-c99.patch
Thomas Petazzoni 4deb2d93c5 gcc: add support for gcc 5.1
This commit adds support for gcc 5.1 in Buildroot. In terms of gcc
patches, compared to gcc 4.9.x:

 * Kept as is, sometimes after minor adjusments:

   100-uclibc-conf.patch
   301-missing-execinfo_h.patch
   810-arm-softfloat-libgcc.patch
   830-arm_unbreak_armv4t.patch
   840-microblaze-enable-dwarf-eh-support.patch
   850-libstdcxx-uclibc-c99.patch
   860-cilk-wchar.patch

 * Dropped:

   110-pr64896.patch
   111-pr65730.patch

 * Split in multiple parts:

   900-musl-support.patch

   The patches from Crosstool-NG for muls support are used instead of
   one single patch.

 * Renamed:

   910-gcc-poison-system-directories.patch to
   200-gcc-poison-system-directories.patch

   920-libgcc-remove-unistd-header.patch to
   201-libgcc-remove-unistd-header.patch

   Since the 9xx part of the series is now used by the various musl
   related patches.

We have tested the following configurations, with a minimal Busybox
system:

 * ARM, uClibc-ng
 * ARM, glibc
 * ARM, musl
 * x86, uClibc-ng and uClibc 0.9.33.2
 * x86, glibc
 * x86, musl

All of the configurations built fine. All the configurations boot fine
in Qemu, except x86/uClibc (either ng or 0.9.33.2), it segfaults when
running init:

devtmpfs: mounted
Freeing unused kernel memory: 300K (c1389000 - c13d4000)
init[1]: segfault at 0 ip b77708c1 sp bfa9bb0c error 4 in ld-uClibc-0.9.33.2.so[b776c000+6000]
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

We'll give some time for the uClibc developers to fix the problem
before taking other measures in Buildroot to exclude gcc 5.1 from a
x86/uClibc configuration.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2015-06-23 00:18:17 +02:00

274 lines
9.0 KiB
Diff

Allow C99-depending features of libstdc++ with uClibc
The libstdc++ code is fairly restrictive on how it checks for C99
compatibility: it requires *complete* C99 support to enable certain
features. For example, uClibc provides a good number of C99 features,
but not C99 complex number support. For this reason, libstdc++
completely disables many the standard C++ methods that can in fact
work because uClibc provides the necessary functions.
This patch is similar and highly inspired from
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58393, but implemented in
a way that doesn't involve changing the configure.ac script, as
autoreconfiguring gcc is complicated. It simply relies on the fact
that uClibc defines the __UCLIBC__ definition.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Index: b/libstdc++-v3/config/locale/generic/c_locale.h
===================================================================
--- a/libstdc++-v3/config/locale/generic/c_locale.h
+++ b/libstdc++-v3/config/locale/generic/c_locale.h
@@ -70,7 +70,7 @@
__builtin_va_list __args;
__builtin_va_start(__args, __fmt);
-#ifdef _GLIBCXX_USE_C99
+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args);
#else
const int __ret = __builtin_vsprintf(__out, __fmt, __args);
Index: b/libstdc++-v3/config/locale/gnu/c_locale.h
===================================================================
--- a/libstdc++-v3/config/locale/gnu/c_locale.h
+++ b/libstdc++-v3/config/locale/gnu/c_locale.h
@@ -88,7 +88,7 @@
__builtin_va_list __args;
__builtin_va_start(__args, __fmt);
-#ifdef _GLIBCXX_USE_C99
+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args);
#else
const int __ret = __builtin_vsprintf(__out, __fmt, __args);
Index: b/libstdc++-v3/include/bits/basic_string.h
===================================================================
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -5239,7 +5239,7 @@
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
-#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99)
+#if __cplusplus >= 201103L && (defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__))
#include <ext/string_conversions.h>
Index: b/libstdc++-v3/include/bits/locale_facets.tcc
===================================================================
--- a/libstdc++-v3/include/bits/locale_facets.tcc
+++ b/libstdc++-v3/include/bits/locale_facets.tcc
@@ -992,7 +992,7 @@
char __fbuf[16];
__num_base::_S_format_float(__io, __fbuf, __mod);
-#ifdef _GLIBCXX_USE_C99
+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
// Precision is always used except for hexfloat format.
const bool __use_prec =
(__io.flags() & ios_base::floatfield) != ios_base::floatfield;
Index: b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
===================================================================
--- a/libstdc++-v3/include/bits/locale_facets_nonio.tcc
+++ b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
@@ -578,7 +578,7 @@
{
const locale __loc = __io.getloc();
const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
-#ifdef _GLIBCXX_USE_C99
+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
// First try a buffer perhaps big enough.
int __cs_size = 64;
char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
Index: b/libstdc++-v3/include/c_compatibility/math.h
===================================================================
--- a/libstdc++-v3/include/c_compatibility/math.h
+++ b/libstdc++-v3/include/c_compatibility/math.h
@@ -56,7 +56,7 @@
using std::floor;
using std::fmod;
-#if _GLIBCXX_USE_C99
+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
using std::fpclassify;
using std::isfinite;
using std::isinf;
Index: b/libstdc++-v3/include/c_compatibility/wchar.h
===================================================================
--- a/libstdc++-v3/include/c_compatibility/wchar.h
+++ b/libstdc++-v3/include/c_compatibility/wchar.h
@@ -103,7 +103,7 @@
using std::wmemset;
using std::wcsftime;
-#if _GLIBCXX_USE_C99
+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
using std::wcstold;
using std::wcstoll;
using std::wcstoull;
Index: b/libstdc++-v3/include/c_global/cstdlib
===================================================================
--- a/libstdc++-v3/include/c_global/cstdlib
+++ b/libstdc++-v3/include/c_global/cstdlib
@@ -195,7 +195,7 @@
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
-#if _GLIBCXX_USE_C99
+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
#undef _Exit
#undef llabs
Index: b/libstdc++-v3/include/c_global/cwchar
===================================================================
--- a/libstdc++-v3/include/c_global/cwchar
+++ b/libstdc++-v3/include/c_global/cwchar
@@ -232,7 +232,7 @@
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
-#if _GLIBCXX_USE_C99
+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
#undef wcstold
#undef wcstoll
@@ -289,7 +289,7 @@
using std::vwscanf;
#endif
-#if _GLIBCXX_USE_C99
+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
using std::wcstold;
using std::wcstoll;
using std::wcstoull;
Index: b/libstdc++-v3/include/c_std/cstdio
===================================================================
--- a/libstdc++-v3/include/c_std/cstdio
+++ b/libstdc++-v3/include/c_std/cstdio
@@ -144,7 +144,7 @@
using ::vsprintf;
} // namespace std
-#if _GLIBCXX_USE_C99
+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
#undef snprintf
#undef vfscanf
Index: b/libstdc++-v3/include/c_std/cstdlib
===================================================================
--- a/libstdc++-v3/include/c_std/cstdlib
+++ b/libstdc++-v3/include/c_std/cstdlib
@@ -192,7 +192,7 @@
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
-#if _GLIBCXX_USE_C99
+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
#undef _Exit
#undef llabs
Index: b/libstdc++-v3/include/c_std/cwchar
===================================================================
--- a/libstdc++-v3/include/c_std/cwchar
+++ b/libstdc++-v3/include/c_std/cwchar
@@ -228,7 +228,7 @@
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
-#if _GLIBCXX_USE_C99
+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
#undef wcstold
#undef wcstoll
Index: b/libstdc++-v3/include/ext/vstring.h
===================================================================
--- a/libstdc++-v3/include/ext/vstring.h
+++ b/libstdc++-v3/include/ext/vstring.h
@@ -2680,7 +2680,7 @@
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
-#if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99))
+#if ((__cplusplus >= 201103L) && (defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)))
#include <ext/string_conversions.h>
Index: b/libstdc++-v3/include/tr1/cstdio
===================================================================
--- a/libstdc++-v3/include/tr1/cstdio
+++ b/libstdc++-v3/include/tr1/cstdio
@@ -33,7 +33,7 @@
#include <cstdio>
-#if _GLIBCXX_USE_C99
+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
namespace std _GLIBCXX_VISIBILITY(default)
{
Index: b/libstdc++-v3/include/tr1/cstdlib
===================================================================
--- a/libstdc++-v3/include/tr1/cstdlib
+++ b/libstdc++-v3/include/tr1/cstdlib
@@ -35,7 +35,7 @@
#if _GLIBCXX_HOSTED
-#if _GLIBCXX_USE_C99
+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
namespace std _GLIBCXX_VISIBILITY(default)
{
Index: b/libstdc++-v3/include/tr1/cwchar
===================================================================
--- a/libstdc++-v3/include/tr1/cwchar
+++ b/libstdc++-v3/include/tr1/cwchar
@@ -52,7 +52,7 @@
using std::vwscanf;
#endif
-#if _GLIBCXX_USE_C99
+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
using std::wcstold;
using std::wcstoll;
using std::wcstoull;
Index: b/libstdc++-v3/include/tr1/stdlib.h
===================================================================
--- a/libstdc++-v3/include/tr1/stdlib.h
+++ b/libstdc++-v3/include/tr1/stdlib.h
@@ -33,7 +33,7 @@
#if _GLIBCXX_HOSTED
-#if _GLIBCXX_USE_C99
+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
using std::tr1::atoll;
using std::tr1::strtoll;
Index: b/libstdc++-v3/src/c++11/debug.cc
===================================================================
--- a/libstdc++-v3/src/c++11/debug.cc
+++ b/libstdc++-v3/src/c++11/debug.cc
@@ -788,7 +788,7 @@
int __n __attribute__ ((__unused__)),
const char* __fmt, _Tp __s) const throw ()
{
-#ifdef _GLIBCXX_USE_C99
+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
std::snprintf(__buf, __n, __fmt, __s);
#else
std::sprintf(__buf, __fmt, __s);
Index: b/libstdc++-v3/include/c_global/cstdio
===================================================================
--- a/libstdc++-v3/include/c_global/cstdio
+++ b/libstdc++-v3/include/c_global/cstdio
@@ -146,7 +146,7 @@
using ::vsprintf;
} // namespace
-#if _GLIBCXX_USE_C99
+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
#undef snprintf
#undef vfscanf