[libcxx-commits] [libcxxabi] [libc++abi] Always re-export std:: exception types from libc++abi (PR #84031)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 5 07:32:19 PST 2024


https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/84031

We always provide the std:: exception types, even when exceptions are disabled. This is a bit counter-intuitive, but these exception types are just normal types at the end of the day so we made the decision to always provide their definition. Failure to re-export these types would cause libc++ to fail to link on Apple platforms when exceptions are disabled.

>From 0326da954aca54cfb8cb6393cc324d6802f87246 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Tue, 5 Mar 2024 10:30:04 -0500
Subject: [PATCH] [libc++abi] Always re-export std:: exception types from
 libc++abi

We always provide the std:: exception types, even when exceptions are
disabled. This is a bit counter-intuitive, but these exception types
are just normal types at the end of the day so we made the decision to
always provide their definition. Failure to re-export these types would
cause libc++ to fail to link on Apple platforms when exceptions are
disabled.
---
 libcxxabi/src/CMakeLists.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index 0f17ea9184c824..0af4dc1448e91a 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -230,9 +230,12 @@ if (LIBCXXABI_ENABLE_SHARED)
     reexport_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/new-delete.exp")
   endif()
 
+  # Note that std:: exception types are always defined by the library regardless of
+  # whether the exception runtime machinery is provided.
+  reexport_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/std-exceptions.exp")
+
   if (LIBCXXABI_ENABLE_EXCEPTIONS)
     reexport_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/itanium-exceptions.exp")
-    reexport_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/std-exceptions.exp")
 
     if ("${CMAKE_OSX_ARCHITECTURES}" MATCHES "^(armv6|armv7|armv7s)$")
       reexport_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/personality-sjlj.exp")



More information about the libcxx-commits mailing list