From 41808111aa0a58708daf66b2322940d4353e37d8 Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Sat, 5 Sep 2020 11:39:39 +0100 Subject: [PATCH] Fix compiling with libc++ but not linking with libc++. --- arc.mm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arc.mm b/arc.mm index c96681f..4530a64 100644 --- a/arc.mm +++ b/arc.mm @@ -110,6 +110,18 @@ static inline T* new_zeroed() return static_cast(calloc(sizeof(T), 1)); } +#ifdef _LIBCPP_BEGIN_NAMESPACE_STD +_LIBCPP_BEGIN_NAMESPACE_STD +/** + * If we're compiling with libc++, we need to instantiate the vector base class + * to avoid linker errors. Libc++ defines the functions that throw exceptions + * in the headers but makes them extern templates to avoid code duplication in + * the slow paths. + */ +template class __attribute__((visibility("hidden"))) __vector_base_common; +_LIBCPP_END_NAMESPACE_STD +#endif + static inline struct arc_tls* getARCThreadData(void) {