Skip to contentSkip to conversation

Toolchain fixes

PATCH New Thomas Petazzoni 3 participants 11 messages Aug 15, 2014 – Aug 17, 2014

lore
Share & tools
lore
#0 lore raw

v2 cover Toolchain fixes

Hello,

Here is a new version of the patch series with toolchain fixes. It fixes bugs #7208 and #7250. Changes since v1:

- Fix minor typo noticed by Thomas DS in the commit log of the first four patches.

- Add three patches to fix bug #7208.

Those patches are aimed for 2014.08.

Thanks,

Thomas

Thomas Petazzoni (7):
gcc/4.7: add patch to enable more C++ features with uClibc gcc/4.8: add patch to enable more C++ features with uClibc gcc/4.9: add patch to enable more C++ features with uClibc gcc/arc-4.8-R3: add patch to enable more C++ features with uClibc gcc/4.7: fix C++ exceptions and pthread_exit() gcc/4.8: fix C++ exceptions and pthread_exit() gcc/4.9: fix C++ exceptions and pthread_exit()

 package/gcc/4.7.4/302-c99-snprintf.patch           |  13 -
 package/gcc/4.7.4/850-libstdcxx-uclibc-c99.patch   | 273 +++++++++++++++++++++
 package/gcc/4.7.4/900-musl-support.patch           |  61 ++---
 package/gcc/4.8.3/302-c99-snprintf.patch           |  13 -
 package/gcc/4.8.3/850-libstdcxx-uclibc-c99.patch   | 273 +++++++++++++++++++++
 package/gcc/4.8.3/900-musl-support.patch           | 213 ++++++++--------
 package/gcc/4.9.1/302-c99-snprintf.patch           |  13 -
 package/gcc/4.9.1/850-libstdcxx-uclibc-c99.patch   | 273 +++++++++++++++++++++
 package/gcc/4.9.1/900-musl-support.patch           |  66 ++---
 .../gcc/arc-4.8-R3/100-libstdcxx-uclibc-c99.patch  | 273 +++++++++++++++++++++
 10 files changed, 1246 insertions(+), 225 deletions(-)
 delete mode 100644 package/gcc/4.7.4/302-c99-snprintf.patch
 create mode 100644 package/gcc/4.7.4/850-libstdcxx-uclibc-c99.patch
 delete mode 100644 package/gcc/4.8.3/302-c99-snprintf.patch
 create mode 100644 package/gcc/4.8.3/850-libstdcxx-uclibc-c99.patch
 delete mode 100644 package/gcc/4.9.1/302-c99-snprintf.patch
 create mode 100644 package/gcc/4.9.1/850-libstdcxx-uclibc-c99.patch
 create mode 100644 package/gcc/arc-4.8-R3/100-libstdcxx-uclibc-c99.patch
Signature · 1 line
2.0.0
#1 lore raw

PATCH v2 1/7 gcc/4.7: add patch to enable more C++ features with uClibc

This commit fixes bug #7250, by allowing more libstdc++ features to be enabled with uClibc. libstdc++ wants an absolutely complete C99 support in the C library before enabling *any* feature that needs some C99 functions. However, uClibc doesn't provide C99 complex numbers, so libstdc++ disables a lot of C++ standard methods, even though they are not related to C99 complex numbers.

A partial solution already existed in the patch 302-c99-snprintf.patch, but this commit replaces it by the more complete 850-libstdcxx-uclibc-c99.patch, which is highly inspired by
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58393, except that it doesn't rely on configure.ac checks, but simply on testing defined(__UCLIBC__) like was done in 302-c99-snprintf.patch. This allows to avoid having to autoreconf gcc, which is quite complicated to achieve.

---
 package/gcc/4.7.4/302-c99-snprintf.patch         |  13 --
 package/gcc/4.7.4/850-libstdcxx-uclibc-c99.patch | 273 +++++++++++++++++++++++
 2 files changed, 273 insertions(+), 13 deletions(-)
 delete mode 100644 package/gcc/4.7.4/302-c99-snprintf.patch
 create mode 100644 package/gcc/4.7.4/850-libstdcxx-uclibc-c99.patch
package/gcc/4.7.4/302-c99-snprintf.patch deleted +0 -13
deleted file mode 100644
index ba51a0e..0000000
@@ -1,13 +0,0 @@
-Index: gcc-4.3.0/libstdc++-v3/include/c_global/cstdio
-===================================================================
---- gcc-4.3.0/libstdc++-v3/include/c_global/cstdio	(revision 129202)
-+++ gcc-4.3.0/libstdc++-v3/include/c_global/cstdio	(working copy)
-@@ -144,7 +144,7 @@
- 
- _GLIBCXX_END_NAMESPACE
- 
--#if _GLIBCXX_USE_C99
-+#if _GLIBCXX_USE_C99 || defined __UCLIBC__
- 
- #undef snprintf
- #undef vfscanf
package/gcc/4.7.4/850-libstdcxx-uclibc-c99.patch new file +273 -0

273 lines not on this page · raw message

Signature · 1 line
2.0.0
#2 lore raw

PATCH v2 2/7 gcc/4.8: add patch to enable more C++ features with uClibc

In reply to Thomas Petazzoni

This commit fixes bug #7250, by allowing more libstdc++ features to be enabled with uClibc. libstdc++ wants an absolutely complete C99 support in the C library before enabling *any* feature that needs some C99 functions. However, uClibc doesn't provide C99 complex numbers, so libstdc++ disables a lot of C++ standard methods, even though they are not related to C99 complex numbers.

A partial solution already existed in the patch 302-c99-snprintf.patch, but this commit replaces it by the more complete 850-libstdcxx-uclibc-c99.patch, which is highly inspired by
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58393, except that it doesn't rely on configure.ac checks, but simply on testing defined(__UCLIBC__) like was done in 302-c99-snprintf.patch. This allows to avoid having to autoreconf gcc, which is quite complicated to achieve.

---
 package/gcc/4.8.3/302-c99-snprintf.patch         |  13 --
 package/gcc/4.8.3/850-libstdcxx-uclibc-c99.patch | 273 +++++++++++++++++++++++
 2 files changed, 273 insertions(+), 13 deletions(-)
 delete mode 100644 package/gcc/4.8.3/302-c99-snprintf.patch
 create mode 100644 package/gcc/4.8.3/850-libstdcxx-uclibc-c99.patch
