#ifdef __cplusplus
namespace __cxxabiv1
{
+ typedef __cxa_cdtor_return_type (*__cxa_cdtor_type)(void *);
+
extern "C"
{
#endif
// Allocate array.
void*
__cxa_vec_new(size_t __element_count, size_t __element_size,
- size_t __padding_size, void (*__constructor) (void*),
- void (*__destructor) (void*));
+ size_t __padding_size, __cxa_cdtor_type constructor,
+ __cxa_cdtor_type destructor);
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),
+ size_t __padding_size, __cxa_cdtor_type constructor,
+ __cxa_cdtor_type destructor, void *(*__alloc) (size_t),
void (*__dealloc) (void*));
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),
+ size_t __padding_size, __cxa_cdtor_type constructor,
+ __cxa_cdtor_type destructor, void *(*__alloc) (size_t),
void (*__dealloc) (void*, size_t));
// Construct array.
__cxa_vec_ctor_return_type
__cxa_vec_ctor(void* __array_address, size_t __element_count,
- size_t __element_size, void (*__constructor) (void*),
- void (*__destructor) (void*));
+ size_t __element_size, __cxa_cdtor_type constructor,
+ __cxa_cdtor_type destructor);
__cxa_vec_ctor_return_type
__cxa_vec_cctor(void* dest_array, void* src_array, size_t element_count,
- size_t element_size, void (*constructor) (void*, void*),
- void (*destructor) (void*));
+ size_t element_size,
+ __cxa_cdtor_return_type (*constructor) (void*, void*),
+ __cxa_cdtor_type destructor);
// Destruct array.
void
__cxa_vec_dtor(void* __array_address, size_t __element_count,
- size_t __element_size, void (*__destructor) (void*));
+ size_t __element_size, __cxa_cdtor_type destructor);
void
__cxa_vec_cleanup(void* __array_address, size_t __element_count,
- size_t __element_size, void (*__destructor) (void*));
+ size_t __element_size, __cxa_cdtor_type destructor);
// Destruct and release array.
void
__cxa_vec_delete(void* __array_address, size_t __element_size,
- size_t __padding_size, void (*__destructor) (void*));
+ size_t __padding_size, __cxa_cdtor_type destructor);
void
__cxa_vec_delete2(void* __array_address, size_t __element_size,
- size_t __padding_size, void (*__destructor) (void*),
+ size_t __padding_size, __cxa_cdtor_type destructor,
void (*__dealloc) (void*));
void
__cxa_vec_delete3(void* __array_address, size_t __element_size,
- size_t __padding_size, void (*__destructor) (void*),
+ size_t __padding_size, __cxa_cdtor_type destructor,
void (*__dealloc) (void*, size_t));
int
__cxa_vec_new(std::size_t element_count,
std::size_t element_size,
std::size_t padding_size,
- void (*constructor) (void *),
- void (*destructor) (void *))
+ __cxa_cdtor_type constructor,
+ __cxa_cdtor_type destructor)
{
return __cxa_vec_new2(element_count, element_size, padding_size,
constructor, destructor,
__cxa_vec_new2(std::size_t element_count,
std::size_t element_size,
std::size_t padding_size,
- void (*constructor) (void *),
- void (*destructor) (void *),
+ __cxa_cdtor_type constructor,
+ __cxa_cdtor_type destructor,
void *(*alloc) (std::size_t),
void (*dealloc) (void *))
{
__cxa_vec_new3(std::size_t element_count,
std::size_t element_size,
std::size_t padding_size,
- void (*constructor) (void *),
- void (*destructor) (void *),
+ __cxa_cdtor_type constructor,
+ __cxa_cdtor_type destructor,
void *(*alloc) (std::size_t),
void (*dealloc) (void *, std::size_t))
{
__cxa_vec_ctor(void *array_address,
std::size_t element_count,
std::size_t element_size,
- void (*constructor) (void *),
- void (*destructor) (void *))
+ __cxa_cdtor_type constructor,
+ __cxa_cdtor_type destructor)
{
std::size_t ix = 0;
char *ptr = static_cast<char *>(array_address);
void *src_array,
std::size_t element_count,
std::size_t element_size,
- void (*constructor) (void *, void *),
- void (*destructor) (void *))
+ __cxa_cdtor_return_type (*constructor) (void *, void *),
+ __cxa_cdtor_type destructor)
{
std::size_t ix = 0;
char *dest_ptr = static_cast<char *>(dest_array);
__cxa_vec_dtor(void *array_address,
std::size_t element_count,
std::size_t element_size,
- void (*destructor) (void *))
+ __cxa_cdtor_type destructor)
{
if (destructor)
{
__cxa_vec_cleanup(void *array_address,
std::size_t element_count,
std::size_t element_size,
- void (*destructor) (void *))
+ __cxa_cdtor_type destructor)
{
if (destructor)
{
__cxa_vec_delete(void *array_address,
std::size_t element_size,
std::size_t padding_size,
- void (*destructor) (void *))
+ __cxa_cdtor_type destructor)
{
__cxa_vec_delete2(array_address, element_size, padding_size,
destructor,
__cxa_vec_delete2(void *array_address,
std::size_t element_size,
std::size_t padding_size,
- void (*destructor) (void *),
+ __cxa_cdtor_type destructor,
void (*dealloc) (void *))
{
if (!array_address)
__cxa_vec_delete3(void *array_address,
std::size_t element_size,
std::size_t padding_size,
- void (*destructor) (void *),
+ __cxa_cdtor_type destructor,
void (*dealloc) (void *, std::size_t))
{
if (!array_address)
}
} // namespace __cxxabiv1
+#if defined(__arm__) && defined(__ARM_EABI__)
+
+// The ARM C++ ABI requires that the library provide these additional
+// helper functions. There are placed in this file, despite being
+// architecture-specifier, so that the compiler can inline the __cxa
+// functions into these functions as appropriate.
+
+namespace __aeabiv1
+{
+ extern "C" void *
+ __aeabi_vec_ctor_nocookie_nodtor (void *array_address,
+ abi::__cxa_cdtor_type constructor,
+ std::size_t element_size,
+ std::size_t element_count)
+ {
+ return abi::__cxa_vec_ctor (array_address, element_count, element_size,
+ constructor, /*destructor=*/NULL);
+ }
+
+ extern "C" void *
+ __aeabi_vec_ctor_cookie_nodtor (void *array_address,
+ abi::__cxa_cdtor_type constructor,
+ std::size_t element_size,
+ std::size_t element_count)
+ {
+ if (array_address == NULL)
+ return NULL;
+
+ array_address = reinterpret_cast<std::size_t *>(array_address) + 2;
+ reinterpret_cast<std::size_t *>(array_address)[-2] = element_size;
+ reinterpret_cast<std::size_t *>(array_address)[-1] = element_count;
+ return abi::__cxa_vec_ctor (array_address,
+ element_count, element_size,
+ constructor, /*destructor=*/NULL);
+ }
+
+ extern "C" void *
+ __aeabi_vec_cctor_nocookie_nodtor (void *dest_array,
+ void *src_array,
+ std::size_t element_size,
+ std::size_t element_count,
+ void *(*constructor) (void *, void *))
+ {
+ return abi::__cxa_vec_cctor (dest_array, src_array,
+ element_count, element_size,
+ constructor, NULL);
+ }
+
+ extern "C" void *
+ __aeabi_vec_new_cookie_noctor (std::size_t element_size,
+ std::size_t element_count)
+ {
+ return abi::__cxa_vec_new(element_count, element_size,
+ 2 * sizeof (std::size_t),
+ /*constructor=*/NULL, /*destructor=*/NULL);
+ }
+
+ extern "C" void *
+ __aeabi_vec_new_nocookie (std::size_t element_size,
+ std::size_t element_count,
+ abi::__cxa_cdtor_type constructor)
+ {
+ return abi::__cxa_vec_new (element_count, element_size, 0, constructor,
+ NULL);
+ }
+
+ extern "C" void *
+ __aeabi_vec_new_cookie_nodtor (std::size_t element_size,
+ std::size_t element_count,
+ abi::__cxa_cdtor_type constructor)
+ {
+ return abi::__cxa_vec_new(element_count, element_size,
+ 2 * sizeof (std::size_t),
+ constructor, NULL);
+ }
+
+ extern "C" void *
+ __aeabi_vec_new_cookie(std::size_t element_size,
+ std::size_t element_count,
+ abi::__cxa_cdtor_type constructor,
+ abi::__cxa_cdtor_type destructor)
+ {
+ return abi::__cxa_vec_new (element_count, element_size,
+ 2 * sizeof (std::size_t),
+ constructor, destructor);
+ }
+
+
+ extern "C" void *
+ __aeabi_vec_dtor (void *array_address,
+ abi::__cxa_cdtor_type destructor,
+ std::size_t element_size,
+ std::size_t element_count)
+ {
+ abi::__cxa_vec_dtor (array_address, element_count, element_size,
+ destructor);
+ return reinterpret_cast<std::size_t*> (array_address) - 2;
+ }
+
+ extern "C" void *
+ __aeabi_vec_dtor_cookie (void *array_address,
+ abi::__cxa_cdtor_type destructor)
+ {
+ abi::__cxa_vec_dtor (array_address,
+ reinterpret_cast<std::size_t *>(array_address)[-1],
+ reinterpret_cast<std::size_t *>(array_address)[-2],
+ destructor);
+ return reinterpret_cast<std::size_t*> (array_address) - 2;
+ }
+
+
+ extern "C" void
+ __aeabi_vec_delete (void *array_address,
+ abi::__cxa_cdtor_type destructor)
+ {
+ abi::__cxa_vec_delete (array_address,
+ reinterpret_cast<std::size_t *>(array_address)[-2],
+ 2 * sizeof (std::size_t),
+ destructor);
+ }
+
+ extern "C" void
+ __aeabi_vec_delete3 (void *array_address,
+ abi::__cxa_cdtor_type destructor,
+ void (*dealloc) (void *, std::size_t))
+ {
+ abi::__cxa_vec_delete3 (array_address,
+ reinterpret_cast<std::size_t *>(array_address)[-2],
+ 2 * sizeof (std::size_t),
+ destructor, dealloc);
+ }
+
+ extern "C" void
+ __aeabi_vec_delete3_nodtor (void *array_address,
+ void (*dealloc) (void *, std::size_t))
+ {
+ abi::__cxa_vec_delete3 (array_address,
+ reinterpret_cast<std::size_t *>(array_address)[-2],
+ 2 * sizeof (std::size_t),
+ /*destructor=*/NULL, dealloc);
+ }
+
+ extern "C" int
+ __aeabi_atexit (void *object,
+ void (*destructor) (void *),
+ void *dso_handle)
+ {
+ return abi::__cxa_atexit(destructor, object, dso_handle);
+ }
+} // namespace __aeabiv1
+
+#endif // defined(__arm__) && defined(__ARM_EABI__)