xref: /freebsd/contrib/llvm-project/libunwind/include/__libunwind_config.h (revision 2e3507c25e42292b45a5482e116d278f5515d04d)
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 ____LIBUNWIND_CONFIG_H__
10 #define ____LIBUNWIND_CONFIG_H__
11 
12 #define _LIBUNWIND_VERSION 15000
13 
14 #if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \
15     !defined(__ARM_DWARF_EH__) && !defined(__SEH__)
16 #define _LIBUNWIND_ARM_EHABI
17 #endif
18 
19 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86       8
20 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86_64    32
21 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC       112
22 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64     116
23 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM64     95
24 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM       287
25 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_OR1K      32
26 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_MIPS      65
27 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_SPARC     31
28 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_SPARC64   31
29 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_HEXAGON   34
30 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_RISCV     64
31 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_VE        143
32 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_S390X     83
33 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_LOONGARCH 64
34 
35 #if defined(_LIBUNWIND_IS_NATIVE_ONLY)
36 # if defined(__linux__)
37 #  define _LIBUNWIND_TARGET_LINUX 1
38 # endif
39 # if defined(__i386__)
40 #  define _LIBUNWIND_TARGET_I386
41 #  define _LIBUNWIND_CONTEXT_SIZE 8
42 #  define _LIBUNWIND_CURSOR_SIZE 15
43 #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86
44 # elif defined(__x86_64__)
45 #  define _LIBUNWIND_TARGET_X86_64 1
46 #  if defined(_WIN64)
47 #    define _LIBUNWIND_CONTEXT_SIZE 54
48 #    ifdef __SEH__
49 #      define _LIBUNWIND_CURSOR_SIZE 204
50 #    else
51 #      define _LIBUNWIND_CURSOR_SIZE 66
52 #    endif
53 #  else
54 #    define _LIBUNWIND_CONTEXT_SIZE 21
55 #    define _LIBUNWIND_CURSOR_SIZE 33
56 #  endif
57 #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86_64
58 # elif defined(__powerpc64__)
59 #  define _LIBUNWIND_TARGET_PPC64 1
60 #  define _LIBUNWIND_CONTEXT_SIZE 167
61 #  define _LIBUNWIND_CURSOR_SIZE 179
62 #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
63 # elif defined(__powerpc__)
64 #  define _LIBUNWIND_TARGET_PPC 1
65 #  define _LIBUNWIND_CONTEXT_SIZE 117
66 #  define _LIBUNWIND_CURSOR_SIZE 124
67 #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC
68 # elif defined(__aarch64__)
69 #  define _LIBUNWIND_TARGET_AARCH64 1
70 #  define _LIBUNWIND_CONTEXT_SIZE 66
71 #  if defined(__SEH__)
72 #    define _LIBUNWIND_CURSOR_SIZE 164
73 #  else
74 #    define _LIBUNWIND_CURSOR_SIZE 78
75 #  endif
76 #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM64
77 # elif defined(__arm__)
78 #  define _LIBUNWIND_TARGET_ARM 1
79 #  if defined(__SEH__)
80 #    define _LIBUNWIND_CONTEXT_SIZE 42
81 #    define _LIBUNWIND_CURSOR_SIZE 80
82 #  elif defined(__ARM_WMMX)
83 #    define _LIBUNWIND_CONTEXT_SIZE 61
84 #    define _LIBUNWIND_CURSOR_SIZE 68
85 #  else
86 #    define _LIBUNWIND_CONTEXT_SIZE 42
87 #    define _LIBUNWIND_CURSOR_SIZE 49
88 #  endif
89 #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM
90 # elif defined(__or1k__)
91 #  define _LIBUNWIND_TARGET_OR1K 1
92 #  define _LIBUNWIND_CONTEXT_SIZE 16
93 #  define _LIBUNWIND_CURSOR_SIZE 24
94 #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_OR1K
95 # elif defined(__hexagon__)
96 #  define _LIBUNWIND_TARGET_HEXAGON 1
97 // Values here change when : Registers.hpp - hexagon_thread_state_t change
98 #  define _LIBUNWIND_CONTEXT_SIZE 18
99 #  define _LIBUNWIND_CURSOR_SIZE 24
100 #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_HEXAGON
101 # elif defined(__mips__)
102 #  if defined(_ABIO32) && _MIPS_SIM == _ABIO32
103 #    define _LIBUNWIND_TARGET_MIPS_O32 1
104 #    if defined(__mips_hard_float)
105 #      define _LIBUNWIND_CONTEXT_SIZE 50
106 #      define _LIBUNWIND_CURSOR_SIZE 57
107 #    else
108 #      define _LIBUNWIND_CONTEXT_SIZE 18
109 #      define _LIBUNWIND_CURSOR_SIZE 24
110 #    endif
111 #  elif defined(_ABIN32) && _MIPS_SIM == _ABIN32
112 #    define _LIBUNWIND_TARGET_MIPS_NEWABI 1
113 #    if defined(__mips_hard_float)
114 #      define _LIBUNWIND_CONTEXT_SIZE 67
115 #      define _LIBUNWIND_CURSOR_SIZE 74
116 #    else
117 #      define _LIBUNWIND_CONTEXT_SIZE 35
118 #      define _LIBUNWIND_CURSOR_SIZE 42
119 #    endif
120 #  elif defined(_ABI64) && _MIPS_SIM == _ABI64
121 #    define _LIBUNWIND_TARGET_MIPS_NEWABI 1
122 #    if defined(__mips_hard_float)
123 #      define _LIBUNWIND_CONTEXT_SIZE 67
124 #      define _LIBUNWIND_CURSOR_SIZE 79
125 #    else
126 #      define _LIBUNWIND_CONTEXT_SIZE 35
127 #      define _LIBUNWIND_CURSOR_SIZE 47
128 #    endif
129 #  else
130 #    error "Unsupported MIPS ABI and/or environment"
131 #  endif
132 #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_MIPS
133 #elif defined(__sparc__) && defined(__arch64__)
134 #define _LIBUNWIND_TARGET_SPARC64 1
135 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER                                      \
136   _LIBUNWIND_HIGHEST_DWARF_REGISTER_SPARC64
137 #define _LIBUNWIND_CONTEXT_SIZE 33
138 #define _LIBUNWIND_CURSOR_SIZE 45
139 # elif defined(__sparc__)
140   #define _LIBUNWIND_TARGET_SPARC 1
141   #define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_SPARC
142   #define _LIBUNWIND_CONTEXT_SIZE 16
143   #define _LIBUNWIND_CURSOR_SIZE 23
144 # elif defined(__riscv)
145 #  define _LIBUNWIND_TARGET_RISCV 1
146 #  if defined(__riscv_flen)
147 #   define RISCV_FLEN __riscv_flen
148 #  else
149 #   define RISCV_FLEN 0
150 #  endif
151 #  define _LIBUNWIND_CONTEXT_SIZE (32 * (__riscv_xlen + RISCV_FLEN) / 64)
152 #  if __riscv_xlen == 32
153 #   define _LIBUNWIND_CURSOR_SIZE (_LIBUNWIND_CONTEXT_SIZE + 7)
154 #  elif __riscv_xlen == 64
155 #   define _LIBUNWIND_CURSOR_SIZE (_LIBUNWIND_CONTEXT_SIZE + 12)
156 #  else
157 #   error "Unsupported RISC-V ABI"
158 #  endif
159 # define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_RISCV
160 # elif defined(__ve__)
161 #  define _LIBUNWIND_TARGET_VE 1
162 #  define _LIBUNWIND_CONTEXT_SIZE 67
163 #  define _LIBUNWIND_CURSOR_SIZE 79
164 #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_VE
165 # elif defined(__s390x__)
166 #  define _LIBUNWIND_TARGET_S390X 1
167 #  define _LIBUNWIND_CONTEXT_SIZE 34
168 #  define _LIBUNWIND_CURSOR_SIZE 46
169 #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_S390X
170 #elif defined(__loongarch__)
171 #define _LIBUNWIND_TARGET_LOONGARCH 1
172 #if __loongarch_grlen == 64
173 #define _LIBUNWIND_CONTEXT_SIZE 65
174 #define _LIBUNWIND_CURSOR_SIZE 77
175 #else
176 #error "Unsupported LoongArch ABI"
177 #endif
178 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER                                      \
179   _LIBUNWIND_HIGHEST_DWARF_REGISTER_LOONGARCH
180 # else
181 #  error "Unsupported architecture."
182 # endif
183 #else // !_LIBUNWIND_IS_NATIVE_ONLY
184 # define _LIBUNWIND_TARGET_I386
185 # define _LIBUNWIND_TARGET_X86_64 1
186 # define _LIBUNWIND_TARGET_PPC 1
187 # define _LIBUNWIND_TARGET_PPC64 1
188 # define _LIBUNWIND_TARGET_AARCH64 1
189 # define _LIBUNWIND_TARGET_ARM 1
190 # define _LIBUNWIND_TARGET_OR1K 1
191 # define _LIBUNWIND_TARGET_MIPS_O32 1
192 # define _LIBUNWIND_TARGET_MIPS_NEWABI 1
193 # define _LIBUNWIND_TARGET_SPARC 1
194 # define _LIBUNWIND_TARGET_SPARC64 1
195 # define _LIBUNWIND_TARGET_HEXAGON 1
196 # define _LIBUNWIND_TARGET_RISCV 1
197 # define _LIBUNWIND_TARGET_VE 1
198 # define _LIBUNWIND_TARGET_S390X 1
199  #define _LIBUNWIND_TARGET_LOONGARCH 1
200 # define _LIBUNWIND_CONTEXT_SIZE 167
201 # define _LIBUNWIND_CURSOR_SIZE 204
202 # define _LIBUNWIND_HIGHEST_DWARF_REGISTER 287
203 #endif // _LIBUNWIND_IS_NATIVE_ONLY
204 
205 #endif // ____LIBUNWIND_CONFIG_H__
206