package/gcc/4.8.3/302-c99-snprintf.patch deleted +0 -13
deleted file mode 100644
index cd4d2cc..0000000
@@ -1,13 +0,0 @@
-Index: gcc-4.8.0/libstdc++-v3/include/c_global/cstdio
-===================================================================
---- gcc-4.8.0.orig/libstdc++-v3/include/c_global/cstdio	2013-02-03 18:54:05.000000000 +0100
-+++ gcc-4.8.0/libstdc++-v3/include/c_global/cstdio	2013-03-23 17:39:32.000000000 +0100
-@@ -138,7 +138,7 @@
-   using ::vsprintf;
- } // namespace
- 
--#if _GLIBCXX_USE_C99
-+#if _GLIBCXX_USE_C99 || defined __UCLIBC__
- 
- #undef snprintf
- #undef vfscanf
package/gcc/4.8.3/850-libstdcxx-uclibc-c99.patch new file +273 -0

273 lines not on this page · raw message

Signature · 1 line
2.0.0
#3 lore raw

PATCH v2 3/7 gcc/4.9: add patch to enable more C++ features with uClibc

In reply to Thomas Petazzoni

This commit fixes bug #7250, by allowing more libstdc++ features to be enabled with uClibc. libstdc++ wants an absolutely complete C99 support in the C library before enabling *any* feature that needs some C99 functions. However, uClibc doesn't provide C99 complex numbers, so libstdc++ disables a lot of C++ standard methods, even though they are not related to C99 complex numbers.

A partial solution already existed in the patch 302-c99-snprintf.patch, but this commit replaces it by the more complete 850-libstdcxx-uclibc-c99.patch, which is highly inspired by
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58393, except that it doesn't rely on configure.ac checks, but simply on testing defined(__UCLIBC__) like was done in 302-c99-snprintf.patch. This allows to avoid having to autoreconf gcc, which is quite complicated to achieve.

---
 package/gcc/4.9.1/302-c99-snprintf.patch         |  13 --
 package/gcc/4.9.1/850-libstdcxx-uclibc-c99.patch | 273 +++++++++++++++++++++++
 2 files changed, 273 insertions(+), 13 deletions(-)
 delete mode 100644 package/gcc/4.9.1/302-c99-snprintf.patch
 create mode 100644 package/gcc/4.9.1/850-libstdcxx-uclibc-c99.patch
package/gcc/4.9.1/302-c99-snprintf.patch deleted +0 -13
deleted file mode 100644
index cd4d2cc..0000000
@@ -1,13 +0,0 @@
-Index: gcc-4.8.0/libstdc++-v3/include/c_global/cstdio
-===================================================================
---- gcc-4.8.0.orig/libstdc++-v3/include/c_global/cstdio	2013-02-03 18:54:05.000000000 +0100
-+++ gcc-4.8.0/libstdc++-v3/include/c_global/cstdio	2013-03-23 17:39:32.000000000 +0100
-@@ -138,7 +138,7 @@
-   using ::vsprintf;
- } // namespace
- 
--#if _GLIBCXX_USE_C99
-+#if _GLIBCXX_USE_C99 || defined __UCLIBC__
- 
- #undef snprintf
- #undef vfscanf
package/gcc/4.9.1/850-libstdcxx-uclibc-c99.patch new file +273 -0

273 lines not on this page · raw message

Signature · 1 line
2.0.0
#4 lore raw

PATCH v2 4/7 gcc/arc-4.8-R3: add patch to enable more C++ features with uClibc

In reply to Thomas Petazzoni

This commit fixes bug #7250, by allowing more libstdc++ features to be enabled with uClibc. libstdc++ wants an absolutely complete C99 support in the C library before enabling *any* feature that needs some C99 functions. However, uClibc doesn't provide C99 complex numbers, so libstdc++ disables a lot of C++ standard methods, even though they are not related to C99 complex numbers.

A partial solution already existed in the patch 302-c99-snprintf.patch, but this commit replaces it by the more complete 850-libstdcxx-uclibc-c99.patch, which is highly inspired by
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58393, except that it doesn't rely on configure.ac checks, but simply on testing defined(__UCLIBC__) like was done in 302-c99-snprintf.patch. This allows to avoid having to autoreconf gcc, which is quite complicated to achieve.

---
 .../gcc/arc-4.8-R3/100-libstdcxx-uclibc-c99.patch  | 273 +++++++++++++++++++++
 1 file changed, 273 insertions(+)
 create mode 100644 package/gcc/arc-4.8-R3/100-libstdcxx-uclibc-c99.patch
package/gcc/arc-4.8-R3/100-libstdcxx-uclibc-c99.patch new file +273 -0
new file mode 100644
index 0000000..0d02ef0
@@ -0,0 +1,273 @@
+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 <[email protected]>
+
+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
+@@ -2811,7 +2811,7 @@
+ _GLIBCXX_END_NAMESPACE_VERSION
+ } // namespace
+ 
+-#if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \
++#if ((__cplusplus >= 201103L) && (defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)) \
+      && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))
+ 
+ #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
+@@ -987,7 +987,7 @@
+ 	char __fbuf[16];
+ 	__num_base::_S_format_float(__io, __fbuf, __mod);
+ 
+-#ifdef _GLIBCXX_USE_C99
++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
+ 	// First try a buffer perhaps big enough (most probably sufficient
+ 	// for non-ios_base::fixed outputs)
+ 	int __cs_size = __max_digits * 3;
+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
+@@ -572,7 +572,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
+@@ -182,7 +182,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
+@@ -139,7 +139,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
+@@ -180,7 +180,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
+@@ -2571,7 +2571,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
+@@ -787,7 +787,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
+@@ -138,7 +138,7 @@
+   using ::vsprintf;
+ } // namespace
+ 
+-#if _GLIBCXX_USE_C99
++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
+ 
+ #undef snprintf
+ #undef vfscanf
Signature · 1 line
2.0.0
#5 lore raw

PATCH v2 5/7 gcc/4.7: fix C++ exceptions and pthread_exit()

In reply to Thomas Petazzoni

Following the introduction of the support for the musl C library, the support of C++ exceptions or features like pthread_exit() got broken even with other libraries such as glibc. This was reported as bug

The problem was caused by the gcc patch needed to add support for musl, which modified the libgcc/unwind-dw2-fde-dip.c logic to decide whether USE_PT_GNU_EH_FRAME should be enabled or not. It completely removed the existing logic, replacing it by a single logic based on the definition of TARGET_DL_ITERATE_PHDR. However, this constant gets defined by the configure script only for Solaris, or Linux Musl platforms. For glibc/uClibc, the configure script does not define it, and therefore USE_PT_GNU_EH_FRAME is not defined, causing issues with exception handling.

This patch fixes that by restoring all the logic of libgcc/unwind-dw2-fde-dip.c, and just adding the musl logic as one more case.

It has been successfully runtime tested using the two code examples provided in bug #7208, with uClibc, musl and glibc.

