Mercurial > hg > CbC > CbC_llvm
comparison libunwind/src/config.h @ 207:2e18cbf3894f
LLVM12
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 08 Jun 2021 06:07:14 +0900 |
parents | 0572611fdcc8 |
children | c4bab56944e8 |
comparison
equal
deleted
inserted
replaced
173:0572611fdcc8 | 207:2e18cbf3894f |
---|---|
16 #include <assert.h> | 16 #include <assert.h> |
17 #include <stdio.h> | 17 #include <stdio.h> |
18 #include <stdint.h> | 18 #include <stdint.h> |
19 #include <stdlib.h> | 19 #include <stdlib.h> |
20 | 20 |
21 // Define static_assert() unless already defined by compiler. | 21 #include <__libunwind_config.h> |
22 #ifndef __has_feature | |
23 #define __has_feature(__x) 0 | |
24 #endif | |
25 #if !(__has_feature(cxx_static_assert)) && !defined(static_assert) | |
26 #define static_assert(__b, __m) \ | |
27 extern int compile_time_assert_failed[ ( __b ) ? 1 : -1 ] \ | |
28 __attribute__( ( unused ) ); | |
29 #endif | |
30 | 22 |
31 // Platform specific configuration defines. | 23 // Platform specific configuration defines. |
32 #ifdef __APPLE__ | 24 #ifdef __APPLE__ |
33 #if defined(FOR_DYLD) | 25 #if defined(FOR_DYLD) |
34 #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND | 26 #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1 |
35 #else | 27 #else |
36 #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND | 28 #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1 |
37 #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1 | 29 #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1 |
38 #endif | 30 #endif |
39 #elif defined(_WIN32) | 31 #elif defined(_WIN32) |
40 #ifdef __SEH__ | 32 #ifdef __SEH__ |
41 #define _LIBUNWIND_SUPPORT_SEH_UNWIND 1 | 33 #define _LIBUNWIND_SUPPORT_SEH_UNWIND 1 |
42 #else | 34 #else |
43 #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1 | 35 #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1 |
44 #endif | 36 #endif |
45 #else | 37 #elif defined(_LIBUNWIND_IS_BAREMETAL) |
46 #if defined(__ARM_DWARF_EH__) || !defined(__arm__) | 38 #if !defined(_LIBUNWIND_ARM_EHABI) |
47 #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1 | 39 #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1 |
48 #define _LIBUNWIND_SUPPORT_DWARF_INDEX 1 | 40 #define _LIBUNWIND_SUPPORT_DWARF_INDEX 1 |
49 #endif | 41 #endif |
50 #endif | 42 #elif defined(__BIONIC__) && defined(_LIBUNWIND_ARM_EHABI) |
51 | 43 // For ARM EHABI, Bionic didn't implement dl_iterate_phdr until API 21. After |
52 #if defined(_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS) | 44 // API 21, dl_iterate_phdr exists, but dl_unwind_find_exidx is much faster. |
45 #define _LIBUNWIND_USE_DL_UNWIND_FIND_EXIDX 1 | |
46 #else | |
47 // Assume an ELF system with a dl_iterate_phdr function. | |
48 #define _LIBUNWIND_USE_DL_ITERATE_PHDR 1 | |
49 #if !defined(_LIBUNWIND_ARM_EHABI) | |
50 #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1 | |
51 #define _LIBUNWIND_SUPPORT_DWARF_INDEX 1 | |
52 #endif | |
53 #endif | |
54 | |
55 #if defined(_LIBUNWIND_HIDE_SYMBOLS) | |
56 // The CMake file passes -fvisibility=hidden to control ELF/Mach-O visibility. | |
53 #define _LIBUNWIND_EXPORT | 57 #define _LIBUNWIND_EXPORT |
54 #define _LIBUNWIND_HIDDEN | 58 #define _LIBUNWIND_HIDDEN |
55 #else | 59 #else |
56 #if !defined(__ELF__) && !defined(__MACH__) | 60 #if !defined(__ELF__) && !defined(__MACH__) |
57 #define _LIBUNWIND_EXPORT __declspec(dllexport) | 61 #define _LIBUNWIND_EXPORT __declspec(dllexport) |
65 #define STR(a) #a | 69 #define STR(a) #a |
66 #define XSTR(a) STR(a) | 70 #define XSTR(a) STR(a) |
67 #define SYMBOL_NAME(name) XSTR(__USER_LABEL_PREFIX__) #name | 71 #define SYMBOL_NAME(name) XSTR(__USER_LABEL_PREFIX__) #name |
68 | 72 |
69 #if defined(__APPLE__) | 73 #if defined(__APPLE__) |
74 #if defined(_LIBUNWIND_HIDE_SYMBOLS) | |
75 #define _LIBUNWIND_ALIAS_VISIBILITY(name) __asm__(".private_extern " name); | |
76 #else | |
77 #define _LIBUNWIND_ALIAS_VISIBILITY(name) | |
78 #endif | |
70 #define _LIBUNWIND_WEAK_ALIAS(name, aliasname) \ | 79 #define _LIBUNWIND_WEAK_ALIAS(name, aliasname) \ |
71 __asm__(".globl " SYMBOL_NAME(aliasname)); \ | 80 __asm__(".globl " SYMBOL_NAME(aliasname)); \ |
72 __asm__(SYMBOL_NAME(aliasname) " = " SYMBOL_NAME(name)); \ | 81 __asm__(SYMBOL_NAME(aliasname) " = " SYMBOL_NAME(name)); \ |
73 extern "C" _LIBUNWIND_EXPORT __typeof(name) aliasname \ | 82 _LIBUNWIND_ALIAS_VISIBILITY(SYMBOL_NAME(aliasname)) |
74 __attribute__((weak_import)); | |
75 #elif defined(__ELF__) | 83 #elif defined(__ELF__) |
76 #define _LIBUNWIND_WEAK_ALIAS(name, aliasname) \ | 84 #define _LIBUNWIND_WEAK_ALIAS(name, aliasname) \ |
77 extern "C" _LIBUNWIND_EXPORT __typeof(name) aliasname \ | 85 extern "C" _LIBUNWIND_EXPORT __typeof(name) aliasname \ |
78 __attribute__((weak, alias(#name))); | 86 __attribute__((weak, alias(#name))); |
79 #elif defined(_WIN32) | 87 #elif defined(_WIN32) |
89 #endif | 97 #endif |
90 #else | 98 #else |
91 #error Unsupported target | 99 #error Unsupported target |
92 #endif | 100 #endif |
93 | 101 |
102 // Apple/armv7k defaults to DWARF/Compact unwinding, but its libunwind also | |
103 // needs to include the SJLJ APIs. | |
94 #if (defined(__APPLE__) && defined(__arm__)) || defined(__USING_SJLJ_EXCEPTIONS__) | 104 #if (defined(__APPLE__) && defined(__arm__)) || defined(__USING_SJLJ_EXCEPTIONS__) |
95 #define _LIBUNWIND_BUILD_SJLJ_APIS | 105 #define _LIBUNWIND_BUILD_SJLJ_APIS |
96 #endif | 106 #endif |
97 | 107 |
98 #if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) | 108 #if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) |
109 #if !defined(_LIBUNWIND_BUILD_SJLJ_APIS) | 119 #if !defined(_LIBUNWIND_BUILD_SJLJ_APIS) |
110 #define _LIBUNWIND_BUILD_ZERO_COST_APIS | 120 #define _LIBUNWIND_BUILD_ZERO_COST_APIS |
111 #endif | 121 #endif |
112 #endif | 122 #endif |
113 | 123 |
114 #if defined(__powerpc64__) && defined(_ARCH_PWR8) | 124 #ifndef _LIBUNWIND_REMEMBER_HEAP_ALLOC |
115 #define PPC64_HAS_VMX | 125 #if defined(_LIBUNWIND_REMEMBER_STACK_ALLOC) || defined(__APPLE__) || \ |
126 defined(__linux__) || defined(__ANDROID__) || defined(__MINGW32__) || \ | |
127 defined(_LIBUNWIND_IS_BAREMETAL) | |
128 #define _LIBUNWIND_REMEMBER_ALLOC(_size) alloca(_size) | |
129 #define _LIBUNWIND_REMEMBER_FREE(_ptr) \ | |
130 do { \ | |
131 } while (0) | |
132 #elif defined(_WIN32) | |
133 #define _LIBUNWIND_REMEMBER_ALLOC(_size) _malloca(_size) | |
134 #define _LIBUNWIND_REMEMBER_FREE(_ptr) _freea(_ptr) | |
135 #define _LIBUNWIND_REMEMBER_CLEANUP_NEEDED | |
136 #else | |
137 #define _LIBUNWIND_REMEMBER_ALLOC(_size) malloc(_size) | |
138 #define _LIBUNWIND_REMEMBER_FREE(_ptr) free(_ptr) | |
139 #define _LIBUNWIND_REMEMBER_CLEANUP_NEEDED | |
140 #endif | |
141 #else /* _LIBUNWIND_REMEMBER_HEAP_ALLOC */ | |
142 #define _LIBUNWIND_REMEMBER_ALLOC(_size) malloc(_size) | |
143 #define _LIBUNWIND_REMEMBER_FREE(_ptr) free(_ptr) | |
144 #define _LIBUNWIND_REMEMBER_CLEANUP_NEEDED | |
116 #endif | 145 #endif |
117 | 146 |
118 #if defined(NDEBUG) && defined(_LIBUNWIND_IS_BAREMETAL) | 147 #if defined(NDEBUG) && defined(_LIBUNWIND_IS_BAREMETAL) |
119 #define _LIBUNWIND_ABORT(msg) \ | 148 #define _LIBUNWIND_ABORT(msg) \ |
120 do { \ | 149 do { \ |