Skip to content

[libc++abi] Always re-export std:: exception types from libc++abi #84031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 5, 2024

Conversation

ldionne
Copy link
Member

@ldionne ldionne commented Mar 5, 2024

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.

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.
@ldionne ldionne requested a review from a team as a code owner March 5, 2024 15:32
@llvmbot llvmbot added the libc++abi libc++abi C++ Runtime Library. Not libc++. label Mar 5, 2024
@llvmbot
Copy link
Member

llvmbot commented Mar 5, 2024

@llvm/pr-subscribers-libcxxabi

Author: Louis Dionne (ldionne)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/84031.diff

1 Files Affected:

  • (modified) libcxxabi/src/CMakeLists.txt (+4-1)
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")

@ldionne
Copy link
Member Author

ldionne commented Mar 5, 2024

It looks like our full CI is stalled right now. However, this patch only affects Apple platforms and I've tested it locally, so I'll merge this since it causes trouble downstream.

@ldionne ldionne merged commit b8c6252 into llvm:main Mar 5, 2024
@ldionne ldionne deleted the review/fix-noexcept-apple branch March 5, 2024 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++abi libc++abi C++ Runtime Library. Not libc++.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants