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