Cc Krzysztof Wrzalik <[email protected]>
Cc David Bachelart <[email protected]>
---
 package/gcc/4.7.4/900-musl-support.patch | 61 ++++++++++++--------------------
 1 file changed, 23 insertions(+), 38 deletions(-)
package/gcc/4.7.4/900-musl-support.patch +23 -38
index fffb84a..1cb6701 100644
@@ -13,6 +13,12 @@ https://bitbucket.org/GregorR/musl-cross/src. Compared to the upstream version:
    causing build failure. Bug reported upstream at
    https://bitbucket.org/GregorR/musl-gcc-patches/issue/4/musl-gcc-patches-break-the-build-on.
 
+ * change the USE_PT_GNU_EH_FRAME logic to keep the existing gcc logic
+   and only add the musl one as an addition, not as a replacement. Not
+   doing this breaks C++ exception handling with glibc, because
+   USE_PT_GNU_EH_FRAME doesn't get defined due to the configure script
+   not testing dl_iterate_phdr() on any system except Solaris.
+
 Signed-off-by: Thomas Petazzoni <[email protected]>
 ---
 
@@ -71,7 +77,7 @@ Index: b/gcc/config.gcc
      *)
        tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
        ;;
-@@ -2092,6 +2095,10 @@
+@@ -2091,6 +2094,10 @@
  	    powerpc*-*-linux*paired*)
  		tm_file="${tm_file} rs6000/750cl.h" ;;
  	esac
@@ -299,46 +305,25 @@ Index: b/libgcc/unwind-dw2-fde-dip.c
 ===================================================================
 --- a/libgcc/unwind-dw2-fde-dip.c
 +++ b/libgcc/unwind-dw2-fde-dip.c
-@@ -47,28 +47,13 @@
- #include "unwind-compat.h"
- #include "gthr.h"
- 
--#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--    && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
--	|| (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
--# define USE_PT_GNU_EH_FRAME
--#endif
--
--#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--    && defined(__FreeBSD__) && __FreeBSD__ >= 7
--# define ElfW __ElfN
--# define USE_PT_GNU_EH_FRAME
--#endif
--
--#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--    && defined(__OpenBSD__)
--# define ElfW(type) Elf_##type
--# define USE_PT_GNU_EH_FRAME
--#endif
--
--#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--    && defined(TARGET_DL_ITERATE_PHDR) \
--    && defined(__sun__) && defined(__svr4__)
-+#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR)
+@@ -71,6 +71,13 @@
  # define USE_PT_GNU_EH_FRAME
-+# ifdef __OpenBSD__
-+#  define ElfW(type) Elf_##typ
-+# elif defined(__FreeBSD__) && __FreeBSD__ >= 7
-+#  define ElfW __ElfN
-+# endif
  #endif
  
++/* For musl libc, TARGET_DL_ITERATE_PHDR gets defined by the configure
++   script. */
++#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
++    && defined(TARGET_DL_ITERATE_PHDR)
++# define USE_PT_GNU_EH_FRAME
++#endif
++
  #if defined(USE_PT_GNU_EH_FRAME)
+ 
+ #include <link.h>
 Index: b/gcc/configure
 ===================================================================
 --- a/gcc/configure
 +++ b/gcc/configure
-@@ -26787,6 +26787,9 @@
+@@ -26791,6 +26791,9 @@
  else
    gcc_cv_libc_provides_ssp=no
      case "$target" in
@@ -348,7 +333,7 @@ Index: b/gcc/configure
         *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
        # glibc 2.4 and later provides __stack_chk_fail and
        # either __stack_chk_guard, or TLS access to stack guard canary.
-@@ -26820,6 +26823,7 @@
+@@ -26824,6 +26827,7 @@
  	 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
  	 # simply assert that glibc does provide this, which is true for all
  	 # realistically usable GNU/Hurd configurations.
@@ -356,7 +341,7 @@ Index: b/gcc/configure
  	 gcc_cv_libc_provides_ssp=yes;;
         *-*-darwin* | *-*-freebsd*)
  	 ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
-@@ -26902,6 +26906,9 @@
+@@ -26906,6 +26910,9 @@
        gcc_cv_target_dl_iterate_phdr=no
      fi
      ;;
@@ -370,7 +355,7 @@ Index: b/gcc/configure.ac
 ===================================================================
 --- a/gcc/configure.ac
 +++ b/gcc/configure.ac
