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