[libcxx-commits] [libcxx] 229db36 - [libc++] Make __shared_weak_count vtable consistent across all build configurations
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Oct 20 05:19:53 PDT 2020
Author: Eric Fiselier
Date: 2020-10-20T08:19:43-04:00
New Revision: 229db3647491ed2b2706a9b9ce13a97e38be6fa0
URL: https://github.com/llvm/llvm-project/commit/229db3647491ed2b2706a9b9ce13a97e38be6fa0
DIFF: https://github.com/llvm/llvm-project/commit/229db3647491ed2b2706a9b9ce13a97e38be6fa0.diff
LOG: [libc++] Make __shared_weak_count vtable consistent across all build configurations
This patch ensures that __shared_weak_count provides a consistent vtable
regardless of if RTTI is enabled or if we are targeting a static or shared
libc++ build.
This patch is technically ABI breaking, but only for a very specific
configuration that no vendor should be shipping.
Note that _LIBCPP_BUILD_STATIC is not normally defined when building
libc++.a, but instead it must be manually provided by the user or the
__config_site.
Differential Revision: https://reviews.llvm.org/D32838
Added:
Modified:
libcxx/include/memory
libcxx/src/memory.cpp
libcxxabi/CMakeLists.txt
Removed:
################################################################################
diff --git a/libcxx/include/memory b/libcxx/include/memory
index 67a6ddde8fc8..f3b0b04e80e0 100644
--- a/libcxx/include/memory
+++ b/libcxx/include/memory
@@ -3271,13 +3271,7 @@ public:
long use_count() const _NOEXCEPT {return __shared_count::use_count();}
__shared_weak_count* lock() _NOEXCEPT;
- // Define the function out only if we build static libc++ without RTTI.
- // Otherwise we may break clients who need to compile their projects with
- // -fno-rtti and yet link against a libc++.dylib compiled
- // without -fno-rtti.
-#if !defined(_LIBCPP_NO_RTTI) || !defined(_LIBCPP_BUILD_STATIC)
virtual const void* __get_deleter(const type_info&) const _NOEXCEPT;
-#endif
private:
virtual void __on_zero_shared_weak() _NOEXCEPT = 0;
};
diff --git a/libcxx/src/memory.cpp b/libcxx/src/memory.cpp
index 633c9a6f5658..5a5894fd94e4 100644
--- a/libcxx/src/memory.cpp
+++ b/libcxx/src/memory.cpp
@@ -124,16 +124,12 @@ __shared_weak_count::lock() _NOEXCEPT
return nullptr;
}
-#if !defined(_LIBCPP_NO_RTTI) || !defined(_LIBCPP_BUILD_STATIC)
-
const void*
__shared_weak_count::__get_deleter(const type_info&) const _NOEXCEPT
{
return nullptr;
}
-#endif // _LIBCPP_NO_RTTI
-
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
_LIBCPP_SAFE_STATIC static const std::size_t __sp_mut_count = 16;
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index 923b3c6fda89..3f37dbf4cd36 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -338,10 +338,6 @@ else()
list(APPEND LIBCXXABI_COMPILE_FLAGS -DNDEBUG)
endif()
endif()
-# Static library
-if (NOT LIBCXXABI_ENABLE_SHARED)
- list(APPEND LIBCXXABI_COMPILE_FLAGS -D_LIBCPP_BUILD_STATIC)
-endif()
# Threading
if (NOT LIBCXXABI_ENABLE_THREADS)
More information about the libcxx-commits
mailing list