-@@ -4664,6 +4664,9 @@
+@@ -4669,6 +4669,9 @@
        gcc_cv_libc_provides_ssp,
        [gcc_cv_libc_provides_ssp=no
      case "$target" in
@@ -380,7 +365,7 @@ Index: b/gcc/configure.ac
         *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
        [# glibc 2.4 and later provides __stack_chk_fail and
        # either __stack_chk_guard, or TLS access to stack guard canary.
-@@ -4697,6 +4700,7 @@
+@@ -4702,6 +4705,7 @@
  	 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
  	 # simply assert that glibc does provide this, which is true for all
  	 # realistically usable GNU/Hurd configurations.
@@ -388,7 +373,7 @@ Index: b/gcc/configure.ac
  	 gcc_cv_libc_provides_ssp=yes;;
         *-*-darwin* | *-*-freebsd*)
  	 AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
-@@ -4762,6 +4766,9 @@
+@@ -4767,6 +4771,9 @@
        gcc_cv_target_dl_iterate_phdr=no
      fi
      ;;
Signature · 1 line
2.0.0
#6 lore raw

PATCH v2 5/7 gcc/4.7: fix C++ exceptions and pthread_exit()

Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Following the introduction of the support for the musl C library, the support of C++ exceptions or features like pthread_exit() got broken even with other libraries such as glibc. This was reported as bug

Git commit just ate your '#7028' here as it thought it was a comment. I've fixed it while committing.

Signature · 1 line
Bye, Peter Korsgaard
#7 lore raw

PATCH v2 5/7 gcc/4.7: fix C++ exceptions and pthread_exit()

Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

"Peter" == Peter Korsgaard <[email protected]> writes:

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Following the introduction of the support for the musl C library, the support of C++ exceptions or features like pthread_exit() got broken even with other libraries such as glibc. This was reported as bug

Git commit just ate your '#7028' here as it thought it was a comment. I've fixed it while committing.

Argh, it should have been #7208 instead :/ Sorry.

Signature · 1 line
Bye, Peter Korsgaard
#8 lore raw

PATCH v2 6/7 gcc/4.8: fix C++ exceptions and pthread_exit()

In reply to Thomas Petazzoni

Following the introduction of the support for the musl C library, the support of C++ exceptions or features like pthread_exit() got broken even with other libraries such as glibc. This was reported as bug

The problem was caused by the gcc patch needed to add support for musl, which modified the libgcc/unwind-dw2-fde-dip.c logic to decide whether USE_PT_GNU_EH_FRAME should be enabled or not. It completely removed the existing logic, replacing it by a single logic based on the definition of TARGET_DL_ITERATE_PHDR. However, this constant gets defined by the configure script only for Solaris, or Linux Musl platforms. For glibc/uClibc, the configure script does not define it, and therefore USE_PT_GNU_EH_FRAME is not defined, causing issues with exception handling.

This patch fixes that by restoring all the logic of libgcc/unwind-dw2-fde-dip.c, and just adding the musl logic as one more case.

It has been successfully runtime tested using the two code examples provided in bug #7208, with uClibc, musl and glibc.

Cc Krzysztof Wrzalik <[email protected]>
Cc David Bachelart <[email protected]>
---
 package/gcc/4.8.3/900-musl-support.patch | 213 ++++++++++++++++---------------
 1 file changed, 108 insertions(+), 105 deletions(-)
package/gcc/4.8.3/900-musl-support.patch +108 -105
index 55b0144..761f018 100644
@@ -13,12 +13,19 @@ https://bitbucket.org/GregorR/musl-cross/src. Compared to the upstream version:
    causing build failure. Bug reported upstream at
    https://bitbucket.org/GregorR/musl-gcc-patches/issue/4/musl-gcc-patches-break-the-build-on.
 
+ * change the USE_PT_GNU_EH_FRAME logic to keep the existing gcc logic
+   and only add the musl one as an addition, not as a replacement. Not
+   doing this breaks C++ exception handling with glibc, because
+   USE_PT_GNU_EH_FRAME doesn't get defined due to the configure script
+   not testing dl_iterate_phdr() on any system except Solaris.
+
 Signed-off-by: Thomas Petazzoni <[email protected]>
 [Gustavo: Update for gcc 4.8.3]
 
-diff -Nura gcc-4.8.3/fixincludes/mkfixinc.sh gcc-4.8.3-musl/fixincludes/mkfixinc.sh
---- gcc-4.8.3/fixincludes/mkfixinc.sh	2012-10-28 18:42:48.000000000 -0300
-+++ gcc-4.8.3-musl/fixincludes/mkfixinc.sh	2014-05-22 15:07:17.966799753 -0300
+Index: b/fixincludes/mkfixinc.sh
+===================================================================
+--- a/fixincludes/mkfixinc.sh
++++ b/fixincludes/mkfixinc.sh
 @@ -19,7 +19,8 @@
      powerpc-*-eabi*    | \
      powerpc-*-rtems*   | \
@@ -29,9 +36,10 @@ diff -Nura gcc-4.8.3/fixincludes/mkfixinc.sh gcc-4.8.3-musl/fixincludes/mkfixinc
  	#  IF there is no include fixing,
  	#  THEN create a no-op fixer and exit
  	(echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
-diff -Nura gcc-4.8.3/gcc/config/aarch64/aarch64-linux.h gcc-4.8.3-musl/gcc/config/aarch64/aarch64-linux.h
---- gcc-4.8.3/gcc/config/aarch64/aarch64-linux.h	2013-08-13 10:22:18.000000000 -0300
-+++ gcc-4.8.3-musl/gcc/config/aarch64/aarch64-linux.h	2014-05-22 15:07:17.967799807 -0300
+Index: b/gcc/config/aarch64/aarch64-linux.h
+===================================================================
+--- a/gcc/config/aarch64/aarch64-linux.h
++++ b/gcc/config/aarch64/aarch64-linux.h
 @@ -21,7 +21,12 @@
  #ifndef GCC_AARCH64_LINUX_H
  #define GCC_AARCH64_LINUX_H
@@ -45,9 +53,10 @@ diff -Nura gcc-4.8.3/gcc/config/aarch64/aarch64-linux.h gcc-4.8.3-musl/gcc/confi
  
  #define CPP_SPEC "%{pthread:-D_REENTRANT}"
  
-diff -Nura gcc-4.8.3/gcc/config/arm/linux-eabi.h gcc-4.8.3-musl/gcc/config/arm/linux-eabi.h
---- gcc-4.8.3/gcc/config/arm/linux-eabi.h	2013-01-10 17:38:27.000000000 -0300
-+++ gcc-4.8.3-musl/gcc/config/arm/linux-eabi.h	2014-05-22 15:07:17.968799848 -0300
+Index: b/gcc/config/arm/linux-eabi.h
+===================================================================
+--- a/gcc/config/arm/linux-eabi.h
++++ b/gcc/config/arm/linux-eabi.h
 @@ -77,6 +77,23 @@
      %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
      %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
@@ -72,9 +81,10 @@ diff -Nura gcc-4.8.3/gcc/config/arm/linux-eabi.h gcc-4.8.3-musl/gcc/config/arm/l
  /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
     use the GNU/Linux version, not the generic BPABI version.  */
  #undef  LINK_SPEC
-diff -Nura gcc-4.8.3/gcc/config/i386/linux64.h gcc-4.8.3-musl/gcc/config/i386/linux64.h
---- gcc-4.8.3/gcc/config/i386/linux64.h	2013-01-10 17:38:27.000000000 -0300
-+++ gcc-4.8.3-musl/gcc/config/i386/linux64.h	2014-05-22 15:07:17.968799848 -0300
+Index: b/gcc/config/i386/linux64.h
+===================================================================
+--- a/gcc/config/i386/linux64.h
++++ b/gcc/config/i386/linux64.h
 @@ -30,3 +30,10 @@
  #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
  #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
@@ -86,18 +96,20 @@ diff -Nura gcc-4.8.3/gcc/config/i386/linux64.h gcc-4.8.3-musl/gcc/config/i386/li
 +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
 +#undef MUSL_DYNAMIC_LINKERX32
 +#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
-diff -Nura gcc-4.8.3/gcc/config/i386/linux.h gcc-4.8.3-musl/gcc/config/i386/linux.h
---- gcc-4.8.3/gcc/config/i386/linux.h	2013-01-10 17:38:27.000000000 -0300
-+++ gcc-4.8.3-musl/gcc/config/i386/linux.h	2014-05-22 15:07:17.968799848 -0300
+Index: b/gcc/config/i386/linux.h
+===================================================================
+--- a/gcc/config/i386/linux.h
++++ b/gcc/config/i386/linux.h
 @@ -21,3 +21,5 @@
  
  #define GNU_USER_LINK_EMULATION "elf_i386"
  #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
 +#undef MUSL_DYNAMIC_LINKER
 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
-diff -Nura gcc-4.8.3/gcc/config/linux.h gcc-4.8.3-musl/gcc/config/linux.h
---- gcc-4.8.3/gcc/config/linux.h	2013-01-10 17:38:27.000000000 -0300
-+++ gcc-4.8.3-musl/gcc/config/linux.h	2014-05-22 15:07:17.968799848 -0300
+Index: b/gcc/config/linux.h
+===================================================================
+--- a/gcc/config/linux.h
++++ b/gcc/config/linux.h
 @@ -32,10 +32,12 @@
  #define OPTION_GLIBC  (DEFAULT_LIBC == LIBC_GLIBC)
  #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
@@ -254,9 +266,10 @@ diff -Nura gcc-4.8.3/gcc/config/linux.h gcc-4.8.3-musl/gcc/config/linux.h
 +    { 0, 0, 0, 0, 0, 0 }				\
 +  }
 +#endif
-diff -Nura gcc-4.8.3/gcc/config/linux.opt gcc-4.8.3-musl/gcc/config/linux.opt
---- gcc-4.8.3/gcc/config/linux.opt	2013-01-10 17:38:27.000000000 -0300
-+++ gcc-4.8.3-musl/gcc/config/linux.opt	2014-05-22 15:07:17.969799879 -0300
+Index: b/gcc/config/linux.opt
+===================================================================
+--- a/gcc/config/linux.opt
++++ b/gcc/config/linux.opt
 @@ -30,3 +30,7 @@
  muclibc
  Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
@@ -265,9 +278,10 @@ diff -Nura gcc-4.8.3/gcc/config/linux.opt gcc-4.8.3-musl/gcc/config/linux.opt
 +mmusl
 +Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
 +Use musl C library
-diff -Nura gcc-4.8.3/gcc/config/microblaze/linux.h gcc-4.8.3-musl/gcc/config/microblaze/linux.h
---- gcc-4.8.3/gcc/config/microblaze/linux.h	2013-03-14 12:43:23.000000000 -0300
-+++ gcc-4.8.3-musl/gcc/config/microblaze/linux.h	2014-05-22 15:07:17.969799879 -0300
+Index: b/gcc/config/microblaze/linux.h
+===================================================================
+--- a/gcc/config/microblaze/linux.h
++++ b/gcc/config/microblaze/linux.h
 @@ -25,7 +25,23 @@
  #undef TLS_NEEDS_GOT
  #define TLS_NEEDS_GOT 1
@@ -293,18 +307,20 @@ diff -Nura gcc-4.8.3/gcc/config/microblaze/linux.h gcc-4.8.3-musl/gcc/config/mic
  #undef  SUBTARGET_EXTRA_SPECS
  #define SUBTARGET_EXTRA_SPECS \
    { "dynamic_linker", DYNAMIC_LINKER }
-diff -Nura gcc-4.8.3/gcc/config/mips/linux64.h gcc-4.8.3-musl/gcc/config/mips/linux64.h
---- gcc-4.8.3/gcc/config/mips/linux64.h	2013-01-10 17:38:27.000000000 -0300
-+++ gcc-4.8.3-musl/gcc/config/mips/linux64.h	2014-05-22 15:07:52.473979031 -0300
+Index: b/gcc/config/mips/linux64.h
+===================================================================
+--- a/gcc/config/mips/linux64.h
++++ b/gcc/config/mips/linux64.h
 @@ -29,4 +29,4 @@
  #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
  #define GNU_USER_DYNAMIC_LINKERN32 \
    CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
 -			 BIONIC_DYNAMIC_LINKERN32)
 +			 BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKER)
