Index: libcxxabi/trunk/include/__cxxabi_config.h =================================================================== --- libcxxabi/trunk/include/__cxxabi_config.h +++ libcxxabi/trunk/include/__cxxabi_config.h @@ -56,4 +56,10 @@ #endif #endif +#if defined(_WIN32) +#define _LIBCXXABI_WEAK +#else +#define _LIBCXXABI_WEAK __attribute__((__weak__)) +#endif + #endif // ____CXXABI_CONFIG_H Index: libcxxabi/trunk/src/abort_message.h =================================================================== --- libcxxabi/trunk/src/abort_message.h +++ libcxxabi/trunk/src/abort_message.h @@ -10,24 +10,18 @@ #ifndef __ABORT_MESSAGE_H_ #define __ABORT_MESSAGE_H_ -#include - -#pragma GCC visibility push(hidden) +#include "cxxabi.h" #ifdef __cplusplus extern "C" { #endif -__attribute__((visibility("hidden"), noreturn)) - void abort_message(const char* format, ...) - __attribute__((format(printf, 1, 2))); - +_LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN void +abort_message(const char *format, ...) __attribute__((format(printf, 1, 2))); #ifdef __cplusplus } #endif -#pragma GCC visibility pop - #endif Index: libcxxabi/trunk/src/abort_message.cpp =================================================================== --- libcxxabi/trunk/src/abort_message.cpp +++ libcxxabi/trunk/src/abort_message.cpp @@ -22,8 +22,6 @@ #endif // __ANDROID_API__ >= 21 #endif // __BIONIC__ -#pragma GCC visibility push(hidden) - #ifdef __APPLE__ # if defined(__has_include) && __has_include() # define HAVE_CRASHREPORTERCLIENT_H @@ -31,7 +29,6 @@ # endif #endif -__attribute__((visibility("hidden"), noreturn)) void abort_message(const char* format, ...) { // write message to stderr @@ -79,5 +76,3 @@ abort(); } - -#pragma GCC visibility pop Index: libcxxabi/trunk/src/cxa_exception.hpp =================================================================== --- libcxxabi/trunk/src/cxa_exception.hpp +++ libcxxabi/trunk/src/cxa_exception.hpp @@ -20,13 +20,11 @@ namespace __cxxabiv1 { -#pragma GCC visibility push(hidden) - static const uint64_t kOurExceptionClass = 0x434C4E47432B2B00; // CLNGC++\0 static const uint64_t kOurDependentExceptionClass = 0x434C4E47432B2B01; // CLNGC++\1 static const uint64_t get_vendor_and_language = 0xFFFFFFFFFFFFFF00; // mask for CLNGC++ -struct __cxa_exception { +struct _LIBCXXABI_HIDDEN __cxa_exception { #if defined(__LP64__) || _LIBCXXABI_ARM_EHABI // This is a new field to support C++ 0x exception_ptr. // For binary compatibility it is at the start of this @@ -69,7 +67,7 @@ // http://sourcery.mentor.com/archives/cxx-abi-dev/msg01924.html // The layout of this structure MUST match the layout of __cxa_exception, with // primaryException instead of referenceCount. -struct __cxa_dependent_exception { +struct _LIBCXXABI_HIDDEN __cxa_dependent_exception { #if defined(__LP64__) || _LIBCXXABI_ARM_EHABI void* primaryException; #endif @@ -101,7 +99,7 @@ _Unwind_Exception unwindHeader; }; -struct __cxa_eh_globals { +struct _LIBCXXABI_HIDDEN __cxa_eh_globals { __cxa_exception * caughtExceptions; unsigned int uncaughtExceptions; #if _LIBCXXABI_ARM_EHABI @@ -109,16 +107,11 @@ #endif }; -#pragma GCC visibility pop -#pragma GCC visibility push(default) - -extern "C" __cxa_eh_globals * __cxa_get_globals (); -extern "C" __cxa_eh_globals * __cxa_get_globals_fast (); - -extern "C" void * __cxa_allocate_dependent_exception (); -extern "C" void __cxa_free_dependent_exception (void * dependent_exception); +extern "C" _LIBCXXABI_FUNC_VIS __cxa_eh_globals * __cxa_get_globals (); +extern "C" _LIBCXXABI_FUNC_VIS __cxa_eh_globals * __cxa_get_globals_fast (); -#pragma GCC visibility pop +extern "C" _LIBCXXABI_FUNC_VIS void * __cxa_allocate_dependent_exception (); +extern "C" _LIBCXXABI_FUNC_VIS void __cxa_free_dependent_exception (void * dependent_exception); } // namespace __cxxabiv1 Index: libcxxabi/trunk/src/cxa_exception.cpp =================================================================== --- libcxxabi/trunk/src/cxa_exception.cpp +++ libcxxabi/trunk/src/cxa_exception.cpp @@ -33,8 +33,6 @@ namespace __cxxabiv1 { -#pragma GCC visibility push(default) - // Utility routines static inline @@ -139,7 +137,7 @@ // object. Zero-fill the object. If memory can't be allocated, call // std::terminate. Return a pointer to the memory to be used for the // user's exception object. -_LIBCXXABI_FUNC_VIS void *__cxa_allocate_exception(size_t thrown_size) throw() { +void *__cxa_allocate_exception(size_t thrown_size) throw() { size_t actual_size = cxa_exception_size_from_exception_thrown_size(thrown_size); __cxa_exception *exception_header = static_cast<__cxa_exception *>(__malloc_with_fallback(actual_size)); @@ -151,7 +149,7 @@ // Free a __cxa_exception object allocated with __cxa_allocate_exception. -_LIBCXXABI_FUNC_VIS void __cxa_free_exception(void *thrown_object) throw() { +void __cxa_free_exception(void *thrown_object) throw() { __free_with_fallback(cxa_exception_from_thrown_object(thrown_object)); } @@ -202,7 +200,7 @@ will call terminate, assuming that there was no handler for the exception. */ -_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void +void __cxa_throw(void *thrown_object, std::type_info *tinfo, void (*dest)(void *)) { __cxa_eh_globals *globals = __cxa_get_globals(); __cxa_exception* exception_header = cxa_exception_from_thrown_object(thrown_object); @@ -235,7 +233,6 @@ Requires: exception is native */ -_LIBCXXABI_FUNC_VIS void *__cxa_get_exception_ptr(void *unwind_exception) throw() { #if _LIBCXXABI_ARM_EHABI return reinterpret_cast( @@ -251,7 +248,6 @@ The routine to be called before the cleanup. This will save __cxa_exception in __cxa_eh_globals, so that __cxa_end_cleanup() can recover later. */ -_LIBCXXABI_FUNC_VIS bool __cxa_begin_cleanup(void *unwind_arg) throw() { _Unwind_Exception* unwind_exception = static_cast<_Unwind_Exception*>(unwind_arg); __cxa_eh_globals* globals = __cxa_get_globals(); @@ -423,7 +419,7 @@ * If it has been rethrown, there is nothing to do. * Otherwise delete the exception and pop the catch stack to empty. */ -_LIBCXXABI_FUNC_VIS void __cxa_end_catch() { +void __cxa_end_catch() { static_assert(sizeof(__cxa_exception) == sizeof(__cxa_dependent_exception), "sizeof(__cxa_exception) must be equal to " "sizeof(__cxa_dependent_exception)"); @@ -500,7 +496,7 @@ // Note: exception_header may be masquerading as a __cxa_dependent_exception // and that's ok. exceptionType is there too. // However watch out for foreign exceptions. Return null for them. -_LIBCXXABI_FUNC_VIS std::type_info *__cxa_current_exception_type() { +std::type_info *__cxa_current_exception_type() { // get the current exception __cxa_eh_globals *globals = __cxa_get_globals_fast(); if (NULL == globals) @@ -525,7 +521,7 @@ Note: exception_header may be masquerading as a __cxa_dependent_exception and that's ok. */ -_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_rethrow() { +void __cxa_rethrow() { __cxa_eh_globals* globals = __cxa_get_globals(); __cxa_exception* exception_header = globals->caughtExceptions; if (NULL == exception_header) @@ -570,7 +566,7 @@ Requires: If thrown_object is not NULL, it is a native exception. */ -_LIBCXXABI_FUNC_VIS void +void __cxa_increment_exception_refcount(void *thrown_object) throw() { if (thrown_object != NULL ) { @@ -587,7 +583,7 @@ Requires: If thrown_object is not NULL, it is a native exception. */ -_LIBCXXABI_FUNC_VIS void +void __cxa_decrement_exception_refcount(void *thrown_object) throw() { if (thrown_object != NULL ) { @@ -611,7 +607,7 @@ been no exceptions thrown, ever, on this thread, we can return NULL without the need to allocate the exception-handling globals. */ -_LIBCXXABI_FUNC_VIS void *__cxa_current_primary_exception() throw() { +void *__cxa_current_primary_exception() throw() { // get the current exception __cxa_eh_globals* globals = __cxa_get_globals_fast(); if (NULL == globals) @@ -697,6 +693,4 @@ } // extern "C" -#pragma GCC visibility pop - } // abi Index: libcxxabi/trunk/src/cxa_handlers.hpp =================================================================== --- libcxxabi/trunk/src/cxa_handlers.hpp +++ libcxxabi/trunk/src/cxa_handlers.hpp @@ -20,11 +20,11 @@ namespace std { -__attribute__((visibility("hidden"), noreturn)) +_LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN void __unexpected(unexpected_handler func); -__attribute__((visibility("hidden"), noreturn)) +_LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN void __terminate(terminate_handler func) _NOEXCEPT; Index: libcxxabi/trunk/src/cxa_handlers.cpp =================================================================== --- libcxxabi/trunk/src/cxa_handlers.cpp +++ libcxxabi/trunk/src/cxa_handlers.cpp @@ -32,7 +32,6 @@ // return __cxa_unexpected_handler.load(memory_order_acq); } -__attribute__((visibility("hidden"), noreturn)) void __unexpected(unexpected_handler func) { @@ -57,7 +56,6 @@ // return __cxa_terminate_handler.load(memory_order_acq); } -__attribute__((visibility("hidden"), noreturn)) void __terminate(terminate_handler func) _NOEXCEPT { @@ -105,7 +103,7 @@ // In the future this will become: // std::atomic __cxa_new_handler(0); extern "C" { -_LIBCXXABI_DATA_VIS new_handler __cxa_new_handler = 0; +new_handler __cxa_new_handler = 0; } new_handler Index: libcxxabi/trunk/src/cxa_new_delete.cpp =================================================================== --- libcxxabi/trunk/src/cxa_new_delete.cpp +++ libcxxabi/trunk/src/cxa_new_delete.cpp @@ -11,6 +11,7 @@ #define _LIBCPP_BUILDING_NEW +#include "__cxxabi_config.h" #include #include @@ -36,7 +37,7 @@ * The loop terminates when an attempt to allocate the requested storage is successful or when a called new_handler function does not return. */ -__attribute__((__weak__, __visibility__("default"))) +_LIBCXXABI_WEAK void * operator new(std::size_t size) _THROW_BAD_ALLOC { @@ -70,7 +71,7 @@ Calls operator new(size). If the call returns normally, returns the result of that call. Otherwise, returns a null pointer. */ -__attribute__((__weak__, __visibility__("default"))) +_LIBCXXABI_WEAK void* operator new(size_t size, const std::nothrow_t&) _NOEXCEPT { @@ -94,7 +95,7 @@ Returns operator new(size). */ -__attribute__((__weak__, __visibility__("default"))) +_LIBCXXABI_WEAK void* operator new[](size_t size) _THROW_BAD_ALLOC { @@ -107,7 +108,7 @@ Calls operator new[](size). If the call returns normally, returns the result of that call. Otherwise, returns a null pointer. */ -__attribute__((__weak__, __visibility__("default"))) +_LIBCXXABI_WEAK void* operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT { @@ -132,7 +133,7 @@ If ptr is null, does nothing. Otherwise, reclaims the storage allocated by the earlier call to operator new. */ -__attribute__((__weak__, __visibility__("default"))) +_LIBCXXABI_WEAK void operator delete(void* ptr) _NOEXCEPT { @@ -145,7 +146,7 @@ calls operator delete(ptr) */ -__attribute__((__weak__, __visibility__("default"))) +_LIBCXXABI_WEAK void operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT { @@ -157,7 +158,7 @@ Calls operator delete(ptr) */ -__attribute__((__weak__, __visibility__("default"))) +_LIBCXXABI_WEAK void operator delete[] (void* ptr) _NOEXCEPT { @@ -169,7 +170,7 @@ calls operator delete[](ptr) */ -__attribute__((__weak__, __visibility__("default"))) +_LIBCXXABI_WEAK void operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT { Index: libcxxabi/trunk/src/cxa_noexception.cpp =================================================================== --- libcxxabi/trunk/src/cxa_noexception.cpp +++ libcxxabi/trunk/src/cxa_noexception.cpp @@ -22,8 +22,6 @@ namespace __cxxabiv1 { -#pragma GCC visibility push(default) - extern "C" { void @@ -55,6 +53,4 @@ } // extern "C" -#pragma GCC visibility pop - } // abi Index: libcxxabi/trunk/src/cxa_thread_atexit.cpp =================================================================== --- libcxxabi/trunk/src/cxa_thread_atexit.cpp +++ libcxxabi/trunk/src/cxa_thread_atexit.cpp @@ -20,7 +20,7 @@ #ifndef HAVE___CXA_THREAD_ATEXIT_IMPL // A weak symbol is used to detect this function's presence in the C library // at runtime, even if libc++ is built against an older libc - __attribute__((__weak__)) + _LIBCXXABI_WEAK #endif int __cxa_thread_atexit_impl(Dtor, void*, void*); Index: libcxxabi/trunk/src/cxa_unexpected.cpp =================================================================== --- libcxxabi/trunk/src/cxa_unexpected.cpp +++ libcxxabi/trunk/src/cxa_unexpected.cpp @@ -14,14 +14,10 @@ namespace __cxxabiv1 { -#pragma GCC visibility push(default) - extern "C" { } -#pragma GCC visibility pop - } // namespace __cxxabiv1 Index: libcxxabi/trunk/src/fallback_malloc.h =================================================================== --- libcxxabi/trunk/src/fallback_malloc.h +++ libcxxabi/trunk/src/fallback_malloc.h @@ -10,21 +10,18 @@ #ifndef _FALLBACK_MALLOC_H #define _FALLBACK_MALLOC_H +#include "__cxxabi_config.h" #include // for size_t namespace __cxxabiv1 { -#pragma GCC visibility push(hidden) - // Allocate some memory from _somewhere_ -void * __malloc_with_fallback(size_t size); +_LIBCXXABI_HIDDEN void * __malloc_with_fallback(size_t size); // Allocate and zero-initialize memory from _somewhere_ -void * __calloc_with_fallback(size_t count, size_t size); - -void __free_with_fallback(void *ptr); +_LIBCXXABI_HIDDEN void * __calloc_with_fallback(size_t count, size_t size); -#pragma GCC visibility pop +_LIBCXXABI_HIDDEN void __free_with_fallback(void *ptr); } // namespace __cxxabiv1 Index: libcxxabi/trunk/src/fallback_malloc.cpp =================================================================== --- libcxxabi/trunk/src/fallback_malloc.cpp +++ libcxxabi/trunk/src/fallback_malloc.cpp @@ -194,8 +194,6 @@ namespace __cxxabiv1 { -#pragma GCC visibility push(hidden) - void * __malloc_with_fallback(size_t size) { void *ptr = std::malloc(size); if (NULL == ptr) // if malloc fails, fall back to emergency stash @@ -221,6 +219,4 @@ std::free(ptr); } -#pragma GCC visibility pop - } // namespace __cxxabiv1 Index: libcxxabi/trunk/src/private_typeinfo.h =================================================================== --- libcxxabi/trunk/src/private_typeinfo.h +++ libcxxabi/trunk/src/private_typeinfo.h @@ -16,7 +16,6 @@ #include namespace __cxxabiv1 { -#pragma GCC visibility push(hidden) class _LIBCXXABI_TYPE_VIS __shim_type_info : public std::type_info { public: @@ -67,7 +66,7 @@ class _LIBCXXABI_TYPE_VIS __class_type_info; -struct __dynamic_cast_info +struct _LIBCXXABI_HIDDEN __dynamic_cast_info { // const data supplied to the search: @@ -153,7 +152,7 @@ has_unambiguous_public_base(__dynamic_cast_info *, void *, int) const; }; -struct __base_class_type_info +struct _LIBCXXABI_HIDDEN __base_class_type_info { public: const __class_type_info* __base_type; @@ -248,8 +247,6 @@ _LIBCXXABI_HIDDEN bool can_catch_nested(const __shim_type_info *) const; }; -#pragma GCC visibility pop - } // __cxxabiv1 #endif // __PRIVATE_TYPEINFO_H_ Index: libcxxabi/trunk/src/private_typeinfo.cpp =================================================================== --- libcxxabi/trunk/src/private_typeinfo.cpp +++ libcxxabi/trunk/src/private_typeinfo.cpp @@ -55,12 +55,7 @@ #include #endif -namespace __cxxabiv1 -{ - -#pragma GCC visibility push(hidden) - -inline +static inline bool is_equal(const std::type_info* x, const std::type_info* y, bool use_strcmp) { @@ -73,6 +68,8 @@ #endif } +namespace __cxxabiv1 +{ // __shim_type_info @@ -538,9 +535,6 @@ #pragma clang diagnostic pop #endif -#pragma GCC visibility pop -#pragma GCC visibility push(default) - #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wmissing-field-initializers" @@ -715,9 +709,6 @@ #pragma clang diagnostic pop #endif -#pragma GCC visibility pop -#pragma GCC visibility push(hidden) - // Call this function when you hit a static_type which is a base (above) a dst_type. // Let caller know you hit a static_type. But only start recording details if // this is (static_ptr, static_type) -- the node we are casting from. @@ -1300,6 +1291,4 @@ use_strcmp); } -#pragma GCC visibility pop - } // __cxxabiv1 Index: libcxxabi/trunk/src/stdlib_exception.cpp =================================================================== --- libcxxabi/trunk/src/stdlib_exception.cpp +++ libcxxabi/trunk/src/stdlib_exception.cpp @@ -9,8 +9,6 @@ #include -#pragma GCC visibility push(default) - namespace std { @@ -37,5 +35,3 @@ } } // std - -#pragma GCC visibility pop