LibreOffice Module bridges (master) 1
gcc3_linux_aarch64/abi.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <sal/config.h>
23
24#include <cstddef>
25#include <exception>
26#include <typeinfo>
27
28#include <cxxabi.h>
29#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
30#define _GLIBCXX_CDTOR_CALLABI
31#endif
32#include <unwind.h>
33
34#include <config_cxxabi.h>
35#include <typelib/typedescription.h>
36#include <uno/any2.h>
37#include <uno/mapping.h>
38
39#if !HAVE_CXXABI_H_CLASS_TYPE_INFO
40// <https://mentorembedded.github.io/cxx-abi/abi.html>,
41// libstdc++-v3/libsupc++/cxxabi.h:
42namespace __cxxabiv1 {
43class __class_type_info: public std::type_info {
44public:
45 explicit __class_type_info(char const * n): type_info(n) {}
47};
48}
49#endif
50
51#if !HAVE_CXXABI_H_SI_CLASS_TYPE_INFO
52// <https://mentorembedded.github.io/cxx-abi/abi.html>,
53// libstdc++-v3/libsupc++/cxxabi.h:
54namespace __cxxabiv1 {
55class __si_class_type_info: public __class_type_info {
56public:
59 char const * n, __class_type_info const *base):
62};
63}
64#endif
65
66#if !HAVE_CXXABI_H_CXA_EXCEPTION
67// <https://mentorembedded.github.io/cxx-abi/abi-eh.html>,
68// libcxxabi/src/cxa_exception.hpp:
69namespace __cxxabiv1 {
70struct __cxa_exception {
71#if defined _LIBCPPABI_VERSION // detect libc++abi
72#if defined __LP64__ || LIBCXXABI_ARM_EHABI
73#ifdef MACOSX // on arm64
74 // This is a new field added with LLVM 10
75 // <https://github.com/llvm/llvm-project/commit/674ec1eb16678b8addc02a4b0534ab383d22fa77>
76 // "[libcxxabi] Insert padding in __cxa_exception struct for compatibility". For non-MACOSX,
77 // the HACK in call (bridges/source/cpp_uno/gcc3_linux_aarch64/uno2cpp.cxx) tries to find out at
78 // runtime whether a __cxa_exception has this member. Once we can be sure that we only run
79 // against new libcxxabi that has this member, we can drop the "#ifdef MACOSX" here and drop the
80 // hack in call.
81
82 // Now _Unwind_Exception is marked with __attribute__((aligned)),
83 // which implies __cxa_exception is also aligned. Insert padding
84 // in the beginning of the struct, rather than before unwindHeader.
85 void *reserve;
86#endif
87 std::size_t referenceCount;
88#endif
89#endif
90 std::type_info * exceptionType;
91 void (* exceptionDestructor)(void *);
92 void (*unexpectedHandler)(); // std::unexpected_handler dropped from C++17
93 std::terminate_handler terminateHandler;
94 __cxa_exception * nextException;
95 int handlerCount;
97 char const * actionRecord;
99 void * catchTemp;
100 void * adjustedPtr;
101 _Unwind_Exception unwindHeader;
102};
103}
104#endif
105
106#if !HAVE_CXXABI_H_CXA_EH_GLOBALS
107// <https://mentorembedded.github.io/cxx-abi/abi-eh.html>:
108namespace __cxxabiv1 {
109struct __cxa_eh_globals {
110 __cxa_exception * caughtExceptions;
111 unsigned int uncaughtExceptions;
112};
113}
114#endif
115
116#if !HAVE_CXXABI_H_CXA_GET_GLOBALS
117namespace __cxxabiv1 {
118extern "C" __cxa_eh_globals * __cxa_get_globals() noexcept;
119}
120#endif
121
122#if !HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE
123namespace __cxxabiv1 {
124extern "C" std::type_info *__cxa_current_exception_type() throw();
125}
126#endif
127
128#if !HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION
129namespace __cxxabiv1 {
130extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw();
131}
132#endif
133
134#if !HAVE_CXXABI_H_CXA_THROW
135namespace __cxxabiv1 {
136extern "C" void __cxa_throw(
137 void * thrown_exception, void * tinfo, void (* dest)(void *))
138 __attribute__((noreturn));
139}
140#endif
141
142namespace abi_aarch64 {
143
144void mapException(
145 __cxxabiv1::__cxa_exception * exception, std::type_info const * type, uno_Any * any, uno_Mapping * mapping);
146
147void raiseException(uno_Any * any, uno_Mapping * mapping);
148
152
154
155}
156
157/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const __class_type_info * __base_type
Definition: rtti.h:309
__si_class_type_info(char const *n, __class_type_info const *base)
void const * base
sal_Int64 n
struct _uno_Mapping uno_Mapping
Definition: msvc/except.hxx:32
struct _typelib_TypeDescription typelib_TypeDescription
Definition: msvc/except.hxx:52
struct _uno_Any uno_Any
Definition: msvc/except.hxx:31
@ RETURN_KIND_HFA_DOUBLE
@ RETURN_KIND_INDIRECT
@ RETURN_KIND_REG
@ RETURN_KIND_HFA_FLOAT
void __cxa_throw(void *thrown_exception, std::type_info *tinfo, void(*dest)(void *)) __attribute__((noreturn))
__cxa_eh_globals * __cxa_get_globals()
void * __cxa_allocate_exception(size_t thrown_size)
std::type_info * __cxa_current_exception_type()
ReturnKind getReturnKind(typelib_TypeDescription const *type)
void mapException(__cxxabiv1::__cxa_exception *exception, std::type_info const *type, uno_Any *any, uno_Mapping *mapping)
unsigned int uncaughtExceptions
Definition: unwind-cxx.h:131
__cxa_exception * caughtExceptions
Definition: unwind-cxx.h:130
void(* exceptionDestructor)(void *)
Definition: unwind-cxx.h:87
__cxa_exception * nextException
Definition: unwind-cxx.h:95
std::terminate_handler terminateHandler
Definition: unwind-cxx.h:92
std::type_info * exceptionType
Definition: unwind-cxx.h:86
_Unwind_Exception unwindHeader
Definition: unwind-cxx.h:124
unsigned _Unwind_Word __attribute__((__mode__(__word__)))
Definition: unwind-cxx.h:45