From 6737cfaa8ce629a6d35a5b56777c606b2712b630 Mon Sep 17 00:00:00 2001 From: Chris Packham Date: Wed, 12 Jan 2022 21:14:14 +1300 Subject: gcc: Use upstream fix for cross-canadian builds Replace the patch from #1600 with the change that landed upstream. Signed-off-by: Chris Packham diff --git a/packages/gcc/11.2.0/0005-Fix-cross-native-cross-caandian-builds.patch b/packages/gcc/11.2.0/0005-Fix-cross-native-cross-caandian-builds.patch deleted file mode 100644 index 633f8ea..0000000 --- a/packages/gcc/11.2.0/0005-Fix-cross-native-cross-caandian-builds.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 7f13ba28a4aac454ada29552acdf9a44697ad5a8 Mon Sep 17 00:00:00 2001 -From: Alexey Brodkin -Date: Wed, 15 Sep 2021 01:08:06 -0700 -Subject: [PATCH] Fix cross-native/cross-caandian builds - -See upstream bug report [1] for more details. -Basically when we do cross-canadian build with -use of the same GCC11 as a "host" compiler we're seeing -an error like that: -------------------->8------------------- -mingw-w64-cross/gcc/x86_64-w64-mingw32/libstdc++-v3/include/fenv.h:58:11: error: 'fenv_t' has not been declared in '::' - 58 | using ::fenv_t; -------------------->8------------------- - -This is a solution proposed by Yujie Yang in [2] - -[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017 -[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017#c20 - -Signed-off-by: Alexey Brodkin ---- - configure | 2 +- - configure.ac | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - ---- a/configure -+++ b/configure -@@ -16478,7 +16478,7 @@ - fi - - --RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET" -+RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET -nostdinc++" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the target ar" >&5 - $as_echo_n "checking where to find the target ar... " >&6; } ---- a/configure.ac -+++ b/configure.ac -@@ -3520,7 +3520,7 @@ - ACX_CHECK_INSTALLED_TARGET_TOOL(WINDRES_FOR_TARGET, windres) - ACX_CHECK_INSTALLED_TARGET_TOOL(WINDMC_FOR_TARGET, windmc) - --RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET" -+RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET -nostdinc++" - - GCC_TARGET_TOOL(ar, AR_FOR_TARGET, AR, [binutils/ar]) - GCC_TARGET_TOOL(as, AS_FOR_TARGET, AS, [gas/as-new]) diff --git a/packages/gcc/11.2.0/0005-libstdc-Add-nostdinc-for-c-17-sources-PR100017.patch b/packages/gcc/11.2.0/0005-libstdc-Add-nostdinc-for-c-17-sources-PR100017.patch new file mode 100644 index 0000000..8851e98 --- /dev/null +++ b/packages/gcc/11.2.0/0005-libstdc-Add-nostdinc-for-c-17-sources-PR100017.patch @@ -0,0 +1,78 @@ +From 4fde88e5dd152fe866a97b12e0f8229970d15cb3 Mon Sep 17 00:00:00 2001 +From: Jonathan Wakely +Date: Fri, 7 Jan 2022 15:21:03 +0000 +Subject: [PATCH] libstdc++: Add -nostdinc++ for c++17 sources [PR100017] + +When building a build!=host compiler, the just-built gcc can't be used +to build the target libstdc++ (because it is built for the host triplet, +not the build triplet). The top-level configure.ac sets up the build +flags for libstdc++ (and other "raw_cxx" libs) like this: + +GCC_TARGET_TOOL(c++ for libstdc++, RAW_CXX_FOR_TARGET, CXX, + [gcc/xgcc -shared-libgcc -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++ -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs], + c++) + +The -nostdinc++ flag is only used for the IN-TREE-TOOL, i.e. when using +the just-built gcc/xgcc compiler. This means that the cross-compiler +used to build libstdc++ will add its own libstdc++ headers to the +include path. That results in the #include in +src/c++17/floating_to_chars.cc and src/c++17/floating_from_chars.cc +doing #include_next and finding the libstdc++ fenv.h wrapper +from the host compiler. Because that has the same include guard as the + in the libstdc++ we're trying to build, we never reach the +underlying from libc. That results in several errors of the +form: + +error: 'fenv_t' has not been declared in '::' + +The most correct fix would be to add -nostdinc++ to the +RAW_CXX_FOR_TARGET variable in configure.ac, or the +RAW_CXX_TARGET_EXPORTS variable in Makefile.tpl. + +Another solution would be to make the libstdc++ wrapper use +_GLIBCXX_INCLUDE_NEXT_C_HEADERS like our and other C header +wrappers. + +For now though, the simplest and safest solution is to just add +-nostdinc++ to the CXXFLAGS used for src/c++17/*.cc, which is what this +does. + +libstdc++-v3/ChangeLog: + + PR libstdc++/100017 + * src/c++17/Makefile.am (AM_CXXFLAGS): Add -nostdinc++. + * src/c++17/Makefile.in: Regenerate. +--- + libstdc++-v3/src/c++17/Makefile.am | 2 +- + libstdc++-v3/src/c++17/Makefile.in | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libstdc++-v3/src/c++17/Makefile.am b/libstdc++-v3/src/c++17/Makefile.am +index f08553a1dd78..3d53f652fac9 100644 +--- a/libstdc++-v3/src/c++17/Makefile.am ++++ b/libstdc++-v3/src/c++17/Makefile.am +@@ -79,7 +79,7 @@ endif + # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden + # as the occasion calls for it. + AM_CXXFLAGS = \ +- -std=gnu++17 \ ++ -std=gnu++17 -nostdinc++ \ + $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ + $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) \ +diff --git a/libstdc++-v3/src/c++17/Makefile.in b/libstdc++-v3/src/c++17/Makefile.in +index 63984ecd52ad..8c02be6514f8 100644 +--- a/libstdc++-v3/src/c++17/Makefile.in ++++ b/libstdc++-v3/src/c++17/Makefile.in +@@ -455,7 +455,7 @@ libc__17convenience_la_SOURCES = $(sources) $(inst_sources) + # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden + # as the occasion calls for it. + AM_CXXFLAGS = \ +- -std=gnu++17 \ ++ -std=gnu++17 -nostdinc++ \ + $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ + $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) \ +-- +2.34.1 + -- cgit v0.10.2-6-g49f6