| 1 |
//===----------------------------------------------------------------------===// |
| 2 |
// |
| 3 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 |
// See https://llvm.org/LICENSE.txt for license information. |
| 5 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
#ifndef ____CXXABI_CONFIG_H |
| 10 |
#define ____CXXABI_CONFIG_H |
| 11 |
|
| 12 |
#if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ |
| 13 |
!defined(__ARM_DWARF_EH__) && !defined(__SEH__) |
| 14 |
#define _LIBCXXABI_ARM_EHABI |
| 15 |
#endif |
| 16 |
|
| 17 |
#if defined(__clang__) |
| 18 |
# define _LIBCXXABI_COMPILER_CLANG |
| 19 |
# ifndef __apple_build_version__ |
| 20 |
# define _LIBCXXABI_CLANG_VER (__clang_major__ * 100 + __clang_minor__) |
| 21 |
# endif |
| 22 |
#elif defined(__GNUC__) |
| 23 |
# define _LIBCXXABI_COMPILER_GCC |
| 24 |
#endif |
| 25 |
|
| 26 |
#if defined(_WIN32) |
| 27 |
#if defined(_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS) || (defined(__MINGW32__) && !defined(_LIBCXXABI_BUILDING_LIBRARY)) |
| 28 |
#define _LIBCXXABI_HIDDEN |
| 29 |
#define _LIBCXXABI_DATA_VIS |
| 30 |
#define _LIBCXXABI_FUNC_VIS |
| 31 |
#define _LIBCXXABI_TYPE_VIS |
| 32 |
#elif defined(_LIBCXXABI_BUILDING_LIBRARY) |
| 33 |
#define _LIBCXXABI_HIDDEN |
| 34 |
#define _LIBCXXABI_DATA_VIS __declspec(dllexport) |
| 35 |
#define _LIBCXXABI_FUNC_VIS __declspec(dllexport) |
| 36 |
#define _LIBCXXABI_TYPE_VIS __declspec(dllexport) |
| 37 |
#else |
| 38 |
#define _LIBCXXABI_HIDDEN |
| 39 |
#define _LIBCXXABI_DATA_VIS __declspec(dllimport) |
| 40 |
#define _LIBCXXABI_FUNC_VIS __declspec(dllimport) |
| 41 |
#define _LIBCXXABI_TYPE_VIS __declspec(dllimport) |
| 42 |
#endif |
| 43 |
#else |
| 44 |
#if !defined(_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS) |
| 45 |
#define _LIBCXXABI_HIDDEN __attribute__((__visibility__("hidden"))) |
| 46 |
#define _LIBCXXABI_DATA_VIS __attribute__((__visibility__("default"))) |
| 47 |
#define _LIBCXXABI_FUNC_VIS __attribute__((__visibility__("default"))) |
| 48 |
#if __has_attribute(__type_visibility__) |
| 49 |
#define _LIBCXXABI_TYPE_VIS __attribute__((__type_visibility__("default"))) |
| 50 |
#else |
| 51 |
#define _LIBCXXABI_TYPE_VIS __attribute__((__visibility__("default"))) |
| 52 |
#endif |
| 53 |
#else |
| 54 |
#define _LIBCXXABI_HIDDEN |
| 55 |
#define _LIBCXXABI_DATA_VIS |
| 56 |
#define _LIBCXXABI_FUNC_VIS |
| 57 |
#define _LIBCXXABI_TYPE_VIS |
| 58 |
#endif |
| 59 |
#endif |
| 60 |
|
| 61 |
#define _LIBCXXABI_WEAK __attribute__((__weak__)) |
| 62 |
|
| 63 |
#if __has_attribute(__no_sanitize__) && defined(_LIBCXXABI_COMPILER_CLANG) |
| 64 |
#define _LIBCXXABI_NO_CFI __attribute__((__no_sanitize__("cfi"))) |
| 65 |
#else |
| 66 |
#define _LIBCXXABI_NO_CFI |
| 67 |
#endif |
| 68 |
|
| 69 |
// wasm32 follows the arm32 ABI convention of using 32-bit guard. |
| 70 |
#if defined(__arm__) || defined(__wasm32__) || defined(__ARM64_ARCH_8_32__) |
| 71 |
# define _LIBCXXABI_GUARD_ABI_ARM |
| 72 |
#endif |
| 73 |
|
| 74 |
#if !defined(__cpp_exceptions) || __cpp_exceptions < 199711L |
| 75 |
# define _LIBCXXABI_NO_EXCEPTIONS |
| 76 |
#endif |
| 77 |
|
| 78 |
#if defined(_WIN32) |
| 79 |
#define _LIBCXXABI_DTOR_FUNC __thiscall |
| 80 |
#else |
| 81 |
#define _LIBCXXABI_DTOR_FUNC |
| 82 |
#endif |
| 83 |
|
| 84 |
#if __has_include(<ptrauth.h>) |
| 85 |
# include <ptrauth.h> |
| 86 |
#endif |
| 87 |
|
| 88 |
#if __has_feature(ptrauth_calls) |
| 89 |
|
| 90 |
// ptrauth_string_discriminator("__cxa_exception::actionRecord") == 0xFC91 |
| 91 |
# define __ptrauth_cxxabi_action_record __ptrauth(ptrauth_key_process_dependent_data, 1, 0xFC91) |
| 92 |
|
| 93 |
// ptrauth_string_discriminator("__cxa_exception::languageSpecificData") == 0xE8EE |
| 94 |
# define __ptrauth_cxxabi_lsd __ptrauth(ptrauth_key_process_dependent_data, 1, 0xE8EE) |
| 95 |
|
| 96 |
// ptrauth_string_discriminator("__cxa_exception::catchTemp") == 0xFA58 |
| 97 |
# define __ptrauth_cxxabi_catch_temp_disc 0xFA58 |
| 98 |
# define __ptrauth_cxxabi_catch_temp_key ptrauth_key_process_dependent_data |
| 99 |
# define __ptrauth_cxxabi_catch_temp __ptrauth(__ptrauth_cxxabi_catch_temp_key, 1, __ptrauth_cxxabi_catch_temp_disc) |
| 100 |
|
| 101 |
// ptrauth_string_discriminator("__cxa_exception::adjustedPtr") == 0x99E4 |
| 102 |
# define __ptrauth_cxxabi_adjusted_ptr __ptrauth(ptrauth_key_process_dependent_data, 1, 0x99E4) |
| 103 |
|
| 104 |
// ptrauth_string_discriminator("__cxa_exception::unexpectedHandler") == 0x99A9 |
| 105 |
# define __ptrauth_cxxabi_unexpected_handler __ptrauth(ptrauth_key_function_pointer, 1, 0x99A9) |
| 106 |
|
| 107 |
// ptrauth_string_discriminator("__cxa_exception::terminateHandler") == 0x0886) |
| 108 |
# define __ptrauth_cxxabi_terminate_handler __ptrauth(ptrauth_key_function_pointer, 1, 0x886) |
| 109 |
|
| 110 |
// ptrauth_string_discriminator("__cxa_exception::exceptionDestructor") == 0xC088 |
| 111 |
# define __ptrauth_cxxabi_exception_destructor __ptrauth(ptrauth_key_function_pointer, 1, 0xC088) |
| 112 |
|
| 113 |
#else |
| 114 |
|
| 115 |
# define __ptrauth_cxxabi_action_record |
| 116 |
# define __ptrauth_cxxabi_lsd |
| 117 |
# define __ptrauth_cxxabi_catch_temp |
| 118 |
# define __ptrauth_cxxabi_adjusted_ptr |
| 119 |
# define __ptrauth_cxxabi_unexpected_handler |
| 120 |
# define __ptrauth_cxxabi_terminate_handler |
| 121 |
# define __ptrauth_cxxabi_exception_destructor |
| 122 |
|
| 123 |
#endif |
| 124 |
|
| 125 |
#if __cplusplus < 201103L |
| 126 |
# define _LIBCXXABI_NOEXCEPT throw() |
| 127 |
#else |
| 128 |
# define _LIBCXXABI_NOEXCEPT noexcept |
| 129 |
#endif |
| 130 |
|
| 131 |
#endif // ____CXXABI_CONFIG_H |