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(__has_attribute) |
18 | #define __has_attribute(_attribute_) 0 |
19 | #endif |
20 | |
21 | #if defined(__clang__) |
22 | # define _LIBCXXABI_COMPILER_CLANG |
23 | # ifndef __apple_build_version__ |
24 | # define _LIBCXXABI_CLANG_VER (__clang_major__ * 100 + __clang_minor__) |
25 | # endif |
26 | #elif defined(__GNUC__) |
27 | # define _LIBCXXABI_COMPILER_GCC |
28 | #elif defined(_MSC_VER) |
29 | # define _LIBCXXABI_COMPILER_MSVC |
30 | #elif defined(__IBMCPP__) |
31 | # define _LIBCXXABI_COMPILER_IBM |
32 | #endif |
33 | |
34 | #if defined(_WIN32) |
35 | #if defined(_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS) || (defined(__MINGW32__) && !defined(_LIBCXXABI_BUILDING_LIBRARY)) |
36 | #define _LIBCXXABI_HIDDEN |
37 | #define _LIBCXXABI_DATA_VIS |
38 | #define _LIBCXXABI_FUNC_VIS |
39 | #define _LIBCXXABI_TYPE_VIS |
40 | #elif defined(_LIBCXXABI_BUILDING_LIBRARY) |
41 | #define _LIBCXXABI_HIDDEN |
42 | #define _LIBCXXABI_DATA_VIS __declspec(dllexport) |
43 | #define _LIBCXXABI_FUNC_VIS __declspec(dllexport) |
44 | #define _LIBCXXABI_TYPE_VIS __declspec(dllexport) |
45 | #else |
46 | #define _LIBCXXABI_HIDDEN |
47 | #define _LIBCXXABI_DATA_VIS __declspec(dllimport) |
48 | #define _LIBCXXABI_FUNC_VIS __declspec(dllimport) |
49 | #define _LIBCXXABI_TYPE_VIS __declspec(dllimport) |
50 | #endif |
51 | #else |
52 | #if !defined(_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS) |
53 | #define _LIBCXXABI_HIDDEN __attribute__((__visibility__("hidden"))) |
54 | #define _LIBCXXABI_DATA_VIS __attribute__((__visibility__("default"))) |
55 | #define _LIBCXXABI_FUNC_VIS __attribute__((__visibility__("default"))) |
56 | #if __has_attribute(__type_visibility__) |
57 | #define _LIBCXXABI_TYPE_VIS __attribute__((__type_visibility__("default"))) |
58 | #else |
59 | #define _LIBCXXABI_TYPE_VIS __attribute__((__visibility__("default"))) |
60 | #endif |
61 | #else |
62 | #define _LIBCXXABI_HIDDEN |
63 | #define _LIBCXXABI_DATA_VIS |
64 | #define _LIBCXXABI_FUNC_VIS |
65 | #define _LIBCXXABI_TYPE_VIS |
66 | #endif |
67 | #endif |
68 | |
69 | #if defined(_LIBCXXABI_COMPILER_MSVC) |
70 | #define _LIBCXXABI_WEAK |
71 | #else |
72 | #define _LIBCXXABI_WEAK __attribute__((__weak__)) |
73 | #endif |
74 | |
75 | #if defined(__clang__) |
76 | #define _LIBCXXABI_COMPILER_CLANG |
77 | #elif defined(__GNUC__) |
78 | #define _LIBCXXABI_COMPILER_GCC |
79 | #endif |
80 | |
81 | #if __has_attribute(__no_sanitize__) && defined(_LIBCXXABI_COMPILER_CLANG) |
82 | #define _LIBCXXABI_NO_CFI __attribute__((__no_sanitize__("cfi"))) |
83 | #else |
84 | #define _LIBCXXABI_NO_CFI |
85 | #endif |
86 | |
87 | // wasm32 follows the arm32 ABI convention of using 32-bit guard. |
88 | #if defined(__arm__) || defined(__wasm32__) || defined(__ARM64_ARCH_8_32__) |
89 | # define _LIBCXXABI_GUARD_ABI_ARM |
90 | #endif |
91 | |
92 | #if defined(_LIBCXXABI_COMPILER_CLANG) |
93 | # if !__has_feature(cxx_exceptions) |
94 | # define _LIBCXXABI_NO_EXCEPTIONS |
95 | # endif |
96 | #elif defined(_LIBCXXABI_COMPILER_GCC) && !defined(__EXCEPTIONS) |
97 | # define _LIBCXXABI_NO_EXCEPTIONS |
98 | #endif |
99 | |
100 | #if defined(_WIN32) |
101 | #define _LIBCXXABI_DTOR_FUNC __thiscall |
102 | #else |
103 | #define _LIBCXXABI_DTOR_FUNC |
104 | #endif |
105 | |
106 | #endif // ____CXXABI_CONFIG_H |
107 | |