git: 297a9e552b9a - main - libcxxrt: Add a stub implementation of __cxa_call_terminate

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Wed, 21 Aug 2024 17:38:04 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=297a9e552b9a5adf07d195eae9649b0758f395af

commit 297a9e552b9a5adf07d195eae9649b0758f395af
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-08-21 17:37:48 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-08-21 17:37:48 +0000

    libcxxrt: Add a stub implementation of __cxa_call_terminate
    
    This function is called by GCC 14 if a destructor invoked during
    exception unwinding throws an exception.
    
    Reviewed by:    emaste
    Obtained from:  libcxxrt commit 391a3dcc1054e18c2f0dff4e14d6d79ac95399d7
    Differential Revision:  https://reviews.freebsd.org/D46004
---
 contrib/libcxxrt/exception.cc | 13 +++++++++++++
 lib/libcxxrt/Version.map      |  4 ++++
 lib/libcxxrt/Version.map.arm  |  4 ++++
 3 files changed, 21 insertions(+)

diff --git a/contrib/libcxxrt/exception.cc b/contrib/libcxxrt/exception.cc
index 35ff997dd445..b56333e979a2 100644
--- a/contrib/libcxxrt/exception.cc
+++ b/contrib/libcxxrt/exception.cc
@@ -1433,6 +1433,19 @@ extern "C" void __cxa_call_unexpected(void*exception)
 	abort();
 }
 
+/**
+ * ABI function, called when an object destructor exits due to an
+ * exception during stack unwinding.
+ *
+ * This function does not return.
+ */
+extern "C" void __cxa_call_terminate(void *exception) throw()
+{
+	std::terminate();
+	// Should not be reached.
+	abort();
+}
+
 /**
  * ABI function, returns the adjusted pointer to the exception object.
  */
diff --git a/lib/libcxxrt/Version.map b/lib/libcxxrt/Version.map
index 012026079e33..02cce34c234f 100644
--- a/lib/libcxxrt/Version.map
+++ b/lib/libcxxrt/Version.map
@@ -253,6 +253,10 @@ CXXABI_1.3.11 {
     __cxa_init_primary_exception;
 } CXXABI_1.3.9;
 
+CXXABI_1.3.15 {
+    __cxa_call_terminate;
+} CXXABI_1.3.11;
+
 CXXRT_1.0 {
 
     extern "C++" {
diff --git a/lib/libcxxrt/Version.map.arm b/lib/libcxxrt/Version.map.arm
index bc4cf68a3654..aef918149b79 100644
--- a/lib/libcxxrt/Version.map.arm
+++ b/lib/libcxxrt/Version.map.arm
@@ -254,6 +254,10 @@ CXXABI_1.3.11 {
     __cxa_init_primary_exception;
 } CXXABI_1.3.9;
 
+CXXABI_1.3.15 {
+    __cxa_call_terminate;
+} CXXABI_1.3.11;
+
 CXXRT_1.0 {
 
     extern "C++" {