From 360c5201f6fb0988f1a29c17ae8793ed132fd260 Mon Sep 17 00:00:00 2001 From: kkz Date: Mon, 21 Mar 2022 11:55:13 +0800 Subject: [PATCH] [Backport] libstdc++: Remove _GLIBCXX_USE_INT128 autoconf macro Reference: https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg259436.html https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=ad0a3be4df5eecc79075d899fd79179d0f61270e https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=29a9de9b40277af98515eabebb75be1f154e9505 We don't need to decide whether to use __int128 when running configure, we can do so at compilation time by seeing if __SIZEOF_INT128__ is defined and if it's greater than __SIZEOF_LONG_LONG__. This removes another unnecessary architecture-specific config macro in , so the same header can work for 32-bit or 64-bit compilation on AIX. (cherry picked from commit f27fd35c9ccbd6b0ad2bc3602cd0790b9a49a0c4) --- ...e-_GLIBCXX_USE_INT128-autoconf-macro.patch | 373 ++++++++++++++++++ gcc.spec | 10 +- 2 files changed, 382 insertions(+), 1 deletion(-) create mode 100644 Remove-_GLIBCXX_USE_INT128-autoconf-macro.patch diff --git a/Remove-_GLIBCXX_USE_INT128-autoconf-macro.patch b/Remove-_GLIBCXX_USE_INT128-autoconf-macro.patch new file mode 100644 index 0000000..3f4ac8c --- /dev/null +++ b/Remove-_GLIBCXX_USE_INT128-autoconf-macro.patch @@ -0,0 +1,373 @@ +From ecd9ba562bc51325560d8a5a83f123d72c96a377 Mon Sep 17 00:00:00 2001 +From: root +Date: Thu, 14 Apr 2022 18:54:12 +0800 +Subject: [PATCH] Remove _GLIBCXX_USE_INT128 autoconf macro +[Backport] libstdc++: Remove _GLIBCXX_USE_INT128 autoconf macro + +Reference: https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg259436.html + https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=ad0a3be4df5eecc79075d899fd79179d0f61270e + https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=29a9de9b40277af98515eabebb75be1f154e9505 + +We don't need to decide whether to use __int128 when running configure, +we can do so at compilation time by seeing if __SIZEOF_INT128__ is +defined and if it's greater than __SIZEOF_LONG_LONG__. + +This removes another unnecessary architecture-specific config macro in +, so the same header can work for 32-bit or 64-bit +compilation on AIX. + +--- + libstdc++-v3/acinclude.m4 | 36 +++---------------- + libstdc++-v3/config.h.in | 3 -- + libstdc++-v3/configure | 36 +------------------ + libstdc++-v3/configure.ac | 2 +- + libstdc++-v3/include/bits/random.h | 2 +- + .../18_support/numeric_limits/40856.cc | 2 +- + .../18_support/numeric_limits/dr559.cc | 2 +- + .../18_support/numeric_limits/lowest.cc | 2 +- + .../18_support/numeric_limits/max_digits10.cc | 2 +- + .../20_util/is_floating_point/value.cc | 2 +- + .../testsuite/20_util/is_integral/value.cc | 2 +- + .../testsuite/20_util/is_signed/value.cc | 2 +- + .../testsuite/20_util/is_unsigned/value.cc | 2 +- + .../make_signed/requirements/typedefs-1.cc | 2 +- + .../make_signed/requirements/typedefs-2.cc | 2 +- + .../make_unsigned/requirements/typedefs-1.cc | 2 +- + .../make_unsigned/requirements/typedefs-2.cc | 2 +- + .../testsuite/util/testsuite_common_types.h | 4 +-- + 18 files changed, 21 insertions(+), 86 deletions(-) + +diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 +index a3f1fdbf6..0fc23b75d 100644 +--- a/libstdc++-v3/acinclude.m4 ++++ b/libstdc++-v3/acinclude.m4 +@@ -3056,15 +3056,14 @@ EOF + ]) + + dnl +-dnl Check for GNU 128-bit integer and floating point types. ++dnl Check for GNU 128-bit floating point type. + dnl +-dnl Note: also checks that the types aren't standard types. ++dnl Note: also checks that the type isn't a standard types. + dnl + dnl Defines: +-dnl _GLIBCXX_USE_INT128 + dnl _GLIBCXX_USE_FLOAT128 + dnl +-AC_DEFUN([GLIBCXX_ENABLE_INT128_FLOAT128], [ ++AC_DEFUN([GLIBCXX_ENABLE_FLOAT128], [ + + AC_LANG_SAVE + AC_LANG_CPLUSPLUS +@@ -3072,34 +3071,7 @@ AC_DEFUN([GLIBCXX_ENABLE_INT128_FLOAT128], [ + # Fake what AC_TRY_COMPILE does, without linking as this is + # unnecessary for this test. + +- cat > conftest.$ac_ext << EOF +-[#]line __oline__ "configure" +-template +- struct same +- { typedef T2 type; }; +- +-template +- struct same; +- +-int main() +-{ +- typename same::type i1; +- typename same::type i2; +-} +-EOF +- +- AC_MSG_CHECKING([for __int128]) +- if AC_TRY_EVAL(ac_compile); then +- AC_DEFINE(_GLIBCXX_USE_INT128, 1, +- [Define if __int128 is supported on this host.]) +- enable_int128=yes +- else +- enable_int128=no +- fi +- AC_MSG_RESULT($enable_int128) +- rm -f conftest* +- +- cat > conftest.$ac_ext << EOF ++ cat > conftest.$ac_ext << EOF + [#]line __oline__ "configure" + template + struct same +diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in +index 26790630a..34733c1ab 100644 +--- a/libstdc++-v3/config.h.in ++++ b/libstdc++-v3/config.h.in +@@ -921,9 +921,6 @@ + /* Define if get_nprocs is available in . */ + #undef _GLIBCXX_USE_GET_NPROCS + +-/* Define if __int128 is supported on this host. */ +-#undef _GLIBCXX_USE_INT128 +- + /* Define if LFS support is available. */ + #undef _GLIBCXX_USE_LFS + +diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure +index 20c4d0120..3c15e43a6 100755 +--- a/libstdc++-v3/configure ++++ b/libstdc++-v3/configure +@@ -15392,7 +15392,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; } + + # Fake what AC_TRY_COMPILE does. + +- cat > conftest.$ac_ext << EOF ++ cat > conftest.$ac_ext << EOF + #line 15396 "configure" + int main() + { +@@ -15630,40 +15630,6 @@ template + template + struct same; + +-int main() +-{ +- typename same::type i1; +- typename same::type i2; +-} +-EOF +- +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __int128" >&5 +-$as_echo_n "checking for __int128... " >&6; } +- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 +- (eval $ac_compile) 2>&5 +- ac_status=$? +- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 +- test $ac_status = 0; }; then +- +-$as_echo "#define _GLIBCXX_USE_INT128 1" >>confdefs.h +- +- enable_int128=yes +- else +- enable_int128=no +- fi +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_int128" >&5 +-$as_echo "$enable_int128" >&6; } +- rm -f conftest* +- +- cat > conftest.$ac_ext << EOF +-#line 15659 "configure" +-template +- struct same +- { typedef T2 type; }; +- +-template +- struct same; +- + int main() + { + typename same::type f1; +diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac +index 9c679ae58..0a757c959 100644 +--- a/libstdc++-v3/configure.ac ++++ b/libstdc++-v3/configure.ac +@@ -151,7 +151,7 @@ GLIBCXX_ENABLE_PCH($is_hosted) + GLIBCXX_ENABLE_THREADS + GLIBCXX_ENABLE_ATOMIC_BUILTINS + GLIBCXX_ENABLE_DECIMAL_FLOAT +-GLIBCXX_ENABLE_INT128_FLOAT128 ++GLIBCXX_ENABLE_FLOAT128 + if test "$enable_float128" = yes; then + port_specific_symbol_files="$port_specific_symbol_files \$(top_srcdir)/config/abi/pre/float128.ver" + fi +diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h +index d39cc3e06..785367463 100644 +--- a/libstdc++-v3/include/bits/random.h ++++ b/libstdc++-v3/include/bits/random.h +@@ -101,7 +101,7 @@ _GLIBCXX_END_NAMESPACE_VERSION + struct _Select_uint_least_t<__s, 2> + { typedef unsigned long long type; }; + +-#ifdef _GLIBCXX_USE_INT128 ++#if __SIZEOF_INT128__ > __SIZEOF_LONG_LONG__ + template + struct _Select_uint_least_t<__s, 1> + { typedef unsigned __int128 type; }; +diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/40856.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/40856.cc +index 8e585509a..1be30385c 100644 +--- a/libstdc++-v3/testsuite/18_support/numeric_limits/40856.cc ++++ b/libstdc++-v3/testsuite/18_support/numeric_limits/40856.cc +@@ -20,7 +20,7 @@ + #include + + // libstdc++/40856 +-#if defined _GLIBCXX_USE_INT128 && ! defined __STRICT_ANSI__ ++#if defined __SIZEOF_INT128__ + static_assert(std::numeric_limits<__int128>::is_specialized == true, ""); + static_assert(std::numeric_limits::is_specialized == true, + ""); +diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/dr559.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/dr559.cc +index 10ac39593..fe6775645 100644 +--- a/libstdc++-v3/testsuite/18_support/numeric_limits/dr559.cc ++++ b/libstdc++-v3/testsuite/18_support/numeric_limits/dr559.cc +@@ -95,7 +95,7 @@ int main() + do_test(); + do_test(); + // GNU Extensions. +-#ifdef _GLIBCXX_USE_INT128 ++#ifdef __SIZEOF_INT128__ + do_test<__int128>(); + do_test(); + #endif +diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/lowest.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/lowest.cc +index 4e3a54187..ecd11cf3b 100644 +--- a/libstdc++-v3/testsuite/18_support/numeric_limits/lowest.cc ++++ b/libstdc++-v3/testsuite/18_support/numeric_limits/lowest.cc +@@ -71,7 +71,7 @@ void test01() + do_test(); + + // GNU Extensions. +-#ifdef _GLIBCXX_USE_INT128 ++#ifdef __SIZEOF_INT128__ + do_test<__int128>(); + do_test(); + #endif +diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/max_digits10.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/max_digits10.cc +index 9cffe4dea..371668cc5 100644 +--- a/libstdc++-v3/testsuite/18_support/numeric_limits/max_digits10.cc ++++ b/libstdc++-v3/testsuite/18_support/numeric_limits/max_digits10.cc +@@ -46,7 +46,7 @@ test01() + VERIFY( std::numeric_limits::max_digits10 == 0 ); + + // GNU Extensions. +-#ifdef _GLIBCXX_USE_INT128 ++#ifdef __SIZEOF_INT128__ + VERIFY( std::numeric_limits<__int128>::max_digits10 == 0 ); + VERIFY( std::numeric_limits::max_digits10 == 0 ); + #endif +diff --git a/libstdc++-v3/testsuite/20_util/is_floating_point/value.cc b/libstdc++-v3/testsuite/20_util/is_floating_point/value.cc +index a54079592..3735e43e5 100644 +--- a/libstdc++-v3/testsuite/20_util/is_floating_point/value.cc ++++ b/libstdc++-v3/testsuite/20_util/is_floating_point/value.cc +@@ -53,7 +53,7 @@ void test01() + static_assert(test_category(true), ""); + #endif + +-#ifdef _GLIBCXX_USE_INT128 ++#ifdef __SIZEOF_INT128__ + static_assert(test_category(false), ""); + static_assert(test_category(false), ""); +diff --git a/libstdc++-v3/testsuite/20_util/is_integral/value.cc b/libstdc++-v3/testsuite/20_util/is_integral/value.cc +index 359665ea1..ab28830b1 100644 +--- a/libstdc++-v3/testsuite/20_util/is_integral/value.cc ++++ b/libstdc++-v3/testsuite/20_util/is_integral/value.cc +@@ -52,7 +52,7 @@ void test01() + + #ifndef __STRICT_ANSI__ + // GNU Extensions. +-#ifdef _GLIBCXX_USE_INT128 ++#ifdef __SIZEOF_INT128__ + static_assert(test_category(true), ""); + static_assert(test_category(true), ""); + #endif +diff --git a/libstdc++-v3/testsuite/20_util/is_signed/value.cc b/libstdc++-v3/testsuite/20_util/is_signed/value.cc +index bff874fce..6cc5c0767 100644 +--- a/libstdc++-v3/testsuite/20_util/is_signed/value.cc ++++ b/libstdc++-v3/testsuite/20_util/is_signed/value.cc +@@ -51,7 +51,7 @@ void test01() + + #ifndef __STRICT_ANSI__ + // GNU Extensions. +-#ifdef _GLIBCXX_USE_INT128 ++#ifdef __SIZEOF_INT128__ + static_assert(test_category(true), ""); + static_assert(test_category(false), ""); + #endif +diff --git a/libstdc++-v3/testsuite/20_util/is_unsigned/value.cc b/libstdc++-v3/testsuite/20_util/is_unsigned/value.cc +index bde019d63..32ef472e2 100644 +--- a/libstdc++-v3/testsuite/20_util/is_unsigned/value.cc ++++ b/libstdc++-v3/testsuite/20_util/is_unsigned/value.cc +@@ -51,7 +51,7 @@ void test01() + + #ifndef __STRICT_ANSI__ + // GNU Extensions. +-#ifdef _GLIBCXX_USE_INT128 ++#ifdef __SIZEOF_INT128__ + static_assert(test_category(true), ""); + static_assert(test_category(false), ""); + #endif +diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc +index 0bdd3be98..0f55e1e24 100644 +--- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc ++++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc +@@ -68,7 +68,7 @@ void test01() + + #ifndef __STRICT_ANSI__ + // GNU Extensions. +-#ifdef _GLIBCXX_USE_INT128 ++#ifdef __SIZEOF_INT128__ + typedef make_signed::type test25_type; + static_assert( is_same::value, + "make_signed" ); +diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc +index 18b9445d4..7d5506e15 100644 +--- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc ++++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc +@@ -61,7 +61,7 @@ void test01() + + #ifndef __STRICT_ANSI__ + // GNU Extensions. +-#ifdef _GLIBCXX_USE_INT128 ++#ifdef __SIZEOF_INT128__ + typedef make_signed::type test25_type; + static_assert(is_same::value, ""); + +diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc +index 9f58fd746..51f3e44ec 100644 +--- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc ++++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc +@@ -62,7 +62,7 @@ void test01() + + #ifndef __STRICT_ANSI__ + // GNU Extensions. +-#ifdef _GLIBCXX_USE_INT128 ++#if __SIZEOF_INT128__ + typedef make_unsigned::type test25_type; + static_assert(is_same::value, ""); + +diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc +index 2fdd68cb8..74f1b18a3 100644 +--- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc ++++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc +@@ -61,7 +61,7 @@ void test01() + + #ifndef __STRICT_ANSI__ + // GNU Extensions. +-#ifdef _GLIBCXX_USE_INT128 ++#ifdef __SIZEOF_INT128__ + typedef make_unsigned::type test25_type; + static_assert(is_same::value, ""); + +diff --git a/libstdc++-v3/testsuite/util/testsuite_common_types.h b/libstdc++-v3/testsuite/util/testsuite_common_types.h +index d2efe3af5..ff9121d26 100644 +--- a/libstdc++-v3/testsuite/util/testsuite_common_types.h ++++ b/libstdc++-v3/testsuite/util/testsuite_common_types.h +@@ -303,7 +303,7 @@ namespace __gnu_test + #if __cplusplus >= 201103L + typedef char16_t a14; + typedef char32_t a15; +-# if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128) ++# if !defined(__STRICT_ANSI__) && defined (__SIZEOF_INT128__) + __extension__ typedef __int128 a16; + __extension__ typedef unsigned __int128 a17; + +@@ -315,7 +315,7 @@ namespace __gnu_test + a10, a11, a12, a13, a14, a15)> type; + # endif + #else +-# if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128) ++# if !defined(__STRICT_ANSI__) && defined (__SIZEOF_INT128__) + __extension__ typedef __int128 a14; + __extension__ typedef unsigned __int128 a15; + +-- +2.27.0 + diff --git a/gcc.spec b/gcc.spec index 1fd9df8..0bf41f8 100644 --- a/gcc.spec +++ b/gcc.spec @@ -36,7 +36,7 @@ Summary: Various compilers (C, C++, Objective-C, Java, ...) Name: gcc Version: 7.3.0 -Release: 47 +Release: 48 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD Group: Development/Languages #Source0: hcc-aarch64-linux-release.tar.bz2 @@ -90,6 +90,7 @@ Patch38: fix-pre-improve-fake-exit-edge-placement.patch Patch39: fix-PR83666-punt-BLKmode-when-expand_debug_expr.patch Patch40: fix-AArch64-128-bit-immediate-ICEs.patch Patch41: PR-c-83227-C-17-ICE-with-init-list-derived.patch +Patch42: Remove-_GLIBCXX_USE_INT128-autoconf-macro.patch #AutoReqProv: off AutoReq: true @@ -575,6 +576,7 @@ package or when debugging this package. %patch39 -p1 %patch40 -p1 %patch41 -p1 +%patch42 -p1 %if 0%{?_enable_debug_packages} cat > split-debuginfo.sh <<\EOF @@ -3331,6 +3333,12 @@ fi %changelog +* Mon Mar 21 2022 kkz - 7.3.0-48 +- Add patch Remove-_GLIBCXX_USE_INT128-autoconf-macro.patch to resolve int128 related compile issue +- refer to https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=ad0a3be4df5eecc79075d899fd79179d0f61270e + https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=29a9de9b40277af98515eabebb75be1f154e9505 + https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg259436.html + * Wed Mar 09 2022 benniaobufeijiushiji - 7.3.0-47 - gcc.spec: Remove %post and %postun for package gdb-plugin -- Gitee