sh-elf-gcc/patches/gcc-11.1.0-libstdc++-v3-ski...

66 lines
2.5 KiB
Diff

# Building libstdc++-v3 for a bare-bones compiler is somewhat in a gray area
# since we don't have a full hosted system to target. From a version of GCC to
# the next this might break in minor ways.
#
# Here, the issue is the reliance on a dlopen() check which cannot be
# completed because we don't have link tests. The intent of the configure
# script is to skip it for cross-compilers, which is materialized by the check
# for --with-newlib (which is somewhat abused to mean "no libc").
#
# However, building with --with-newlib is not quite right since we have our
# own libc and fails due to it enabling small newlib-specific bits of code
# that don't compile with the fxlibc.
#
# Instead, we disable the test when --without-headers is specified, which is
# the case in our configuration. This extra condition is already part of the
# upstreamed source in GCC 12.1.0, so this is basically a backport. We also
# backport disabling the GLIBCXX_CROSSCONFIG which would block the build.
#
# Explanations about the gray area:
# <https://gcc.gnu.org/legacy-ml/gcc/2008-03/msg00515.html>
# Commit introducing this test in GCC 12.1.0:
# <https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=68c2e9e9234cb301e9e81792cad233a41e797792>
# GCC bug motivating the commit:
# <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103866>
--- gcc-11.1.0/libstdc++-v3/configure.ac 2021-04-27 12:00:16.000000000 +0200
+++ gcc-11.1.0/libstdc++-v3/configure2.ac 2022-08-15 22:53:21.730140593 +0200
@@ -90,7 +90,7 @@
GLIBCXX_CONFIGURE
# Libtool setup.
-if test "x${with_newlib}" != "xyes" && test "x${with_avrlibc}" != "xyes"; then
+if test "x${with_newlib}" != "xyes" && test "x${with_avrlibc}" != "xyes" && test "x${with_headers}" != "xno"; then
AC_LIBTOOL_DLOPEN
fi
AM_PROG_LIBTOOL
@@ -353,7 +353,7 @@
AC_DEFINE(HAVE_ICONV)
AC_DEFINE(HAVE_MEMALIGN)
- else
+ elif test "x${with_headers}" != "xno"; then
GLIBCXX_CROSSCONFIG
fi
--- gcc-11.1.0/libstdc++-v3/configure 2022-08-15 22:37:29.043460208 +0200
+++ gcc-11.1.0/libstdc++-v3/configure2 2022-08-15 22:37:03.403459840 +0200
@@ -5903,7 +5903,7 @@
# Libtool setup.
-if test "x${with_newlib}" != "xyes" && test "x${with_avrlibc}" != "xyes"; then
+if test "x${with_newlib}" != "xyes" && test "x${with_avrlibc}" != "xyes" && test "x${with_headers}" != "xno"; then
enable_dlopen=yes
@@ -29266,7 +29266,7 @@
$as_echo "#define HAVE_MEMALIGN 1" >>confdefs.h
- else
+ elif test "x${with_headers}" != "xno"; then
# Base decisions on target environment.
case "${host}" in