Daily bump.
[official-gcc.git] / gcc / sanitizer.def
blob99f87e5c84b8158c7fe269c540844bdcb13569aa
1 /* This file contains the definitions and documentation for the
2 Address Sanitizer and Thread Sanitizer builtins used in the GNU compiler.
3 Copyright (C) 2012-2013 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 /* Before including this file, you should define a macro:
23 DEF_SANITIZER_BUILTIN (ENUM, NAME, TYPE, ATTRS)
25 See builtins.def for details.
26 The builtins are created by the C-family of FEs in c-family/c-common.c,
27 for other FEs by asan.c. */
29 /* Address Sanitizer */
30 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_INIT, "__asan_init_v1",
31 BT_FN_VOID, ATTR_NOTHROW_LEAF_LIST)
32 /* Do not reorder the BUILT_IN_ASAN_REPORT* builtins, e.g. cfgcleanup.c
33 relies on this order. */
34 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_LOAD1, "__asan_report_load1",
35 BT_FN_VOID_PTR, ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
36 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_LOAD2, "__asan_report_load2",
37 BT_FN_VOID_PTR, ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
38 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_LOAD4, "__asan_report_load4",
39 BT_FN_VOID_PTR, ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
40 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_LOAD8, "__asan_report_load8",
41 BT_FN_VOID_PTR, ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
42 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_LOAD16, "__asan_report_load16",
43 BT_FN_VOID_PTR, ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
44 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_STORE1, "__asan_report_store1",
45 BT_FN_VOID_PTR, ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
46 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_STORE2, "__asan_report_store2",
47 BT_FN_VOID_PTR, ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
48 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_STORE4, "__asan_report_store4",
49 BT_FN_VOID_PTR, ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
50 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_STORE8, "__asan_report_store8",
51 BT_FN_VOID_PTR, ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
52 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_STORE16, "__asan_report_store16",
53 BT_FN_VOID_PTR, ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
54 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REGISTER_GLOBALS,
55 "__asan_register_globals",
56 BT_FN_VOID_PTR_PTRMODE, ATTR_NOTHROW_LEAF_LIST)
57 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_UNREGISTER_GLOBALS,
58 "__asan_unregister_globals",
59 BT_FN_VOID_PTR_PTRMODE, ATTR_NOTHROW_LEAF_LIST)
60 DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_HANDLE_NO_RETURN,
61 "__asan_handle_no_return",
62 BT_FN_VOID, ATTR_TMPURE_NOTHROW_LEAF_LIST)
64 /* Thread Sanitizer */
65 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_INIT, "__tsan_init",
66 BT_FN_VOID, ATTR_NOTHROW_LEAF_LIST)
67 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_FUNC_ENTRY, "__tsan_func_entry",
68 BT_FN_VOID_PTR, ATTR_NOTHROW_LEAF_LIST)
69 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_FUNC_EXIT, "__tsan_func_exit",
70 BT_FN_VOID_PTR, ATTR_NOTHROW_LEAF_LIST)
71 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_VPTR_UPDATE, "__tsan_vptr_update",
72 BT_FN_VOID_PTR, ATTR_NOTHROW_LEAF_LIST)
73 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_READ1, "__tsan_read1",
74 BT_FN_VOID_PTR, ATTR_NOTHROW_LEAF_LIST)
75 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_READ2, "__tsan_read2",
76 BT_FN_VOID_PTR, ATTR_NOTHROW_LEAF_LIST)
77 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_READ4, "__tsan_read4",
78 BT_FN_VOID_PTR, ATTR_NOTHROW_LEAF_LIST)
79 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_READ8, "__tsan_read8",
80 BT_FN_VOID_PTR, ATTR_NOTHROW_LEAF_LIST)
81 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_READ16, "__tsan_read16",
82 BT_FN_VOID_PTR, ATTR_NOTHROW_LEAF_LIST)
83 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_WRITE1, "__tsan_write1",
84 BT_FN_VOID_PTR, ATTR_NOTHROW_LEAF_LIST)
85 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_WRITE2, "__tsan_write2",
86 BT_FN_VOID_PTR, ATTR_NOTHROW_LEAF_LIST)
87 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_WRITE4, "__tsan_write4",
88 BT_FN_VOID_PTR, ATTR_NOTHROW_LEAF_LIST)
89 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_WRITE8, "__tsan_write8",
90 BT_FN_VOID_PTR, ATTR_NOTHROW_LEAF_LIST)
91 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_WRITE16, "__tsan_write16",
92 BT_FN_VOID_PTR, ATTR_NOTHROW_LEAF_LIST)
94 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC8_LOAD,
95 "__tsan_atomic8_load",
96 BT_FN_I1_CONST_VPTR_INT, ATTR_NOTHROW_LEAF_LIST)
97 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC16_LOAD,
98 "__tsan_atomic16_load",
99 BT_FN_I2_CONST_VPTR_INT, ATTR_NOTHROW_LEAF_LIST)
100 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC32_LOAD,
101 "__tsan_atomic32_load",
102 BT_FN_I4_CONST_VPTR_INT, ATTR_NOTHROW_LEAF_LIST)
103 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC64_LOAD,
104 "__tsan_atomic64_load",
105 BT_FN_I8_CONST_VPTR_INT, ATTR_NOTHROW_LEAF_LIST)
106 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC128_LOAD,
107 "__tsan_atomic128_load",
108 BT_FN_I16_CONST_VPTR_INT, ATTR_NOTHROW_LEAF_LIST)
110 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC8_STORE,
111 "__tsan_atomic8_store",
112 BT_FN_VOID_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
113 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC16_STORE,
114 "__tsan_atomic16_store",
115 BT_FN_VOID_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
116 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC32_STORE,
117 "__tsan_atomic32_store",
118 BT_FN_VOID_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
119 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC64_STORE,
120 "__tsan_atomic64_store",
121 BT_FN_VOID_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
122 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC128_STORE,
123 "__tsan_atomic128_store",
124 BT_FN_VOID_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
126 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC8_EXCHANGE,
127 "__tsan_atomic8_exchange",
128 BT_FN_I1_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
129 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC16_EXCHANGE,
130 "__tsan_atomic16_exchange",
131 BT_FN_I2_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
132 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC32_EXCHANGE,
133 "__tsan_atomic32_exchange",
134 BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
135 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC64_EXCHANGE,
136 "__tsan_atomic64_exchange",
137 BT_FN_I8_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
138 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC128_EXCHANGE,
139 "__tsan_atomic128_exchange",
140 BT_FN_I16_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
142 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC8_FETCH_ADD,
143 "__tsan_atomic8_fetch_add",
144 BT_FN_I1_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
145 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC16_FETCH_ADD,
146 "__tsan_atomic16_fetch_add",
147 BT_FN_I2_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
148 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC32_FETCH_ADD,
149 "__tsan_atomic32_fetch_add",
150 BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
151 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC64_FETCH_ADD,
152 "__tsan_atomic64_fetch_add",
153 BT_FN_I8_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
154 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC128_FETCH_ADD,
155 "__tsan_atomic128_fetch_add",
156 BT_FN_I16_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
158 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC8_FETCH_SUB,
159 "__tsan_atomic8_fetch_sub",
160 BT_FN_I1_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
161 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC16_FETCH_SUB,
162 "__tsan_atomic16_fetch_sub",
163 BT_FN_I2_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
164 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC32_FETCH_SUB,
165 "__tsan_atomic32_fetch_sub",
166 BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
167 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC64_FETCH_SUB,
168 "__tsan_atomic64_fetch_sub",
169 BT_FN_I8_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
170 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC128_FETCH_SUB,
171 "__tsan_atomic128_fetch_sub",
172 BT_FN_I16_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
174 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC8_FETCH_AND,
175 "__tsan_atomic8_fetch_and",
176 BT_FN_I1_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
177 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC16_FETCH_AND,
178 "__tsan_atomic16_fetch_and",
179 BT_FN_I2_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
180 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC32_FETCH_AND,
181 "__tsan_atomic32_fetch_and",
182 BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
183 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC64_FETCH_AND,
184 "__tsan_atomic64_fetch_and",
185 BT_FN_I8_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
186 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC128_FETCH_AND,
187 "__tsan_atomic128_fetch_and",
188 BT_FN_I16_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
190 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC8_FETCH_OR,
191 "__tsan_atomic8_fetch_or",
192 BT_FN_I1_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
193 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC16_FETCH_OR,
194 "__tsan_atomic16_fetch_or",
195 BT_FN_I2_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
196 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC32_FETCH_OR,
197 "__tsan_atomic32_fetch_or",
198 BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
199 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC64_FETCH_OR,
200 "__tsan_atomic64_fetch_or",
201 BT_FN_I8_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
202 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC128_FETCH_OR,
203 "__tsan_atomic128_fetch_or",
204 BT_FN_I16_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
206 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC8_FETCH_XOR,
207 "__tsan_atomic8_fetch_xor",
208 BT_FN_I1_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
209 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC16_FETCH_XOR,
210 "__tsan_atomic16_fetch_xor",
211 BT_FN_I2_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
212 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC32_FETCH_XOR,
213 "__tsan_atomic32_fetch_xor",
214 BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
215 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC64_FETCH_XOR,
216 "__tsan_atomic64_fetch_xor",
217 BT_FN_I8_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
218 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC128_FETCH_XOR,
219 "__tsan_atomic128_fetch_xor",
220 BT_FN_I16_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
222 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC8_FETCH_NAND,
223 "__tsan_atomic8_fetch_nand",
224 BT_FN_I1_VPTR_I1_INT, ATTR_NOTHROW_LEAF_LIST)
225 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC16_FETCH_NAND,
226 "__tsan_atomic16_fetch_nand",
227 BT_FN_I2_VPTR_I2_INT, ATTR_NOTHROW_LEAF_LIST)
228 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC32_FETCH_NAND,
229 "__tsan_atomic32_fetch_nand",
230 BT_FN_I4_VPTR_I4_INT, ATTR_NOTHROW_LEAF_LIST)
231 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC64_FETCH_NAND,
232 "__tsan_atomic64_fetch_nand",
233 BT_FN_I8_VPTR_I8_INT, ATTR_NOTHROW_LEAF_LIST)
234 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC128_FETCH_NAND,
235 "__tsan_atomic128_fetch_nand",
236 BT_FN_I16_VPTR_I16_INT, ATTR_NOTHROW_LEAF_LIST)
238 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC8_COMPARE_EXCHANGE_STRONG,
239 "__tsan_atomic8_compare_exchange_strong",
240 BT_FN_BOOL_VPTR_PTR_I1_INT_INT,
241 ATTR_NOTHROW_LEAF_LIST)
242 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC16_COMPARE_EXCHANGE_STRONG,
243 "__tsan_atomic16_compare_exchange_strong",
244 BT_FN_BOOL_VPTR_PTR_I2_INT_INT,
245 ATTR_NOTHROW_LEAF_LIST)
246 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC32_COMPARE_EXCHANGE_STRONG,
247 "__tsan_atomic32_compare_exchange_strong",
248 BT_FN_BOOL_VPTR_PTR_I4_INT_INT,
249 ATTR_NOTHROW_LEAF_LIST)
250 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC64_COMPARE_EXCHANGE_STRONG,
251 "__tsan_atomic64_compare_exchange_strong",
252 BT_FN_BOOL_VPTR_PTR_I8_INT_INT,
253 ATTR_NOTHROW_LEAF_LIST)
254 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC128_COMPARE_EXCHANGE_STRONG,
255 "__tsan_atomic128_compare_exchange_strong",
256 BT_FN_BOOL_VPTR_PTR_I16_INT_INT,
257 ATTR_NOTHROW_LEAF_LIST)
259 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC8_COMPARE_EXCHANGE_WEAK,
260 "__tsan_atomic8_compare_exchange_weak",
261 BT_FN_BOOL_VPTR_PTR_I1_INT_INT,
262 ATTR_NOTHROW_LEAF_LIST)
263 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC16_COMPARE_EXCHANGE_WEAK,
264 "__tsan_atomic16_compare_exchange_weak",
265 BT_FN_BOOL_VPTR_PTR_I2_INT_INT,
266 ATTR_NOTHROW_LEAF_LIST)
267 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC32_COMPARE_EXCHANGE_WEAK,
268 "__tsan_atomic32_compare_exchange_weak",
269 BT_FN_BOOL_VPTR_PTR_I4_INT_INT,
270 ATTR_NOTHROW_LEAF_LIST)
271 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC64_COMPARE_EXCHANGE_WEAK,
272 "__tsan_atomic64_compare_exchange_weak",
273 BT_FN_BOOL_VPTR_PTR_I8_INT_INT,
274 ATTR_NOTHROW_LEAF_LIST)
275 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC128_COMPARE_EXCHANGE_WEAK,
276 "__tsan_atomic128_compare_exchange_weak",
277 BT_FN_BOOL_VPTR_PTR_I16_INT_INT,
278 ATTR_NOTHROW_LEAF_LIST)
280 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC_THREAD_FENCE,
281 "__tsan_atomic_thread_fence",
282 BT_FN_VOID_INT, ATTR_NOTHROW_LEAF_LIST)
283 DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_ATOMIC_SIGNAL_FENCE,
284 "__tsan_atomic_signal_fence",
285 BT_FN_VOID_INT, ATTR_NOTHROW_LEAF_LIST)