-diff -Nura gcc-4.8.3/gcc/config/mips/linux.h gcc-4.8.3-musl/gcc/config/mips/linux.h
---- gcc-4.8.3/gcc/config/mips/linux.h	2013-01-10 17:38:27.000000000 -0300
-+++ gcc-4.8.3-musl/gcc/config/mips/linux.h	2014-05-22 15:07:52.455978418 -0300
+Index: b/gcc/config/mips/linux.h
+===================================================================
+--- a/gcc/config/mips/linux.h
++++ b/gcc/config/mips/linux.h
 @@ -18,3 +18,11 @@
  <http://www.gnu.org/licenses/>.  */
  
@@ -317,9 +333,10 @@ diff -Nura gcc-4.8.3/gcc/config/mips/linux.h gcc-4.8.3-musl/gcc/config/mips/linu
 +#endif
 +#undef MUSL_DYNAMIC_LINKER
 +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E ".so.1"
-diff -Nura gcc-4.8.3/gcc/config/rs6000/linux64.h gcc-4.8.3-musl/gcc/config/rs6000/linux64.h
---- gcc-4.8.3/gcc/config/rs6000/linux64.h	2014-04-04 12:10:24.000000000 -0300
-+++ gcc-4.8.3-musl/gcc/config/rs6000/linux64.h	2014-05-22 15:07:52.455978418 -0300
+Index: b/gcc/config/rs6000/linux64.h
+===================================================================
+--- a/gcc/config/rs6000/linux64.h
++++ b/gcc/config/rs6000/linux64.h
 @@ -374,17 +374,23 @@
  #endif
  #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
@@ -348,17 +365,19 @@ diff -Nura gcc-4.8.3/gcc/config/rs6000/linux64.h gcc-4.8.3-musl/gcc/config/rs600
  
  #undef  DEFAULT_ASM_ENDIAN
  #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
-diff -Nura gcc-4.8.3/gcc/config/rs6000/secureplt.h gcc-4.8.3-musl/gcc/config/rs6000/secureplt.h
---- gcc-4.8.3/gcc/config/rs6000/secureplt.h	2013-01-10 17:38:27.000000000 -0300
-+++ gcc-4.8.3-musl/gcc/config/rs6000/secureplt.h	2014-05-22 15:07:52.455978418 -0300
+Index: b/gcc/config/rs6000/secureplt.h
+===================================================================
+--- a/gcc/config/rs6000/secureplt.h
++++ b/gcc/config/rs6000/secureplt.h
 @@ -18,3 +18,4 @@
  <http://www.gnu.org/licenses/>.  */
  
  #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
 +#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
-diff -Nura gcc-4.8.3/gcc/config/rs6000/sysv4.h gcc-4.8.3-musl/gcc/config/rs6000/sysv4.h
---- gcc-4.8.3/gcc/config/rs6000/sysv4.h	2014-04-04 11:50:31.000000000 -0300
-+++ gcc-4.8.3-musl/gcc/config/rs6000/sysv4.h	2014-05-22 15:07:52.456978446 -0300
+Index: b/gcc/config/rs6000/sysv4.h
+===================================================================
+--- a/gcc/config/rs6000/sysv4.h
++++ b/gcc/config/rs6000/sysv4.h
 @@ -537,6 +537,9 @@
  #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
  #define CC1_SECURE_PLT_DEFAULT_SPEC ""
