[1b6477e] | 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 |
|
---|
[7bbf91e] | 29 | #include <cstddef>
|
---|
[1b6477e] | 30 | #include <cstdint>
|
---|
| 31 | #include <typeinfo>
|
---|
| 32 |
|
---|
| 33 | namespace __cxxabiv1
|
---|
| 34 | {
|
---|
[c4049e6] | 35 | /**
|
---|
| 36 | * Static constructor/destructor helpers.
|
---|
| 37 | */
|
---|
| 38 |
|
---|
| 39 | extern "C" int __cxa_atexit(void (*)(void*), void*, void*);
|
---|
| 40 |
|
---|
| 41 | extern "C" void __cxa_finalize(void*);
|
---|
| 42 |
|
---|
[1b6477e] | 43 | /**
|
---|
| 44 | * Itanium C++ ABI type infos.
|
---|
| 45 | * See section 2.9.4 (RTTI Layout) of the Itanium C++ ABI spec.
|
---|
| 46 | *
|
---|
| 47 | * Note: The memory representation of these classes must not
|
---|
| 48 | * be modified! (Wel, no modifications at all shall be done.)
|
---|
| 49 | *
|
---|
| 50 | * Source: https://itanium-cxx-abi.github.io/cxx-abi/abi.html
|
---|
| 51 | */
|
---|
| 52 |
|
---|
| 53 | class __fundamental_type_info: public std::type_info
|
---|
| 54 | {
|
---|
| 55 | public:
|
---|
| 56 | virtual ~__fundamental_type_info();
|
---|
| 57 | };
|
---|
| 58 |
|
---|
| 59 | class __array_type_info: public std::type_info
|
---|
| 60 | {
|
---|
| 61 | public:
|
---|
| 62 | virtual ~__array_type_info();
|
---|
| 63 | };
|
---|
| 64 |
|
---|
| 65 | class __function_type_info: public std::type_info
|
---|
| 66 | {
|
---|
| 67 | public:
|
---|
| 68 | virtual ~__function_type_info();
|
---|
| 69 | };
|
---|
| 70 |
|
---|
| 71 | class __enum_type_info: public std::type_info
|
---|
| 72 | {
|
---|
| 73 | public:
|
---|
| 74 | virtual ~__enum_type_info();
|
---|
| 75 | };
|
---|
| 76 |
|
---|
| 77 | class __class_type_info: public std::type_info
|
---|
| 78 | {
|
---|
| 79 | public:
|
---|
| 80 | virtual ~__class_type_info();
|
---|
| 81 | };
|
---|
| 82 |
|
---|
| 83 | class __si_class_type_info: public __class_type_info
|
---|
| 84 | {
|
---|
| 85 | public:
|
---|
| 86 | virtual ~__si_class_type_info();
|
---|
| 87 |
|
---|
| 88 | const __class_type_info* __base_type;
|
---|
| 89 | };
|
---|
| 90 |
|
---|
| 91 | struct __base_class_type_info
|
---|
| 92 | {
|
---|
| 93 | const __class_type_info* __base_type;
|
---|
| 94 | long __offset_flags;
|
---|
| 95 |
|
---|
| 96 | enum __ofset_flags_masks
|
---|
| 97 | {
|
---|
| 98 | __virtual_mask = 0x1,
|
---|
| 99 | __public_mask = 0x2,
|
---|
| 100 | __offset_shift = 0x8
|
---|
| 101 | };
|
---|
| 102 | };
|
---|
| 103 |
|
---|
| 104 | class __vmi_class_type_info: public __class_type_info
|
---|
| 105 | {
|
---|
| 106 | public:
|
---|
| 107 | virtual ~__vmi_class_type_info();
|
---|
| 108 |
|
---|
| 109 | std::uint32_t __flags;
|
---|
| 110 | std::uint32_t __base_count;
|
---|
| 111 |
|
---|
| 112 | __base_class_type_info __base_info[1];
|
---|
| 113 |
|
---|
| 114 | enum __flags_mask
|
---|
| 115 | {
|
---|
| 116 | __non_diamond_repeat_mask = 0x1,
|
---|
| 117 | __diamond_shaped_mask = 0x2
|
---|
| 118 | };
|
---|
| 119 | };
|
---|
| 120 |
|
---|
| 121 | class __pbase_type_info: public std::type_info
|
---|
| 122 | {
|
---|
| 123 | public:
|
---|
| 124 | virtual ~__pbase_type_info();
|
---|
| 125 |
|
---|
| 126 | std::uint32_t __flags;
|
---|
| 127 | const std::type_info* __pointee;
|
---|
| 128 |
|
---|
| 129 | enum __masks
|
---|
| 130 | {
|
---|
| 131 | __const_mask = 0x01,
|
---|
| 132 | __volatile_mask = 0x02,
|
---|
| 133 | __restrict_mask = 0x04,
|
---|
| 134 | __incomplete_mask = 0x08,
|
---|
| 135 | __incomplete_class_mask = 0x10,
|
---|
| 136 | __transaction_safe_mask = 0x20,
|
---|
| 137 | __noexcept_mask = 0x40
|
---|
| 138 | };
|
---|
| 139 | };
|
---|
| 140 |
|
---|
| 141 | class __pointer_type_info: public __pbase_type_info
|
---|
| 142 | {
|
---|
| 143 | public:
|
---|
| 144 | virtual ~__pointer_type_info();
|
---|
| 145 | };
|
---|
| 146 |
|
---|
| 147 | class __pointer_to_member_type_info: public __pbase_type_info
|
---|
| 148 | {
|
---|
| 149 | public:
|
---|
| 150 | virtual ~__pointer_to_member_type_info();
|
---|
| 151 |
|
---|
| 152 | const __class_type_info* __context;
|
---|
| 153 | };
|
---|
| 154 |
|
---|
[ef9d0988] | 155 | extern "C" void* __dynamic_cast(const void*, const __class_type_info*,
|
---|
| 156 | const __class_type_info*, std::ptrdiff_t);
|
---|
[1b6477e] | 157 | }
|
---|
| 158 |
|
---|
| 159 | namespace abi = __cxxabiv1;
|
---|