Port StripGCRelocates pass to NPM
[lldb.git] / libcxxabi / include / __cxxabi_config.h
1 //===-------------------------- __cxxabi_config.h -------------------------===//
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__)
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(_WIN32)
22  #if defined(_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS)
23   #define _LIBCXXABI_HIDDEN
24   #define _LIBCXXABI_DATA_VIS
25   #define _LIBCXXABI_FUNC_VIS
26   #define _LIBCXXABI_TYPE_VIS
27  #elif defined(_LIBCXXABI_BUILDING_LIBRARY)
28   #define _LIBCXXABI_HIDDEN
29   #define _LIBCXXABI_DATA_VIS __declspec(dllexport)
30   #define _LIBCXXABI_FUNC_VIS __declspec(dllexport)
31   #define _LIBCXXABI_TYPE_VIS __declspec(dllexport)
32  #else
33   #define _LIBCXXABI_HIDDEN
34   #define _LIBCXXABI_DATA_VIS __declspec(dllimport)
35   #define _LIBCXXABI_FUNC_VIS __declspec(dllimport)
36   #define _LIBCXXABI_TYPE_VIS __declspec(dllimport)
37  #endif
38 #else
39  #if !defined(_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS)
40   #define _LIBCXXABI_HIDDEN __attribute__((__visibility__("hidden")))
41   #define _LIBCXXABI_DATA_VIS __attribute__((__visibility__("default")))
42   #define _LIBCXXABI_FUNC_VIS __attribute__((__visibility__("default")))
43   #if __has_attribute(__type_visibility__)
44    #define _LIBCXXABI_TYPE_VIS __attribute__((__type_visibility__("default")))
45   #else
46    #define _LIBCXXABI_TYPE_VIS __attribute__((__visibility__("default")))
47   #endif
48  #else
49   #define _LIBCXXABI_HIDDEN
50   #define _LIBCXXABI_DATA_VIS
51   #define _LIBCXXABI_FUNC_VIS
52   #define _LIBCXXABI_TYPE_VIS
53  #endif
54 #endif
55
56 #if defined(_WIN32)
57 #define _LIBCXXABI_WEAK
58 #else
59 #define _LIBCXXABI_WEAK __attribute__((__weak__))
60 #endif
61
62 #if defined(__clang__)
63 #define _LIBCXXABI_COMPILER_CLANG
64 #elif defined(__GNUC__)
65 #define _LIBCXXABI_COMPILER_GCC
66 #endif
67
68 #if __has_attribute(__no_sanitize__) && defined(_LIBCXXABI_COMPILER_CLANG)
69 #define _LIBCXXABI_NO_CFI __attribute__((__no_sanitize__("cfi")))
70 #else
71 #define _LIBCXXABI_NO_CFI
72 #endif
73
74 // wasm32 follows the arm32 ABI convention of using 32-bit guard.
75 #if defined(__arm__) || defined(__wasm32__) || defined(__ARM64_ARCH_8_32__)
76 #  define _LIBCXXABI_GUARD_ABI_ARM
77 #endif
78
79 #if defined(_LIBCXXABI_COMPILER_CLANG)
80 #  if !__has_feature(cxx_exceptions)
81 #    define _LIBCXXABI_NO_EXCEPTIONS
82 #  endif
83 #elif defined(_LIBCXXABI_COMPILER_GCC) && !__EXCEPTIONS
84 #  define _LIBCXXABI_NO_EXCEPTIONS
85 #endif
86
87 #endif // ____CXXABI_CONFIG_H