@@ -409,9 +428,10 @@ diff -Nura gcc-4.8.3/gcc/config/rs6000/sysv4.h gcc-4.8.3-musl/gcc/config/rs6000/
    { "cpp_os_ads",		CPP_OS_ADS_SPEC },			\
    { "cpp_os_yellowknife",	CPP_OS_YELLOWKNIFE_SPEC },		\
    { "cpp_os_mvme",		CPP_OS_MVME_SPEC },			\
-diff -Nura gcc-4.8.3/gcc/config/sh/linux.h gcc-4.8.3-musl/gcc/config/sh/linux.h
---- gcc-4.8.3/gcc/config/sh/linux.h	2013-03-14 00:01:53.000000000 -0300
-+++ gcc-4.8.3-musl/gcc/config/sh/linux.h	2014-05-22 15:07:52.456978446 -0300
+Index: b/gcc/config/sh/linux.h
+===================================================================
+--- a/gcc/config/sh/linux.h
++++ b/gcc/config/sh/linux.h
 @@ -43,7 +43,15 @@
  
  #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
@@ -428,9 +448,10 @@ diff -Nura gcc-4.8.3/gcc/config/sh/linux.h gcc-4.8.3-musl/gcc/config/sh/linux.h
  
  #undef SUBTARGET_LINK_EMUL_SUFFIX
  #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
-diff -Nura gcc-4.8.3/gcc/config.gcc gcc-4.8.3-musl/gcc/config.gcc
---- gcc-4.8.3/gcc/config.gcc	2014-05-06 12:29:04.000000000 -0300
-+++ gcc-4.8.3-musl/gcc/config.gcc	2014-05-22 15:07:17.967799807 -0300
+Index: b/gcc/config.gcc
+===================================================================
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
 @@ -550,7 +550,7 @@
  esac
  
@@ -461,9 +482,10 @@ diff -Nura gcc-4.8.3/gcc/config.gcc gcc-4.8.3-musl/gcc/config.gcc
  	if test x${enable_secureplt} = xyes; then
  		tm_file="rs6000/secureplt.h ${tm_file}"
  	fi
-diff -Nura gcc-4.8.3/gcc/configure gcc-4.8.3-musl/gcc/configure
---- gcc-4.8.3/gcc/configure	2014-04-28 07:05:29.000000000 -0300
-+++ gcc-4.8.3-musl/gcc/configure	2014-05-22 15:07:52.469978896 -0300
+Index: b/gcc/configure
+===================================================================
+--- a/gcc/configure
++++ b/gcc/configure
 @@ -26821,6 +26821,9 @@
  else
    gcc_cv_libc_provides_ssp=no
@@ -492,9 +514,10 @@ diff -Nura gcc-4.8.3/gcc/configure gcc-4.8.3-musl/gcc/configure
  esac
  
  if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
