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