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 <thomas.petazzoni@free-electrons.com>
---
*)
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
===================================================================
--- a/gcc/configure
+++ b/gcc/configure
-@@ -27300,6 +27300,9 @@
+@@ -27328,6 +27328,9 @@
else
gcc_cv_libc_provides_ssp=no
case "$target" in
*-*-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.
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
;;
===================================================================
--- 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
*-*-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.
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
;;
===================================================================
--- 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)