-diff -Nura gcc-4.8.3/gcc/configure.ac gcc-4.8.3-musl/gcc/configure.ac
---- gcc-4.8.3/gcc/configure.ac	2014-04-28 07:05:29.000000000 -0300
-+++ gcc-4.8.3-musl/gcc/configure.ac	2014-05-22 15:07:52.471978964 -0300
+Index: b/gcc/configure.ac
+===================================================================
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
 @@ -4750,6 +4750,9 @@
        gcc_cv_libc_provides_ssp,
        [gcc_cv_libc_provides_ssp=no
@@ -523,9 +546,10 @@ diff -Nura gcc-4.8.3/gcc/configure.ac gcc-4.8.3-musl/gcc/configure.ac
  esac
  GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
  if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
-diff -Nura gcc-4.8.3/gcc/ginclude/stddef.h gcc-4.8.3-musl/gcc/ginclude/stddef.h
---- gcc-4.8.3/gcc/ginclude/stddef.h	2013-01-10 17:38:27.000000000 -0300
-+++ gcc-4.8.3-musl/gcc/ginclude/stddef.h	2014-05-22 15:07:52.472978998 -0300
+Index: b/gcc/ginclude/stddef.h
+===================================================================
+--- a/gcc/ginclude/stddef.h
++++ b/gcc/ginclude/stddef.h
 @@ -181,6 +181,7 @@
  #ifndef _GCC_SIZE_T
  #ifndef _SIZET_
@@ -550,52 +574,28 @@ diff -Nura gcc-4.8.3/gcc/ginclude/stddef.h gcc-4.8.3-musl/gcc/ginclude/stddef.h
  #endif /* __size_t */
  #endif /* _SIZET_ */
  #endif /* _GCC_SIZE_T */
-diff -Nura gcc-4.8.3/libgcc/unwind-dw2-fde-dip.c gcc-4.8.3-musl/libgcc/unwind-dw2-fde-dip.c
---- gcc-4.8.3/libgcc/unwind-dw2-fde-dip.c	2013-02-04 16:06:20.000000000 -0300
-+++ gcc-4.8.3-musl/libgcc/unwind-dw2-fde-dip.c	2014-05-22 15:07:52.472978998 -0300
-@@ -46,33 +46,13 @@
- #include "unwind-compat.h"
- #include "gthr.h"
- 
--#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--    && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
--	|| (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
--# define USE_PT_GNU_EH_FRAME
--#endif
--
--#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--    && defined(__BIONIC__)
--# define USE_PT_GNU_EH_FRAME
--#endif
--
--#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--    && defined(__FreeBSD__) && __FreeBSD__ >= 7
--# define ElfW __ElfN
--# define USE_PT_GNU_EH_FRAME
--#endif
--
--#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--    && defined(__OpenBSD__)
--# define ElfW(type) Elf_##type
--# define USE_PT_GNU_EH_FRAME
--#endif
--
--#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--    && defined(TARGET_DL_ITERATE_PHDR) \
--    && defined(__sun__) && defined(__svr4__)
-+#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR)
+Index: b/libgcc/unwind-dw2-fde-dip.c
+===================================================================
+--- a/libgcc/unwind-dw2-fde-dip.c
++++ b/libgcc/unwind-dw2-fde-dip.c
+@@ -75,6 +75,13 @@
  # define USE_PT_GNU_EH_FRAME
-+# ifdef __OpenBSD__
-+#  define ElfW(type) Elf_##type
-+# elif defined(__FreeBSD__) && __FreeBSD__ >= 7
-+#  define ElfW __ElfN
-+# endif
  #endif
  
++/* For musl libc, TARGET_DL_ITERATE_PHDR gets defined by the configure
++   script. */
++#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
++    && defined(TARGET_DL_ITERATE_PHDR)
++# define USE_PT_GNU_EH_FRAME
++#endif
++
  #if defined(USE_PT_GNU_EH_FRAME)
-diff -Nura gcc-4.8.3/libgomp/config/posix/time.c gcc-4.8.3-musl/libgomp/config/posix/time.c
---- gcc-4.8.3/libgomp/config/posix/time.c	2013-01-14 15:18:49.000000000 -0300
-+++ gcc-4.8.3-musl/libgomp/config/posix/time.c	2014-05-22 15:07:52.472978998 -0300
+ 
+ #include <link.h>
+Index: b/libgomp/config/posix/time.c
+===================================================================
+--- a/libgomp/config/posix/time.c
++++ b/libgomp/config/posix/time.c
 @@ -28,6 +28,8 @@
     The following implementation uses the most simple POSIX routines.
     If present, POSIX 4 clocks should be used instead.  */
@@ -605,9 +605,10 @@ diff -Nura gcc-4.8.3/libgomp/config/posix/time.c gcc-4.8.3-musl/libgomp/config/p
  #include "libgomp.h"
  #include <unistd.h>
  #if TIME_WITH_SYS_TIME
-diff -Nura gcc-4.8.3/libitm/config/arm/hwcap.cc gcc-4.8.3-musl/libitm/config/arm/hwcap.cc
---- gcc-4.8.3/libitm/config/arm/hwcap.cc	2013-02-03 14:46:11.000000000 -0300
-+++ gcc-4.8.3-musl/libitm/config/arm/hwcap.cc	2014-05-22 15:07:52.473979031 -0300
+Index: b/libitm/config/arm/hwcap.cc
+===================================================================
+--- a/libitm/config/arm/hwcap.cc
++++ b/libitm/config/arm/hwcap.cc
 @@ -40,7 +40,11 @@
  
  #ifdef __linux__
@@ -620,9 +621,10 @@ diff -Nura gcc-4.8.3/libitm/config/arm/hwcap.cc gcc-4.8.3-musl/libitm/config/arm
  #include <elf.h>
  
  static void __attribute__((constructor))
-diff -Nura gcc-4.8.3/libitm/config/linux/x86/tls.h gcc-4.8.3-musl/libitm/config/linux/x86/tls.h
---- gcc-4.8.3/libitm/config/linux/x86/tls.h	2013-02-03 14:46:11.000000000 -0300
-+++ gcc-4.8.3-musl/libitm/config/linux/x86/tls.h	2014-05-22 15:07:52.473979031 -0300
+Index: b/libitm/config/linux/x86/tls.h
+===================================================================
+--- a/libitm/config/linux/x86/tls.h
++++ b/libitm/config/linux/x86/tls.h
 @@ -25,16 +25,19 @@
  #ifndef LIBITM_X86_TLS_H
  #define LIBITM_X86_TLS_H 1
@@ -652,9 +654,10 @@ diff -Nura gcc-4.8.3/libitm/config/linux/x86/tls.h gcc-4.8.3-musl/libitm/config/
 +#endif
  
  #endif // LIBITM_X86_TLS_H
-diff -Nura gcc-4.8.3/libstdc++-v3/configure.host gcc-4.8.3-musl/libstdc++-v3/configure.host
---- gcc-4.8.3/libstdc++-v3/configure.host	2013-06-18 22:18:38.000000000 -0300
-+++ gcc-4.8.3-musl/libstdc++-v3/configure.host	2014-05-22 15:07:52.473979031 -0300
+Index: b/libstdc++-v3/configure.host
+===================================================================
+--- a/libstdc++-v3/configure.host
++++ b/libstdc++-v3/configure.host
 @@ -264,6 +264,13 @@
      os_include_dir="os/bsd/freebsd"
      ;;
Signature · 1 line
2.0.0
#9 lore raw

PATCH v2 7/7 gcc/4.9: fix C++ exceptions and pthread_exit()

In reply to Thomas Petazzoni

Following the introduction of the support for the musl C library, the support of C++ exceptions or features like pthread_exit() got broken even with other libraries such as glibc. This was reported as bug

The problem was caused by the gcc patch needed to add support for musl, which modified the libgcc/unwind-dw2-fde-dip.c logic to decide whether USE_PT_GNU_EH_FRAME should be enabled or not. It completely removed the existing logic, replacing it by a single logic based on the definition of TARGET_DL_ITERATE_PHDR. However, this constant gets defined by the configure script only for Solaris, or Linux Musl platforms. For glibc/uClibc, the configure script does not define it, and therefore USE_PT_GNU_EH_FRAME is not defined, causing issues with exception handling.

This patch fixes that by restoring all the logic of libgcc/unwind-dw2-fde-dip.c, and just adding the musl logic as one more case.

It has been successfully runtime tested using the two code examples provided in bug #7208, with uClibc, musl and glibc.

Cc Krzysztof Wrzalik <[email protected]>
Cc David Bachelart <[email protected]>
---
 package/gcc/4.9.1/900-musl-support.patch | 66 +++++++++++---------------------
 1 file changed, 23 insertions(+), 43 deletions(-)
package/gcc/4.9.1/900-musl-support.patch +23 -43
index 5b3dfa5..56502b8 100644
@@ -13,6 +13,12 @@ https://bitbucket.org/GregorR/musl-cross/src. Compared to the upstream version:
    causing build failure. Bug reported upstream at
    https://bitbucket.org/GregorR/musl-gcc-patches/issue/4/musl-gcc-patches-break-the-build-on.
 
+ * change the USE_PT_GNU_EH_FRAME logic to keep the existing gcc logic
+   and only add the musl one as an addition, not as a replacement. Not
+   doing this breaks C++ exception handling with glibc, because
+   USE_PT_GNU_EH_FRAME doesn't get defined due to the configure script
+   not testing dl_iterate_phdr() on any system except Solaris.
+
 [Gustavo: remove upstream applied gcc/config/sh/sh.c chunk for 4.9.1]
 Signed-off-by: Thomas Petazzoni <[email protected]>
 ---
@@ -54,7 +60,7 @@ Index: b/gcc/config.gcc
      *)
        tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
        ;;
-@@ -2323,6 +2326,10 @@
+@@ -2322,6 +2325,10 @@
  	    powerpc*-*-linux*paired*)
  		tm_file="${tm_file} rs6000/750cl.h" ;;
  	esac
@@ -446,7 +452,7 @@ Index: b/gcc/configure
 ===================================================================
 --- a/gcc/configure
 +++ b/gcc/configure
-@@ -27300,6 +27300,9 @@
+@@ -27328,6 +27328,9 @@
  else
    gcc_cv_libc_provides_ssp=no
      case "$target" in
