1 | /*
|
---|
2 | * Copyright (c) 2017 Jaroslav Jindrak
|
---|
3 | * All rights reserved.
|
---|
4 | *
|
---|
5 | * Redistribution and use in source and binary forms, with or without
|
---|
6 | * modification, are permitted provided that the following conditions
|
---|
7 | * are met:
|
---|
8 | *
|
---|
9 | * - Redistributions of source code must retain the above copyright
|
---|
10 | * notice, this list of conditions and the following disclaimer.
|
---|
11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer in the
|
---|
13 | * documentation and/or other materials provided with the distribution.
|
---|
14 | * - The name of the author may not be used to endorse or promote products
|
---|
15 | * derived from this software without specific prior written permission.
|
---|
16 | *
|
---|
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
27 | */
|
---|
28 |
|
---|
29 | #include <cstdint>
|
---|
30 | #include <typeinfo>
|
---|
31 |
|
---|
32 | namespace __cxxabiv1
|
---|
33 | {
|
---|
34 | /**
|
---|
35 | * Static constructor/destructor helpers.
|
---|
36 | */
|
---|
37 |
|
---|
38 | extern "C" int __cxa_atexit(void (*)(void*), void*, void*);
|
---|
39 |
|
---|
40 | extern "C" void __cxa_finalize(void*);
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * Itanium C++ ABI type infos.
|
---|
44 | * See section 2.9.4 (RTTI Layout) of the Itanium C++ ABI spec.
|
---|
45 | *
|
---|
46 | * Note: The memory representation of these classes must not
|
---|
47 | * be modified! (Wel, no modifications at all shall be done.)
|
---|
48 | *
|
---|
49 | * Source: https://itanium-cxx-abi.github.io/cxx-abi/abi.html
|
---|
50 | */
|
---|
51 |
|
---|
52 | class __fundamental_type_info: public std::type_info
|
---|
53 | {
|
---|
54 | public:
|
---|
55 | virtual ~__fundamental_type_info();
|
---|
56 | };
|
---|
57 |
|
---|
58 | class __array_type_info: public std::type_info
|
---|
59 | {
|
---|
60 | public:
|
---|
61 | virtual ~__array_type_info();
|
---|
62 | };
|
---|
63 |
|
---|
64 | class __function_type_info: public std::type_info
|
---|
65 | {
|
---|
66 | public:
|
---|
67 | virtual ~__function_type_info();
|
---|
68 | };
|
---|
69 |
|
---|
70 | class __enum_type_info: public std::type_info
|
---|
71 | {
|
---|
72 | public:
|
---|
73 | virtual ~__enum_type_info();
|
---|
74 | };
|
---|
75 |
|
---|
76 | class __class_type_info: public std::type_info
|
---|
77 | {
|
---|
78 | public:
|
---|
79 | virtual ~__class_type_info();
|
---|
80 | };
|
---|
81 |
|
---|
82 | class __si_class_type_info: public __class_type_info
|
---|
83 | {
|
---|
84 | public:
|
---|
85 | virtual ~__si_class_type_info();
|
---|
86 |
|
---|
87 | const __class_type_info* __base_type;
|
---|
88 | };
|
---|
89 |
|
---|
90 | struct __base_class_type_info
|
---|
91 | {
|
---|
92 | const __class_type_info* __base_type;
|
---|
93 | long __offset_flags;
|
---|
94 |
|
---|
95 | enum __ofset_flags_masks
|
---|
96 | {
|
---|
97 | __virtual_mask = 0x1,
|
---|
98 | __public_mask = 0x2,
|
---|
99 | __offset_shift = 0x8
|
---|
100 | };
|
---|
101 | };
|
---|
102 |
|
---|
103 | class __vmi_class_type_info: public __class_type_info
|
---|
104 | {
|
---|
105 | public:
|
---|
106 | virtual ~__vmi_class_type_info();
|
---|
107 |
|
---|
108 | std::uint32_t __flags;
|
---|
109 | std::uint32_t __base_count;
|
---|
110 |
|
---|
111 | __base_class_type_info __base_info[1];
|
---|
112 |
|
---|
113 | enum __flags_mask
|
---|
114 | {
|
---|
115 | __non_diamond_repeat_mask = 0x1,
|
---|
116 | __diamond_shaped_mask = 0x2
|
---|
117 | };
|
---|
118 | };
|
---|
119 |
|
---|
120 | class __pbase_type_info: public std::type_info
|
---|
121 | {
|
---|
122 | public:
|
---|
123 | virtual ~__pbase_type_info();
|
---|
124 |
|
---|
125 | std::uint32_t __flags;
|
---|
126 | const std::type_info* __pointee;
|
---|
127 |
|
---|
128 | enum __masks
|
---|
129 | {
|
---|
130 | __const_mask = 0x01,
|
---|
131 | __volatile_mask = 0x02,
|
---|
132 | __restrict_mask = 0x04,
|
---|
133 | __incomplete_mask = 0x08,
|
---|
134 | __incomplete_class_mask = 0x10,
|
---|
135 | __transaction_safe_mask = 0x20,
|
---|
136 | __noexcept_mask = 0x40
|
---|
137 | };
|
---|
138 | };
|
---|
139 |
|
---|
140 | class __pointer_type_info: public __pbase_type_info
|
---|
141 | {
|
---|
142 | public:
|
---|
143 | virtual ~__pointer_type_info();
|
---|
144 | };
|
---|
145 |
|
---|
146 | class __pointer_to_member_type_info: public __pbase_type_info
|
---|
147 | {
|
---|
148 | public:
|
---|
149 | virtual ~__pointer_to_member_type_info();
|
---|
150 |
|
---|
151 | const __class_type_info* __context;
|
---|
152 | };
|
---|
153 |
|
---|
154 | extern "C" void* __dynamic_cast(const void*, const __class_type_info*,
|
---|
155 | const __class_type_info*, std::ptrdiff_t);
|
---|
156 | }
|
---|
157 |
|
---|
158 | namespace abi = __cxxabiv1;
|
---|