Index: include/__cxxabi_config.h =================================================================== --- include/__cxxabi_config.h +++ include/__cxxabi_config.h @@ -10,11 +10,35 @@ #ifndef ____CXXABI_CONFIG_H #define ____CXXABI_CONFIG_H -#if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ +#if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ !defined(__ARM_DWARF_EH__) #define LIBCXXABI_ARM_EHABI 1 #else #define LIBCXXABI_ARM_EHABI 0 #endif +#if !defined(__has_attribute) +#define __has_attribute(_attribute_) 0 +#endif + +#if defined(LIBCXXABI_DLL) + #if defined(cxxabi_EXPORTS) + #define _LIBCXXABI_HIDDEN + #define _LIBCXXABI_FUNC_VIS __declspec(dllexport) + #define _LIBCXXABI_TYPE_VIS __declspec(dllexport) + #else + #define _LIBCXXABI_HIDDEN + #define _LIBCXXABI_FUNC_VIS __declspec(dllimport) + #define _LIBCXXABI_TYPE_VIS __declspec(dllimport) + #endif +#else + #define _LIBCXXABI_HIDDEN __attribute__((__visibility__("hidden"))) + #define _LIBCXXABI_FUNC_VIS __attribute__((__visibility__("default"))) + #if __has_attribute(__type_visibility__) + #define _LIBCXXABI_TYPE_VIS __attribute__((__type_visibility__("default"))) + #else + #define _LIBCXXABI_TYPE_VIS __attribute__((__visibility__("default"))) + #endif +#endif + #endif // ____CXXABI_CONFIG_H Index: include/cxxabi.h =================================================================== --- include/cxxabi.h +++ include/cxxabi.h @@ -26,7 +26,7 @@ #ifdef __cplusplus namespace std { -class type_info; // forward declaration +class _LIBCXXABI_TYPE_VIS type_info; // forward declaration } @@ -35,143 +35,135 @@ extern "C" { // 2.4.2 Allocating the Exception Object -extern void * __cxa_allocate_exception(size_t thrown_size) throw(); -extern void __cxa_free_exception(void * thrown_exception) throw(); +extern _LIBCXXABI_FUNC_VIS void * +__cxa_allocate_exception(size_t thrown_size) throw(); +extern _LIBCXXABI_FUNC_VIS void +__cxa_free_exception(void *thrown_exception) throw(); // 2.4.3 Throwing the Exception Object -extern LIBCXXABI_NORETURN void __cxa_throw(void * thrown_exception, - std::type_info * tinfo, void (*dest)(void *)); +extern _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void +__cxa_throw(void *thrown_exception, std::type_info *tinfo, + void (*dest)(void *)); // 2.5.3 Exception Handlers -extern void * __cxa_get_exception_ptr(void * exceptionObject) throw(); -extern void * __cxa_begin_catch(void * exceptionObject) throw(); -extern void __cxa_end_catch(); +extern _LIBCXXABI_FUNC_VIS void * +__cxa_get_exception_ptr(void *exceptionObject) throw(); +extern _LIBCXXABI_FUNC_VIS void * +__cxa_begin_catch(void *exceptionObject) throw(); +extern _LIBCXXABI_FUNC_VIS void __cxa_end_catch(); #if LIBCXXABI_ARM_EHABI -extern bool __cxa_begin_cleanup(void * exceptionObject) throw(); -extern void __cxa_end_cleanup(); +extern _LIBCXXABI_FUNC_VIS bool +__cxa_begin_cleanup(void *exceptionObject) throw(); +extern _LIBCXXABI_FUNC_VIS void __cxa_end_cleanup(); #endif -extern std::type_info * __cxa_current_exception_type(); +extern _LIBCXXABI_FUNC_VIS std::type_info *__cxa_current_exception_type(); // 2.5.4 Rethrowing Exceptions -extern LIBCXXABI_NORETURN void __cxa_rethrow(); - - +extern _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_rethrow(); // 2.6 Auxiliary Runtime APIs -extern LIBCXXABI_NORETURN void __cxa_bad_cast(void); -extern LIBCXXABI_NORETURN void __cxa_bad_typeid(void); -extern LIBCXXABI_NORETURN void __cxa_throw_bad_array_new_length(void); - - +extern _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_cast(void); +extern _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_typeid(void); +extern _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void +__cxa_throw_bad_array_new_length(void); // 3.2.6 Pure Virtual Function API -extern LIBCXXABI_NORETURN void __cxa_pure_virtual(void); +extern _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_pure_virtual(void); // 3.2.7 Deleted Virtual Function API -extern LIBCXXABI_NORETURN void __cxa_deleted_virtual(void); +extern _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_deleted_virtual(void); // 3.3.2 One-time Construction API #ifdef __arm__ -extern int __cxa_guard_acquire(uint32_t*); -extern void __cxa_guard_release(uint32_t*); -extern void __cxa_guard_abort(uint32_t*); +extern _LIBCXXABI_FUNC_VIS int __cxa_guard_acquire(uint32_t*); +extern _LIBCXXABI_FUNC_VIS void __cxa_guard_release(uint32_t*); +extern _LIBCXXABI_FUNC_VIS void __cxa_guard_abort(uint32_t*); #else -extern int __cxa_guard_acquire(uint64_t*); -extern void __cxa_guard_release(uint64_t*); -extern void __cxa_guard_abort(uint64_t*); +extern _LIBCXXABI_FUNC_VIS int __cxa_guard_acquire(uint64_t*); +extern _LIBCXXABI_FUNC_VIS void __cxa_guard_release(uint64_t*); +extern _LIBCXXABI_FUNC_VIS void __cxa_guard_abort(uint64_t*); #endif // 3.3.3 Array Construction and Destruction API -extern void* __cxa_vec_new(size_t element_count, - size_t element_size, - size_t padding_size, - void (*constructor)(void*), - void (*destructor)(void*)); - -extern void* __cxa_vec_new2(size_t element_count, - size_t element_size, - size_t padding_size, - void (*constructor)(void*), - void (*destructor)(void*), - void* (*alloc)(size_t), - void (*dealloc)(void*)); - -extern void* __cxa_vec_new3(size_t element_count, - size_t element_size, - size_t padding_size, - void (*constructor)(void*), - void (*destructor)(void*), - void* (*alloc)(size_t), - void (*dealloc)(void*, size_t)); - -extern void __cxa_vec_ctor(void* array_address, - size_t element_count, - size_t element_size, - void (*constructor)(void*), - void (*destructor)(void*)); - -extern void __cxa_vec_dtor(void* array_address, - size_t element_count, - size_t element_size, - void (*destructor)(void*)); - -extern void __cxa_vec_cleanup(void* array_address, - size_t element_count, - size_t element_size, - void (*destructor)(void*)); - -extern void __cxa_vec_delete(void* array_address, - size_t element_size, - size_t padding_size, - void (*destructor)(void*)); - -extern void __cxa_vec_delete2(void* array_address, - size_t element_size, - size_t padding_size, - void (*destructor)(void*), - void (*dealloc)(void*)); - -extern void __cxa_vec_delete3(void* __array_address, - size_t element_size, - size_t padding_size, - void (*destructor)(void*), - void (*dealloc)(void*, size_t)); - -extern void __cxa_vec_cctor(void* dest_array, - void* src_array, - size_t element_count, - size_t element_size, - void (*constructor)(void*, void*), - void (*destructor)(void*)); +extern _LIBCXXABI_FUNC_VIS void * +__cxa_vec_new(size_t element_count, size_t element_size, size_t padding_size, + void (*constructor)(void *), void (*destructor)(void *)); + +extern _LIBCXXABI_FUNC_VIS void * +__cxa_vec_new2(size_t element_count, size_t element_size, size_t padding_size, + void (*constructor)(void *), void (*destructor)(void *), + void *(*alloc)(size_t), void (*dealloc)(void *)); + +extern _LIBCXXABI_FUNC_VIS void * +__cxa_vec_new3(size_t element_count, size_t element_size, size_t padding_size, + void (*constructor)(void *), void (*destructor)(void *), + void *(*alloc)(size_t), void (*dealloc)(void *, size_t)); + +extern _LIBCXXABI_FUNC_VIS void +__cxa_vec_ctor(void *array_address, size_t element_count, size_t element_size, + void (*constructor)(void *), void (*destructor)(void *)); + +extern _LIBCXXABI_FUNC_VIS void __cxa_vec_dtor(void *array_address, + size_t element_count, + size_t element_size, + void (*destructor)(void *)); + +extern _LIBCXXABI_FUNC_VIS void __cxa_vec_cleanup(void *array_address, + size_t element_count, + size_t element_size, + void (*destructor)(void *)); + +extern _LIBCXXABI_FUNC_VIS void __cxa_vec_delete(void *array_address, + size_t element_size, + size_t padding_size, + void (*destructor)(void *)); + +extern _LIBCXXABI_FUNC_VIS void +__cxa_vec_delete2(void *array_address, size_t element_size, size_t padding_size, + void (*destructor)(void *), void (*dealloc)(void *)); + +extern _LIBCXXABI_FUNC_VIS void +__cxa_vec_delete3(void *__array_address, size_t element_size, + size_t padding_size, void (*destructor)(void *), + void (*dealloc)(void *, size_t)); + +extern _LIBCXXABI_FUNC_VIS void +__cxa_vec_cctor(void *dest_array, void *src_array, size_t element_count, + size_t element_size, void (*constructor)(void *, void *), + void (*destructor)(void *)); // 3.3.5.3 Runtime API -extern int __cxa_atexit(void (*f)(void*), void* p, void* d); -extern int __cxa_finalize(void*); +extern _LIBCXXABI_FUNC_VIS int __cxa_atexit(void (*f)(void *), void *p, + void *d); +extern _LIBCXXABI_FUNC_VIS int __cxa_finalize(void*); // 3.4 Demangler API -extern char* __cxa_demangle(const char* mangled_name, - char* output_buffer, - size_t* length, - int* status); +extern _LIBCXXABI_FUNC_VIS char *__cxa_demangle(const char *mangled_name, + char *output_buffer, + size_t *length, int *status); // Apple additions to support C++ 0x exception_ptr class // These are primitives to wrap a smart pointer around an exception object -extern void * __cxa_current_primary_exception() throw(); -extern void __cxa_rethrow_primary_exception(void* primary_exception); -extern void __cxa_increment_exception_refcount(void* primary_exception) throw(); -extern void __cxa_decrement_exception_refcount(void* primary_exception) throw(); +extern _LIBCXXABI_FUNC_VIS void *__cxa_current_primary_exception() throw(); +extern _LIBCXXABI_FUNC_VIS void +__cxa_rethrow_primary_exception(void *primary_exception); +extern _LIBCXXABI_FUNC_VIS void +__cxa_increment_exception_refcount(void *primary_exception) throw(); +extern _LIBCXXABI_FUNC_VIS void +__cxa_decrement_exception_refcount(void *primary_exception) throw(); // Apple extension to support std::uncaught_exception() -extern bool __cxa_uncaught_exception () throw(); -extern unsigned int __cxa_uncaught_exceptions() throw(); +extern _LIBCXXABI_FUNC_VIS bool __cxa_uncaught_exception() throw(); +extern _LIBCXXABI_FUNC_VIS unsigned int __cxa_uncaught_exceptions() throw(); #ifdef __linux__ // Linux TLS support. Not yet an official part of the Itanium ABI. // https://sourceware.org/glibc/wiki/Destructor%20support%20for%20thread_local%20variables -extern int __cxa_thread_atexit(void (*)(void *), void *, void *) throw(); +extern _LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(void (*)(void *), void *, + void *) throw(); #endif - } // extern "C" +} // extern "C" } // namespace __cxxabiv1 namespace abi = __cxxabiv1; Index: src/cxa_aux_runtime.cpp =================================================================== --- src/cxa_aux_runtime.cpp +++ src/cxa_aux_runtime.cpp @@ -14,26 +14,19 @@ #include #include -namespace __cxxabiv1 -{ - -extern "C" -{ - -LIBCXXABI_NORETURN -void __cxa_bad_cast (void) { - throw std::bad_cast(); +namespace __cxxabiv1 { +extern "C" { +_LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_cast(void) { + throw std::bad_cast(); } -LIBCXXABI_NORETURN -void __cxa_bad_typeid(void) { - throw std::bad_typeid(); +_LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_typeid(void) { + throw std::bad_typeid(); } -LIBCXXABI_NORETURN -void __cxa_throw_bad_array_new_length(void) { - throw std::bad_array_new_length(); +_LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void +__cxa_throw_bad_array_new_length(void) { + throw std::bad_array_new_length(); } -} // extern "C" - -} // abi +} // extern "C" +} // abi Index: src/cxa_demangle.cpp =================================================================== --- src/cxa_demangle.cpp +++ src/cxa_demangle.cpp @@ -10,6 +10,8 @@ #define _LIBCPP_EXTERN_TEMPLATE(...) #define _LIBCPP_NO_EXCEPTIONS +#include "__cxxabi_config.h" + #include #include #include @@ -4922,9 +4924,7 @@ } // unnamed namespace -extern "C" -__attribute__ ((__visibility__("default"))) -char* +extern "C" _LIBCXXABI_FUNC_VIS char* __cxa_demangle(const char* mangled_name, char* buf, size_t* n, int* status) { if (mangled_name == nullptr || (buf != nullptr && n == nullptr)) Index: src/cxa_exception.cpp =================================================================== --- src/cxa_exception.cpp +++ src/cxa_exception.cpp @@ -156,7 +156,8 @@ // 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. -void * __cxa_allocate_exception (size_t thrown_size) throw() { +_LIBCXXABI_FUNC_VIS +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*>(do_malloc(actual_size)); if (NULL == exception_header) @@ -167,7 +168,7 @@ // Free a __cxa_exception object allocated with __cxa_allocate_exception. -void __cxa_free_exception (void * thrown_object) throw() { +_LIBCXXABI_FUNC_VIS void __cxa_free_exception(void *thrown_object) throw() { do_free(cxa_exception_from_thrown_object(thrown_object)); } @@ -218,10 +219,8 @@ will call terminate, assuming that there was no handler for the exception. */ -LIBCXXABI_NORETURN -void -__cxa_throw(void* thrown_object, std::type_info* tinfo, void (*dest)(void*)) -{ +_LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN 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); @@ -253,9 +252,8 @@ Requires: exception is native */ -void* -__cxa_get_exception_ptr(void* unwind_exception) throw() -{ +_LIBCXXABI_FUNC_VIS void * +__cxa_get_exception_ptr(void *unwind_exception) throw() { #if LIBCXXABI_ARM_EHABI return reinterpret_cast( static_cast<_Unwind_Control_Block*>(unwind_exception)->barrier_cache.bitpattern[0]); @@ -270,9 +268,7 @@ 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. */ -bool -__cxa_begin_cleanup(void* unwind_arg) throw () -{ +_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(); __cxa_exception* exception_header = @@ -443,8 +439,7 @@ * If it has been rethrown, there is nothing to do. * Otherwise delete the exception and pop the catch stack to empty. */ -void __cxa_end_catch() -{ +_LIBCXXABI_FUNC_VIS void __cxa_end_catch() { static_assert(sizeof(__cxa_exception) == sizeof(__cxa_dependent_exception), "sizeof(__cxa_exception) must be equal to " "sizeof(__cxa_dependent_exception)"); @@ -521,7 +516,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. -std::type_info * __cxa_current_exception_type() { +_LIBCXXABI_FUNC_VIS std::type_info * __cxa_current_exception_type() { // get the current exception __cxa_eh_globals *globals = __cxa_get_globals_fast(); if (NULL == globals) @@ -546,10 +541,7 @@ Note: exception_header may be masquerading as a __cxa_dependent_exception and that's ok. */ -LIBCXXABI_NORETURN -void -__cxa_rethrow() -{ +_LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_rethrow() { __cxa_eh_globals* globals = __cxa_get_globals(); __cxa_exception* exception_header = globals->caughtExceptions; if (NULL == exception_header) @@ -594,9 +586,8 @@ Requires: If thrown_object is not NULL, it is a native exception. */ -void -__cxa_increment_exception_refcount(void* thrown_object) throw() -{ +_LIBCXXABI_FUNC_VIS void +__cxa_increment_exception_refcount(void *thrown_object) throw() { if (thrown_object != NULL ) { __cxa_exception* exception_header = cxa_exception_from_thrown_object(thrown_object); @@ -612,9 +603,8 @@ Requires: If thrown_object is not NULL, it is a native exception. */ -void -__cxa_decrement_exception_refcount(void* thrown_object) throw() -{ +_LIBCXXABI_FUNC_VIS void +__cxa_decrement_exception_refcount(void *thrown_object) throw() { if (thrown_object != NULL ) { __cxa_exception* exception_header = cxa_exception_from_thrown_object(thrown_object); @@ -637,9 +627,7 @@ been no exceptions thrown, ever, on this thread, we can return NULL without the need to allocate the exception-handling globals. */ -void* -__cxa_current_primary_exception() throw() -{ +_LIBCXXABI_FUNC_VIS void* __cxa_current_primary_exception() throw() { // get the current exception __cxa_eh_globals* globals = __cxa_get_globals_fast(); if (NULL == globals) Index: src/cxa_guard.cpp =================================================================== --- src/cxa_guard.cpp +++ src/cxa_guard.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +#include "__cxxabi_config.h" + #include "abort_message.h" #include "config.h" @@ -167,26 +169,22 @@ { #if LIBCXXABI_HAS_NO_THREADS -int __cxa_guard_acquire(guard_type* guard_object) -{ - return !is_initialized(guard_object); +_LIBCXXABI_FUNC_VIS int __cxa_guard_acquire(guard_type *guard_object) { + return !is_initialized(guard_object); } -void __cxa_guard_release(guard_type* guard_object) -{ - *guard_object = 0; - set_initialized(guard_object); +_LIBCXXABI_FUNC_VIS void __cxa_guard_release(guard_type *guard_object) { + *guard_object = 0; + set_initialized(guard_object); } -void __cxa_guard_abort(guard_type* guard_object) -{ - *guard_object = 0; +_LIBCXXABI_FUNC_VIS void __cxa_guard_abort(guard_type *guard_object) { + *guard_object = 0; } #else // !LIBCXXABI_HAS_NO_THREADS -int __cxa_guard_acquire(guard_type* guard_object) -{ +_LIBCXXABI_FUNC_VIS int __cxa_guard_acquire(guard_type *guard_object) { char* initialized = (char*)guard_object; if (pthread_mutex_lock(&guard_mut)) abort_message("__cxa_guard_acquire failed to acquire mutex"); @@ -227,8 +225,7 @@ return result; } -void __cxa_guard_release(guard_type* guard_object) -{ +_LIBCXXABI_FUNC_VIS void __cxa_guard_release(guard_type* guard_object) { if (pthread_mutex_lock(&guard_mut)) abort_message("__cxa_guard_release failed to acquire mutex"); *guard_object = 0; @@ -239,8 +236,7 @@ abort_message("__cxa_guard_release failed to broadcast condition variable"); } -void __cxa_guard_abort(guard_type* guard_object) -{ +_LIBCXXABI_FUNC_VIS void __cxa_guard_abort(guard_type* guard_object) { if (pthread_mutex_lock(&guard_mut)) abort_message("__cxa_guard_abort failed to acquire mutex"); *guard_object = 0; Index: src/cxa_thread_atexit.cpp =================================================================== --- src/cxa_thread_atexit.cpp +++ src/cxa_thread_atexit.cpp @@ -10,11 +10,11 @@ #include "cxxabi.h" namespace __cxxabiv1 { - extern "C" { #ifdef HAVE___CXA_THREAD_ATEXIT_IMPL +_LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(void (*dtor)(void *), void *obj, void *dso_symbol) throw() { extern int __cxa_thread_atexit_impl(void (*)(void *), void *, void *); @@ -24,5 +24,4 @@ #endif // HAVE__CXA_THREAD_ATEXIT_IMPL } // extern "C" - } // namespace __cxxabiv1 Index: src/cxa_vector.cpp =================================================================== --- src/cxa_vector.cpp +++ src/cxa_vector.cpp @@ -114,12 +114,11 @@ // // __cxa_vec_new2(element_count, element_size, padding_size, constructor, // destructor, &::operator new[], &::operator delete[]) -void* __cxa_vec_new( - size_t element_count, size_t element_size, size_t padding_size, - void (*constructor)(void*), void (*destructor)(void*) ) { - - return __cxa_vec_new2 ( element_count, element_size, padding_size, - constructor, destructor, &::operator new [], &::operator delete [] ); +_LIBCXXABI_FUNC_VIS void * +__cxa_vec_new(size_t element_count, size_t element_size, size_t padding_size, + void (*constructor)(void *), void (*destructor)(void *)) { + return __cxa_vec_new2(element_count, element_size, padding_size, constructor, + destructor, &::operator new[], & ::operator delete[]); } @@ -140,11 +139,10 @@ // not be called. // // Neither alloc nor dealloc may be NULL. -void* __cxa_vec_new2( - size_t element_count, size_t element_size, size_t padding_size, - void (*constructor)(void*), void (*destructor)(void*), - void* (*alloc)(size_t), void (*dealloc)(void*) ) { - +_LIBCXXABI_FUNC_VIS void * +__cxa_vec_new2(size_t element_count, size_t element_size, size_t padding_size, + void (*constructor)(void *), void (*destructor)(void *), + void *(*alloc)(size_t), void (*dealloc)(void *)) { const size_t heap_size = element_count * element_size + padding_size; char * const heap_block = static_cast ( alloc ( heap_size )); char *vec_base = heap_block; @@ -169,11 +167,10 @@ // Same as __cxa_vec_new2 except that the deallocation function takes both // the object address and its size. -void* __cxa_vec_new3( - size_t element_count, size_t element_size, size_t padding_size, - void (*constructor)(void*), void (*destructor)(void*), - void* (*alloc)(size_t), void (*dealloc)(void*, size_t) ) { - +_LIBCXXABI_FUNC_VIS void * +__cxa_vec_new3(size_t element_count, size_t element_size, size_t padding_size, + void (*constructor)(void *), void (*destructor)(void *), + void *(*alloc)(size_t), void (*dealloc)(void *, size_t)) { const size_t heap_size = element_count * element_size + padding_size; char * const heap_block = static_cast ( alloc ( heap_size )); char *vec_base = heap_block; @@ -206,10 +203,11 @@ // pointers may be NULL. If either is NULL, no action is taken when it // would have been called. -void __cxa_vec_cctor( void* dest_array, void* src_array, - size_t element_count, size_t element_size, - void (*constructor) (void*, void*), void (*destructor)(void*) ) { - +_LIBCXXABI_FUNC_VIS void __cxa_vec_cctor(void *dest_array, void *src_array, + size_t element_count, + size_t element_size, + void (*constructor)(void *, void *), + void (*destructor)(void *)) { if ( NULL != constructor ) { size_t idx = 0; char *src_ptr = static_cast(src_array); @@ -231,10 +229,9 @@ // exception. If the destructor throws an exception, call terminate(). The // constructor and/or destructor pointers may be NULL. If either is NULL, // no action is taken when it would have been called. -void __cxa_vec_ctor( - void* array_address, size_t element_count, size_t element_size, - void (*constructor)(void*), void (*destructor)(void*) ) { - +_LIBCXXABI_FUNC_VIS void +__cxa_vec_ctor(void *array_address, size_t element_count, size_t element_size, + void (*constructor)(void *), void (*destructor)(void *)) { if ( NULL != constructor ) { size_t idx; char *ptr = static_cast ( array_address ); @@ -253,10 +250,10 @@ // elements if possible. If the destructor throws a second exception, call // terminate(). The destructor pointer may be NULL, in which case this // routine does nothing. -void __cxa_vec_dtor( - void* array_address, size_t element_count, size_t element_size, - void (*destructor)(void*) ) { - +_LIBCXXABI_FUNC_VIS void __cxa_vec_dtor(void *array_address, + size_t element_count, + size_t element_size, + void (*destructor)(void *)) { if ( NULL != destructor ) { char *ptr = static_cast (array_address); size_t idx = element_count; @@ -279,9 +276,10 @@ // size of its elements, call the given destructor on each element. If the // destructor throws an exception, call terminate(). The destructor pointer // may be NULL, in which case this routine does nothing. -void __cxa_vec_cleanup( void* array_address, size_t element_count, - size_t element_size, void (*destructor)(void*) ) { - +_LIBCXXABI_FUNC_VIS void __cxa_vec_cleanup(void *array_address, + size_t element_count, + size_t element_size, + void (*destructor)(void *)) { if ( NULL != destructor ) { char *ptr = static_cast (array_address); size_t idx = element_count; @@ -316,22 +314,21 @@ // function be called even if the destructor throws an exception derives // from the resolution to DR 353 to the C++ standard, which was adopted in // April, 2003. -void __cxa_vec_delete( void* array_address, - size_t element_size, size_t padding_size, void (*destructor)(void*) ) { - - __cxa_vec_delete2 ( array_address, element_size, padding_size, - destructor, &::operator delete [] ); +_LIBCXXABI_FUNC_VIS void __cxa_vec_delete(void *array_address, + size_t element_size, + size_t padding_size, + void (*destructor)(void *)) { + __cxa_vec_delete2(array_address, element_size, padding_size, destructor, + &::operator delete[]); } - // Same as __cxa_vec_delete, except that the given function is used for // deallocation instead of the default delete function. If dealloc throws // an exception, the result is undefined. The dealloc pointer may not be // NULL. -void __cxa_vec_delete2( void* array_address, - size_t element_size, size_t padding_size, - void (*destructor)(void*), void (*dealloc)(void*) ) { - +_LIBCXXABI_FUNC_VIS void +__cxa_vec_delete2(void *array_address, size_t element_size, size_t padding_size, + void (*destructor)(void *), void (*dealloc)(void *)) { if ( NULL != array_address ) { char *vec_base = static_cast (array_address); char *heap_block = vec_base - padding_size; @@ -349,10 +346,9 @@ // function takes both the object address and its size. If dealloc throws // an exception, the result is undefined. The dealloc pointer may not be // NULL. -void __cxa_vec_delete3( void* array_address, - size_t element_size, size_t padding_size, - void (*destructor)(void*), void (*dealloc) (void*, size_t)) { - +_LIBCXXABI_FUNC_VIS void +__cxa_vec_delete3(void *array_address, size_t element_size, size_t padding_size, + void (*destructor)(void *), void (*dealloc)(void *, size_t)) { if ( NULL != array_address ) { char *vec_base = static_cast (array_address); char *heap_block = vec_base - padding_size; Index: src/cxa_virtual.cpp =================================================================== --- src/cxa_virtual.cpp +++ src/cxa_virtual.cpp @@ -10,22 +10,14 @@ #include "cxxabi.h" #include "abort_message.h" -namespace __cxxabiv1 -{ - -extern "C" -{ - -LIBCXXABI_NORETURN -void __cxa_pure_virtual(void) { - abort_message("Pure virtual function called!"); +namespace __cxxabiv1 { +extern "C" { +_LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_pure_virtual(void) { + abort_message("Pure virtual function called!"); } -LIBCXXABI_NORETURN -void __cxa_deleted_virtual(void) { - abort_message("Deleted virtual function called!"); +_LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_deleted_virtual(void) { + abort_message("Deleted virtual function called!"); } - -} // extern "C" - -} // abi +} // extern "C" +} // abi Index: src/private_typeinfo.h =================================================================== --- src/private_typeinfo.h +++ src/private_typeinfo.h @@ -10,55 +10,51 @@ #ifndef __PRIVATE_TYPEINFO_H_ #define __PRIVATE_TYPEINFO_H_ +#include "__cxxabi_config.h" + #include #include -namespace __cxxabiv1 -{ +namespace __cxxabiv1 { #pragma GCC visibility push(hidden) -class __attribute__ ((__visibility__("default"))) __shim_type_info - : public std::type_info -{ +class _LIBCXXABI_TYPE_VIS __shim_type_info : public std::type_info { public: - __attribute__ ((__visibility__("hidden"))) virtual ~__shim_type_info(); + _LIBCXXABI_HIDDEN virtual ~__shim_type_info(); - __attribute__ ((__visibility__("hidden"))) virtual void noop1() const; - __attribute__ ((__visibility__("hidden"))) virtual void noop2() const; - __attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info* thrown_type, void*& adjustedPtr) const = 0; + _LIBCXXABI_HIDDEN virtual void noop1() const; + _LIBCXXABI_HIDDEN virtual void noop2() const; + _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *thrown_type, + void *&adjustedPtr) const = 0; }; -class __attribute__ ((__visibility__("default"))) __fundamental_type_info - : public __shim_type_info -{ +class _LIBCXXABI_TYPE_VIS __fundamental_type_info : public __shim_type_info { public: - __attribute__ ((__visibility__("hidden"))) virtual ~__fundamental_type_info(); - __attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info*, void*&) const; + _LIBCXXABI_HIDDEN virtual ~__fundamental_type_info(); + _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, + void *&) const; }; -class __attribute__ ((__visibility__("default"))) __array_type_info - : public __shim_type_info -{ +class _LIBCXXABI_TYPE_VIS __array_type_info : public __shim_type_info { public: - __attribute__ ((__visibility__("hidden"))) virtual ~__array_type_info(); - __attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info*, void*&) const; + _LIBCXXABI_HIDDEN virtual ~__array_type_info(); + _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, + void *&) const; }; -class __attribute__ ((__visibility__("default"))) __function_type_info - : public __shim_type_info -{ +class _LIBCXXABI_TYPE_VIS __function_type_info : public __shim_type_info { public: - __attribute__ ((__visibility__("hidden"))) virtual ~__function_type_info(); - __attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info*, void*&) const; + _LIBCXXABI_HIDDEN virtual ~__function_type_info(); + _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, + void *&) const; }; -class __attribute__ ((__visibility__("default"))) __enum_type_info - : public __shim_type_info -{ +class _LIBCXXABI_TYPE_VIS __enum_type_info : public __shim_type_info { public: - __attribute__ ((__visibility__("hidden"))) virtual ~__enum_type_info(); - __attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info*, void*&) const; + _LIBCXXABI_HIDDEN virtual ~__enum_type_info(); + _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, + void *&) const; }; enum @@ -70,7 +66,7 @@ no }; -class __attribute__ ((__visibility__("default"))) __class_type_info; +class _LIBCXXABI_TYPE_VIS __class_type_info; struct __dynamic_cast_info { @@ -120,43 +116,47 @@ }; // Has no base class -class __attribute__ ((__visibility__("default"))) __class_type_info - : public __shim_type_info -{ +class _LIBCXXABI_TYPE_VIS __class_type_info : public __shim_type_info { public: - __attribute__ ((__visibility__("hidden"))) virtual ~__class_type_info(); - - __attribute__ ((__visibility__("hidden"))) - void process_static_type_above_dst(__dynamic_cast_info*, const void*, const void*, int) const; - __attribute__ ((__visibility__("hidden"))) - void process_static_type_below_dst(__dynamic_cast_info*, const void*, int) const; - __attribute__ ((__visibility__("hidden"))) - void process_found_base_class(__dynamic_cast_info*, void*, int) const; - __attribute__ ((__visibility__("hidden"))) - virtual void search_above_dst(__dynamic_cast_info*, const void*, const void*, int, bool) const; - __attribute__ ((__visibility__("hidden"))) - virtual void search_below_dst(__dynamic_cast_info*, const void*, int, bool) const; - __attribute__ ((__visibility__("hidden"))) - virtual bool can_catch(const __shim_type_info*, void*&) const; - __attribute__ ((__visibility__("hidden"))) - virtual void has_unambiguous_public_base(__dynamic_cast_info*, void*, int) const; + _LIBCXXABI_HIDDEN virtual ~__class_type_info(); + + _LIBCXXABI_HIDDEN + void process_static_type_above_dst(__dynamic_cast_info *, const void *, + const void *, int) const; + _LIBCXXABI_HIDDEN + void process_static_type_below_dst(__dynamic_cast_info *, const void *, + int) const; + _LIBCXXABI_HIDDEN + void process_found_base_class(__dynamic_cast_info *, void *, int) const; + _LIBCXXABI_HIDDEN + virtual void search_above_dst(__dynamic_cast_info *, const void *, + const void *, int, bool) const; + _LIBCXXABI_HIDDEN + virtual void search_below_dst(__dynamic_cast_info *, const void *, int, + bool) const; + _LIBCXXABI_HIDDEN + virtual bool can_catch(const __shim_type_info *, void *&) const; + _LIBCXXABI_HIDDEN + virtual void has_unambiguous_public_base(__dynamic_cast_info *, void *, + int) const; }; // Has one non-virtual public base class at offset zero -class __attribute__ ((__visibility__("default"))) __si_class_type_info - : public __class_type_info -{ +class _LIBCXXABI_TYPE_VIS __si_class_type_info : public __class_type_info { public: - const __class_type_info* __base_type; - - __attribute__ ((__visibility__("hidden"))) virtual ~__si_class_type_info(); - - __attribute__ ((__visibility__("hidden"))) - virtual void search_above_dst(__dynamic_cast_info*, const void*, const void*, int, bool) const; - __attribute__ ((__visibility__("hidden"))) - virtual void search_below_dst(__dynamic_cast_info*, const void*, int, bool) const; - __attribute__ ((__visibility__("hidden"))) - virtual void has_unambiguous_public_base(__dynamic_cast_info*, void*, int) const; + const __class_type_info *__base_type; + + _LIBCXXABI_HIDDEN virtual ~__si_class_type_info(); + + _LIBCXXABI_HIDDEN + virtual void search_above_dst(__dynamic_cast_info *, const void *, + const void *, int, bool) const; + _LIBCXXABI_HIDDEN + virtual void search_below_dst(__dynamic_cast_info *, const void *, int, + bool) const; + _LIBCXXABI_HIDDEN + virtual void has_unambiguous_public_base(__dynamic_cast_info *, void *, + int) const; }; struct __base_class_type_info @@ -178,9 +178,7 @@ }; // Has one or more base classes -class __attribute__ ((__visibility__("default"))) __vmi_class_type_info - : public __class_type_info -{ +class _LIBCXXABI_TYPE_VIS __vmi_class_type_info : public __class_type_info { public: unsigned int __flags; unsigned int __base_count; @@ -194,19 +192,20 @@ // more derived objects }; - __attribute__ ((__visibility__("hidden"))) virtual ~__vmi_class_type_info(); - - __attribute__ ((__visibility__("hidden"))) - virtual void search_above_dst(__dynamic_cast_info*, const void*, const void*, int, bool) const; - __attribute__ ((__visibility__("hidden"))) - virtual void search_below_dst(__dynamic_cast_info*, const void*, int, bool) const; - __attribute__ ((__visibility__("hidden"))) - virtual void has_unambiguous_public_base(__dynamic_cast_info*, void*, int) const; + _LIBCXXABI_HIDDEN virtual ~__vmi_class_type_info(); + + _LIBCXXABI_HIDDEN + virtual void search_above_dst(__dynamic_cast_info *, const void *, + const void *, int, bool) const; + _LIBCXXABI_HIDDEN + virtual void search_below_dst(__dynamic_cast_info *, const void *, int, + bool) const; + _LIBCXXABI_HIDDEN + virtual void has_unambiguous_public_base(__dynamic_cast_info *, void *, + int) const; }; -class __attribute__ ((__visibility__("default"))) __pbase_type_info - : public __shim_type_info -{ +class _LIBCXXABI_TYPE_VIS __pbase_type_info : public __shim_type_info { public: unsigned int __flags; const __shim_type_info* __pointee; @@ -220,28 +219,28 @@ __incomplete_class_mask = 0x10 }; - __attribute__ ((__visibility__("hidden"))) virtual ~__pbase_type_info(); - __attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info*, void*&) const; + _LIBCXXABI_HIDDEN virtual ~__pbase_type_info(); + _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, + void *&) const; }; -class __attribute__ ((__visibility__("default"))) __pointer_type_info - : public __pbase_type_info -{ +class _LIBCXXABI_TYPE_VIS __pointer_type_info : public __pbase_type_info { public: - __attribute__ ((__visibility__("hidden"))) virtual ~__pointer_type_info(); - __attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info*, void*&) const; - __attribute__ ((__visibility__("hidden"))) bool can_catch_nested(const __shim_type_info*) const; + _LIBCXXABI_HIDDEN virtual ~__pointer_type_info(); + _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, + void *&) const; + _LIBCXXABI_HIDDEN bool can_catch_nested(const __shim_type_info *) const; }; -class __attribute__ ((__visibility__("default"))) __pointer_to_member_type_info - : public __pbase_type_info -{ +class _LIBCXXABI_TYPE_VIS __pointer_to_member_type_info + : public __pbase_type_info { public: const __class_type_info* __context; - __attribute__ ((__visibility__("hidden"))) virtual ~__pointer_to_member_type_info(); - __attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info*, void*&) const; - __attribute__ ((__visibility__("hidden"))) bool can_catch_nested(const __shim_type_info*) const; + _LIBCXXABI_HIDDEN virtual ~__pointer_to_member_type_info(); + _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, + void *&) const; + _LIBCXXABI_HIDDEN bool can_catch_nested(const __shim_type_info *) const; }; #pragma GCC visibility pop