@@ -456,7 +462,7 @@ Index: b/gcc/configure
         *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
        # glibc 2.4 and later provides __stack_chk_fail and
        # either __stack_chk_guard, or TLS access to stack guard canary.
-@@ -27332,6 +27335,7 @@
+@@ -27360,6 +27363,7 @@
  	 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
  	 # simply assert that glibc does provide this, which is true for all
  	 # realistically usable GNU/Hurd configurations.
@@ -464,7 +470,7 @@ Index: b/gcc/configure
  	 gcc_cv_libc_provides_ssp=yes;;
         *-*-darwin* | *-*-freebsd*)
  	 ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
-@@ -27421,6 +27425,9 @@
+@@ -27449,6 +27453,9 @@
        gcc_cv_target_dl_iterate_phdr=no
      fi
      ;;
@@ -478,7 +484,7 @@ Index: b/gcc/configure.ac
 ===================================================================
 --- a/gcc/configure.ac
 +++ b/gcc/configure.ac
-@@ -5001,6 +5001,9 @@
+@@ -5016,6 +5016,9 @@
        gcc_cv_libc_provides_ssp,
        [gcc_cv_libc_provides_ssp=no
      case "$target" in
@@ -488,7 +494,7 @@ Index: b/gcc/configure.ac
         *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
        # glibc 2.4 and later provides __stack_chk_fail and
        # either __stack_chk_guard, or TLS access to stack guard canary.
-@@ -5027,6 +5030,7 @@
+@@ -5042,6 +5045,7 @@
  	 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
  	 # simply assert that glibc does provide this, which is true for all
  	 # realistically usable GNU/Hurd configurations.
@@ -496,7 +502,7 @@ Index: b/gcc/configure.ac
  	 gcc_cv_libc_provides_ssp=yes;;
         *-*-darwin* | *-*-freebsd*)
  	 AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
-@@ -5093,6 +5097,9 @@
+@@ -5108,6 +5112,9 @@
        gcc_cv_target_dl_iterate_phdr=no
      fi
      ;;
@@ -538,43 +544,17 @@ Index: b/libgcc/unwind-dw2-fde-dip.c
 ===================================================================
 --- a/libgcc/unwind-dw2-fde-dip.c
 +++ b/libgcc/unwind-dw2-fde-dip.c
-@@ -46,33 +46,13 @@
- #include "unwind-compat.h"
- #include "gthr.h"
- 
--#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--    && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
--	|| (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
--# define USE_PT_GNU_EH_FRAME
--#endif
--
--#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--    && defined(__BIONIC__)
--# define USE_PT_GNU_EH_FRAME
--#endif
--
--#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--    && defined(__FreeBSD__) && __FreeBSD__ >= 7
--# define ElfW __ElfN
--# define USE_PT_GNU_EH_FRAME
--#endif
--
--#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--    && defined(__OpenBSD__)
--# define ElfW(type) Elf_##type
--# define USE_PT_GNU_EH_FRAME
--#endif
--
--#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
--    && defined(TARGET_DL_ITERATE_PHDR) \
--    && defined(__sun__) && defined(__svr4__)
-+#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR)
+@@ -73,6 +73,13 @@
+     && defined(TARGET_DL_ITERATE_PHDR) \
+     && defined(__sun__) && defined(__svr4__)
  # define USE_PT_GNU_EH_FRAME
-+# ifdef __OpenBSD__
-+#  define ElfW(type) Elf_##type
-+# elif defined(__FreeBSD__) && __FreeBSD__ >= 7
-+#  define ElfW __ElfN
-+# endif
++ #endif
++
++/* For musl libc, TARGET_DL_ITERATE_PHDR gets defined by the configure
++   script. */
++#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR)	\
++  && defined(TARGET_DL_ITERATE_PHDR)
++# define USE_PT_GNU_EH_FRAME
  #endif
  
  #if defined(USE_PT_GNU_EH_FRAME)
Signature · 1 line
2.0.0
#10 lore raw

v2 cover Toolchain fixes

In reply to Thomas Petazzoni
Quoted 17 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hello,
Here is a new version of the patch series with toolchain fixes. It fixes bugs #7208 and #7250. Changes since v1:

- Fix minor typo noticed by Thomas DS in the commit log of the first four patches.

- Add three patches to fix bug #7208.

Those patches are aimed for 2014.08.

Thanks,

Thomas

Quoted 8 lines

Thomas Petazzoni (7):
gcc/4.7: add patch to enable more C++ features with uClibc gcc/4.8: add patch to enable more C++ features with uClibc gcc/4.9: add patch to enable more C++ features with uClibc gcc/arc-4.8-R3: add patch to enable more C++ features with uClibc gcc/4.7: fix C++ exceptions and pthread_exit() gcc/4.8: fix C++ exceptions and pthread_exit() gcc/4.9: fix C++ exceptions and pthread_exit()

Committed series, thanks!

Quoted 26 lines
 package/gcc/4.7.4/302-c99-snprintf.patch           |  13 -
 package/gcc/4.7.4/850-libstdcxx-uclibc-c99.patch   | 273 +++++++++++++++++++++
 package/gcc/4.7.4/900-musl-support.patch           |  61 ++---
 package/gcc/4.8.3/302-c99-snprintf.patch           |  13 -
 package/gcc/4.8.3/850-libstdcxx-uclibc-c99.patch   | 273 +++++++++++++++++++++
 package/gcc/4.8.3/900-musl-support.patch           | 213 ++++++++--------
 package/gcc/4.9.1/302-c99-snprintf.patch           |  13 -
 package/gcc/4.9.1/850-libstdcxx-uclibc-c99.patch   | 273 +++++++++++++++++++++
 package/gcc/4.9.1/900-musl-support.patch           |  66 ++---
 .../gcc/arc-4.8-R3/100-libstdcxx-uclibc-c99.patch  | 273 +++++++++++++++++++++
 10 files changed, 1246 insertions(+), 225 deletions(-)
 delete mode 100644 package/gcc/4.7.4/302-c99-snprintf.patch
 create mode 100644 package/gcc/4.7.4/850-libstdcxx-uclibc-c99.patch
 delete mode 100644 package/gcc/4.8.3/302-c99-snprintf.patch
 create mode 100644 package/gcc/4.8.3/850-libstdcxx-uclibc-c99.patch
 delete mode 100644 package/gcc/4.9.1/302-c99-snprintf.patch
 create mode 100644 package/gcc/4.9.1/850-libstdcxx-uclibc-c99.patch
 create mode 100644 package/gcc/arc-4.8-R3/100-libstdcxx-uclibc-c99.patch
Signature · 6 lines
2.0.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 1 line
Bye, Peter Korsgaard