Skip to content

Conversation

@ldionne
Copy link
Member

@ldionne ldionne commented Dec 19, 2025

This reverts commit b2ddb90. Sadly, I was wrong when I said that Apple didn't ship libstdc++.dylib on iOS. We actually still do, it's just not part of the shared cache, which is why I missed it.

Hence, it is still possible to encounter libstdc++.dylib in processes running on iOS.

…p_refstring on iOS (llvm#170816)"

This reverts commit b2ddb90. Sadly, I was wrong when I said that Apple
didn't ship libstdc++.dylib on iOS. We actually still do, it's just not
part of the shared cache, which is why I missed it.

Hence, it is still possible to encounter libstdc++.dylib in processes
running on iOS.
@ldionne ldionne requested a review from philnik777 December 19, 2025 20:45
@ldionne ldionne requested a review from a team as a code owner December 19, 2025 20:45
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Dec 19, 2025
@llvmbot
Copy link
Member

llvmbot commented Dec 19, 2025

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

Changes

This reverts commit b2ddb90. Sadly, I was wrong when I said that Apple didn't ship libstdc++.dylib on iOS. We actually still do, it's just not part of the shared cache, which is why I missed it.

Hence, it is still possible to encounter libstdc++.dylib in processes running on iOS.


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

1 Files Affected:

  • (modified) libcxx/src/include/refstring.h (+2-2)
diff --git a/libcxx/src/include/refstring.h b/libcxx/src/include/refstring.h
index 1c73c60f9ced1..3e0ec7a97c7be 100644
--- a/libcxx/src/include/refstring.h
+++ b/libcxx/src/include/refstring.h
@@ -15,7 +15,7 @@
 #include <cstring>
 #include <stdexcept>
 
-// MacOS used to ship with libstdc++, and still support old applications
+// MacOS and iOS used to ship with libstdc++, and still support old applications
 // linking against libstdc++. The libc++ and libstdc++ exceptions are supposed
 // to be ABI compatible, such that they can be thrown from one library and caught
 // in the other.
@@ -25,7 +25,7 @@
 // string singleton before manipulating the reference count. This is done so that
 // if an exception is created with a zero-length string in libstdc++, libc++abi
 // won't try to delete the memory.
-#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
+#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
 #  define _LIBCPP_CHECK_FOR_GCC_EMPTY_STRING_STORAGE
 #  include <dlfcn.h>
 #  include <mach-o/dyld.h>

// if an exception is created with a zero-length string in libstdc++, libc++abi
// won't try to delete the memory.
#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That being said, I am still investigating whether we can get rid of this for macOS on arm64. I think we'll be able to.

If that's the case, we'd have to support this on iOS arm64 and on macOS x86_64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants