summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2025-06-11 23:21:04 +0200
committerAndreas Enge <andreas@enge.fr>2025-07-18 20:17:34 +0200
commit42f7c1bb176253ebea47c84077303bb14f62fbed (patch)
tree2af9e842a34f95418e87f9dd077d0734c940c0d0
parentca8e8e206b3e687af56bc623e9439c9f5358c12a (diff)
gnu: gcc: Fix compilation of libstdc++ for GCC 7 to 13.
With the introduction of GCC 14 as the default compiler, compilation of libstdc++ of all previous versions would fail due to a different signature for ‘__cxa_call_terminate’ (a builtin in GCC 14). This fixes it. * gnu/packages/patches/gcc-libstdc++-newer-gcc.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/gcc.scm (gcc-7, gcc-8, gcc-9, gcc-10) (gcc-11, gcc-12, gcc-13): Use it. Change-Id: I84dc26e46d56259d7d610f19b0521fa9c5499d5e
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/gcc.scm23
-rw-r--r--gnu/packages/patches/gcc-libstdc++-newer-gcc.patch32
3 files changed, 48 insertions, 8 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 9c4e31634e..f9e159b385 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1370,6 +1370,7 @@ dist_patch_DATA = \
%D%/packages/patches/gcc-cross-environment-variables.patch \
%D%/packages/patches/gcc-cross-gxx-include-dir.patch \
%D%/packages/patches/gcc-fix-texi2pod.patch \
+ %D%/packages/patches/gcc-libstdc++-newer-gcc.patch \
%D%/packages/patches/gcc-4.8-libsanitizer-fix.patch \
%D%/packages/patches/gcc-4.9-inline.patch \
%D%/packages/patches/gcc-4.9-libsanitizer-fix.patch \
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 4d9f1ba0c2..753a6cce6e 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012-2024 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012-2025 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2014, 2015, 2016, 2017, 2019, 2021 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2015, 2023 Andreas Enge <andreas@enge.fr>
@@ -695,7 +695,8 @@ Go. It also includes runtime support libraries for these languages.")
(patches (search-patches "gcc-strmov-store-file-names.patch"
"gcc-7-libsanitizer-mode-size.patch"
"gcc-7-libsanitizer-fsconfig-command.patch"
- "gcc-5.0-libvtv-runpath.patch"))))
+ "gcc-5.0-libvtv-runpath.patch"
+ "gcc-libstdc++-newer-gcc.patch"))))
(description
"GCC is the GNU Compiler Collection. It provides compiler front-ends
for several languages, including C, C++, Objective-C, Fortran, Ada, and Go.
@@ -722,7 +723,8 @@ It also includes runtime support libraries for these languages.")
(patches (search-patches "gcc-8-strmov-store-file-names.patch"
"gcc-7-libsanitizer-fsconfig-command.patch"
"gcc-5.0-libvtv-runpath.patch"
- "gcc-8-sort-libtool-find-output.patch"))
+ "gcc-8-sort-libtool-find-output.patch"
+ "gcc-libstdc++-newer-gcc.patch"))
(modules '((guix build utils)))
(snippet gcc-canadian-cross-objdump-snippet)))))
@@ -742,7 +744,8 @@ It also includes runtime support libraries for these languages.")
"gcc-13.2.0-libstdc++-info-install-fix.patch"
"gcc-9-strmov-store-file-names.patch"
"gcc-9-asan-fix-limits-include.patch"
- "gcc-5.0-libvtv-runpath.patch"))
+ "gcc-5.0-libvtv-runpath.patch"
+ "gcc-libstdc++-newer-gcc.patch"))
(modules '((guix build utils)))
(snippet gcc-canadian-cross-objdump-snippet)))))
@@ -759,7 +762,8 @@ It also includes runtime support libraries for these languages.")
"1h87lcfaga0ydsf4pkhwlnjr8mky5ix8npbv6iy3jvzlzm1ra415"))
(patches (search-patches "gcc-9-strmov-store-file-names.patch"
"gcc-5.0-libvtv-runpath.patch"
- "gcc-10-libsanitizer-no-crypt.patch"))
+ "gcc-10-libsanitizer-no-crypt.patch"
+ "gcc-libstdc++-newer-gcc.patch"))
(modules '((guix build utils)))
(snippet gcc-canadian-cross-objdump-snippet)))
(properties
@@ -785,7 +789,8 @@ It also includes runtime support libraries for these languages.")
(patches (search-patches "gcc-9-strmov-store-file-names.patch"
"gcc-5.0-libvtv-runpath.patch"
"gcc-10-libsanitizer-no-crypt.patch"
- "gcc-11-libstdc++-hurd-libpthread.patch"))
+ "gcc-11-libstdc++-hurd-libpthread.patch"
+ "gcc-libstdc++-newer-gcc.patch"))
(modules '((guix build utils)))
(snippet gcc-canadian-cross-objdump-snippet)))
(properties
@@ -811,7 +816,8 @@ It also includes runtime support libraries for these languages.")
(patches (search-patches "gcc-12-strmov-store-file-names.patch"
"gcc-5.0-libvtv-runpath.patch"
"gcc-12-libsanitizer-no-crypt.patch"
- "gcc-11-libstdc++-hurd-libpthread.patch"))
+ "gcc-11-libstdc++-hurd-libpthread.patch"
+ "gcc-libstdc++-newer-gcc.patch"))
(modules '((guix build utils)))
(snippet gcc-canadian-cross-objdump-snippet)))
(properties
@@ -836,7 +842,8 @@ It also includes runtime support libraries for these languages.")
"10y0l1hx1haz4cj4d4g9f2ci5h7z9555i52f90zs2hwm3iifji88"))
(patches (search-patches "gcc-12-strmov-store-file-names.patch"
"gcc-5.0-libvtv-runpath.patch"
- "gcc-13-libsanitizer-no-crypt.patch"))
+ "gcc-13-libsanitizer-no-crypt.patch"
+ "gcc-libstdc++-newer-gcc.patch"))
(modules '((guix build utils)))
(snippet gcc-canadian-cross-objdump-snippet)))
(arguments
diff --git a/gnu/packages/patches/gcc-libstdc++-newer-gcc.patch b/gnu/packages/patches/gcc-libstdc++-newer-gcc.patch
new file mode 100644
index 0000000000..9f643ef8f6
--- /dev/null
+++ b/gnu/packages/patches/gcc-libstdc++-newer-gcc.patch
@@ -0,0 +1,32 @@
+Building this file with GCC 14 leads to this error:
+
+ ../../libstdc++-v3/libsupc++/eh_call.cc:39:1: warning: new declaration ‘void __cxa_call_terminate(_Unwind_Exception*)’ ambiguates built-in declaration ‘void __cxa_call_terminate(void*)’ [-Wbuiltin-declaration-mismatch]
+ 39 | __cxa_call_terminate(_Unwind_Exception* ue_header) throw ()
+ | ^~~~~~~~~~~~~~~~~~~~
+ ../../libstdc++-v3/libsupc++/eh_call.cc: In function ‘void __cxa_call_terminate(_Unwind_Exception*)’:
+ ../../libstdc++-v3/libsupc++/eh_call.cc:39:1: internal compiler error: in gimple_build_eh_must_not_throw, at gimple.cc:730
+ 0x7fbc43241bd6 __libc_start_call_main
+ ???:0
+ 0x7fbc43241c94 __libc_start_main_alias_1
+ ???:0
+ Please submit a full bug report, with preprocessed source.
+ Please include the complete backtrace with any bug report.
+ See <https://gcc.gnu.org/bugs/> for instructions.
+
+Work around it.
+
+diff --git a/libstdc++-v3/libsupc++/eh_call.cc b/libstdc++-v3/libsupc++/eh_call.cc
+index bf864f692..4f7ade71e 100644
+--- a/libstdc++-v3/libsupc++/eh_call.cc
++++ b/libstdc++-v3/libsupc++/eh_call.cc
+@@ -36,8 +36,9 @@ using namespace __cxxabiv1;
+ // terminate.
+
+ extern "C" void
+-__cxa_call_terminate(_Unwind_Exception* ue_header) throw ()
++__cxa_call_terminate(void *arg) throw ()
+ {
++ _Unwind_Exception *ue_header = (_Unwind_Exception *) arg;
+
+ if (ue_header)
+ {