summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/__cxxabi_config.h24
-rw-r--r--include/cxxabi.h169
-rw-r--r--src/cxa_aux_runtime.cpp14
-rw-r--r--src/cxa_demangle.cpp4
-rw-r--r--src/cxa_exception.cpp26
-rw-r--r--src/cxa_guard.cpp14
-rw-r--r--src/cxa_thread_atexit.cpp4
-rw-r--r--src/cxa_vector.cpp66
-rw-r--r--src/cxa_virtual.cpp4
-rw-r--r--src/private_typeinfo.h151
10 files changed, 264 insertions, 212 deletions
diff --git a/include/__cxxabi_config.h b/include/__cxxabi_config.h
index 957754f..68e325f 100644
--- a/include/__cxxabi_config.h
+++ b/include/__cxxabi_config.h
@@ -17,4 +17,28 @@
#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
diff --git a/include/cxxabi.h b/include/cxxabi.h
index 253a3df..e4a6797 100644
--- a/include/cxxabi.h
+++ b/include/cxxabi.h
@@ -26,7 +26,11 @@
#ifdef __cplusplus
namespace std {
+#if defined(_WIN32)
+class _LIBCXXABI_TYPE_VIS type_info; // forward declaration
+#else
class type_info; // forward declaration
+#endif
}
@@ -35,113 +39,132 @@ namespace __cxxabiv1 {
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"
diff --git a/src/cxa_aux_runtime.cpp b/src/cxa_aux_runtime.cpp
index ad68e61..a455fad 100644
--- a/src/cxa_aux_runtime.cpp
+++ b/src/cxa_aux_runtime.cpp
@@ -16,14 +16,16 @@
namespace __cxxabiv1 {
extern "C" {
-LIBCXXABI_NORETURN
-void __cxa_bad_cast(void) { throw std::bad_cast(); }
+_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) {
+_LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void
+__cxa_throw_bad_array_new_length(void) {
throw std::bad_array_new_length();
}
} // extern "C"
diff --git a/src/cxa_demangle.cpp b/src/cxa_demangle.cpp
index b6388ab..04dc711 100644
--- a/src/cxa_demangle.cpp
+++ b/src/cxa_demangle.cpp
@@ -10,6 +10,8 @@
#define _LIBCPP_EXTERN_TEMPLATE(...)
#define _LIBCPP_NO_EXCEPTIONS
+#include "__cxxabi_config.h"
+
#include <vector>
#include <algorithm>
#include <string>
@@ -4922,7 +4924,7 @@ struct Db
} // 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))
{
diff --git a/src/cxa_exception.cpp b/src/cxa_exception.cpp
index 0767ab4..a8216df 100644
--- a/src/cxa_exception.cpp
+++ b/src/cxa_exception.cpp
@@ -156,7 +156,7 @@ extern "C" {
// 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 +167,7 @@ void *__cxa_allocate_exception(size_t thrown_size) throw() {
// 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,9 +218,8 @@ handler, _Unwind_RaiseException may return. In that case, __cxa_throw
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);
@@ -252,6 +251,7 @@ The adjusted pointer is computed by the personality routine during phase 1
Requires: exception is native
*/
+_LIBCXXABI_FUNC_VIS
void *__cxa_get_exception_ptr(void *unwind_exception) throw() {
#if LIBCXXABI_ARM_EHABI
return reinterpret_cast<void*>(
@@ -267,6 +267,7 @@ void *__cxa_get_exception_ptr(void *unwind_exception) throw() {
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();
@@ -438,7 +439,7 @@ For a foreign exception:
* 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)");
@@ -515,7 +516,7 @@ void __cxa_end_catch() {
// 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)
@@ -540,8 +541,7 @@ If the exception is native:
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)
@@ -586,7 +586,8 @@ void __cxa_rethrow() {
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);
@@ -602,7 +603,8 @@ void __cxa_increment_exception_refcount(void *thrown_object) throw() {
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);
@@ -625,7 +627,7 @@ void __cxa_decrement_exception_refcount(void *thrown_object) throw() {
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)
diff --git a/src/cxa_guard.cpp b/src/cxa_guard.cpp
index 041797c..72e868f 100644
--- a/src/cxa_guard.cpp
+++ b/src/cxa_guard.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+#include "__cxxabi_config.h"
+
#include "abort_message.h"
#include "config.h"
@@ -167,22 +169,22 @@ extern "C"
{
#if LIBCXXABI_HAS_NO_THREADS
-int __cxa_guard_acquire(guard_type *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) {
+_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) {
+_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");
@@ -223,7 +225,7 @@ int __cxa_guard_acquire(guard_type *guard_object) {
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;
@@ -234,7 +236,7 @@ void __cxa_guard_release(guard_type *guard_object) {
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;
diff --git a/src/cxa_thread_atexit.cpp b/src/cxa_thread_atexit.cpp
index 5960bed..7962e28 100644
--- a/src/cxa_thread_atexit.cpp
+++ b/src/cxa_thread_atexit.cpp
@@ -14,8 +14,8 @@ extern "C" {
#ifdef HAVE___CXA_THREAD_ATEXIT_IMPL
-int __cxa_thread_atexit(void (*dtor)(void *), void *obj,
- void *dso_symbol) throw() {
+_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 *);
return __cxa_thread_atexit_impl(dtor, obj, dso_symbol);
}
diff --git a/src/cxa_vector.cpp b/src/cxa_vector.cpp
index 56e7096..c32a211 100644
--- a/src/cxa_vector.cpp
+++ b/src/cxa_vector.cpp
@@ -114,9 +114,9 @@ extern "C" {
//
// __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 *)) {
+_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 [] );
}
@@ -139,10 +139,10 @@ void *__cxa_vec_new(size_t element_count, size_t element_size,
// 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<char *> ( alloc ( heap_size ));
char *vec_base = heap_block;
@@ -167,10 +167,10 @@ void *__cxa_vec_new2(size_t element_count, size_t element_size,
// 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<char *> ( alloc ( heap_size ));
char *vec_base = heap_block;
@@ -203,9 +203,11 @@ void *__cxa_vec_new3(size_t element_count, size_t element_size,
// 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<char *>(src_array);
@@ -227,9 +229,9 @@ void __cxa_vec_cctor(void *dest_array, void *src_array, size_t element_count,
// 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 <char *> ( array_address );
@@ -248,8 +250,10 @@ void __cxa_vec_ctor(void *array_address, size_t element_count,
// 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 <char *> (array_address);
size_t idx = element_count;
@@ -272,8 +276,10 @@ void __cxa_vec_dtor(void *array_address, size_t element_count,
// 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 <char *> (array_address);
size_t idx = element_count;
@@ -308,8 +314,10 @@ void __cxa_vec_cleanup(void *array_address, size_t element_count,
// 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 *)) {
+_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 [] );
}
@@ -318,9 +326,9 @@ void __cxa_vec_delete(void *array_address, size_t element_size,
// 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 <char *> (array_address);
char *heap_block = vec_base - padding_size;
@@ -338,9 +346,9 @@ void __cxa_vec_delete2(void *array_address, size_t element_size,
// 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 <char *> (array_address);
char *heap_block = vec_base - padding_size;
diff --git a/src/cxa_virtual.cpp b/src/cxa_virtual.cpp
index 0da383a..ac81ad3 100644
--- a/src/cxa_virtual.cpp
+++ b/src/cxa_virtual.cpp
@@ -12,12 +12,12 @@
namespace __cxxabiv1 {
extern "C" {
-LIBCXXABI_NORETURN
+_LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN
void __cxa_pure_virtual(void) {
abort_message("Pure virtual function called!");
}
-LIBCXXABI_NORETURN
+_LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN
void __cxa_deleted_virtual(void) {
abort_message("Deleted virtual function called!");
}
diff --git a/src/private_typeinfo.h b/src/private_typeinfo.h
index 43d4768..ef98c3a 100644
--- a/src/private_typeinfo.h
+++ b/src/private_typeinfo.h
@@ -10,53 +10,50 @@
#ifndef __PRIVATE_TYPEINFO_H_
#define __PRIVATE_TYPEINFO_H_
+#include "__cxxabi_config.h"
+
#include <typeinfo>
#include <cstddef>
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
@@ -68,7 +65,7 @@ enum
no
};
-class __attribute__((__visibility__("default"))) __class_type_info;
+class _LIBCXXABI_TYPE_VIS __class_type_info;
struct __dynamic_cast_info
{
@@ -118,43 +115,41 @@ struct __dynamic_cast_info
};
// 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
+ _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;
- __attribute__((__visibility__("hidden"))) virtual bool
- can_catch(const __shim_type_info *, void *&) const;
- __attribute__((__visibility__("hidden"))) virtual void
+ _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();
+ _LIBCXXABI_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
+ _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;
- __attribute__((__visibility__("hidden"))) virtual void
+ _LIBCXXABI_HIDDEN virtual void
has_unambiguous_public_base(__dynamic_cast_info *, void *, int) const;
};
@@ -177,8 +172,7 @@ public:
};
// 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;
@@ -191,19 +185,18 @@ public:
// more derived objects
};
- __attribute__((__visibility__("hidden"))) virtual ~__vmi_class_type_info();
+ _LIBCXXABI_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
+ _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;
- __attribute__((__visibility__("hidden"))) virtual void
+ _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;
@@ -216,32 +209,28 @@ public:
__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
+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