[libc++] Fix broken build when merging libc++abi into libc++ on Apple

GitOrigin-RevId: 03b6dc300531434209e65bccebb1a1c21f387e2a
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 52b68e5..c482068 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -213,9 +213,12 @@
   endif()
 
   # Maybe re-export symbols from libc++abi
+  # In particular, we don't re-export the symbols if libc++abi is merged statically
+  # into libc++ because in that case there's no dylib to re-export from.
   if (APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR
                  LIBCXX_CXX_ABI_LIBNAME STREQUAL "default")
-            AND NOT DEFINED LIBCXX_OSX_REEXPORT_LIBCXXABI_SYMBOLS)
+            AND NOT DEFINED LIBCXX_OSX_REEXPORT_LIBCXXABI_SYMBOLS
+            AND NOT LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY)
     set(LIBCXX_OSX_REEXPORT_LIBCXXABI_SYMBOLS ON)
   endif()