Tests: Introduce arch-mo unit tests
[librseq.git] / include / rseq / compiler.h
1 /* SPDX-License-Identifier: MIT */
2 /* SPDX-FileCopyrightText: 2021 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> */
3
4 /*
5 * rseq/compiler.h
6 *
7 * Work-around asm goto compiler bugs.
8 */
9
10 #ifndef RSEQ_COMPILER_H
11 #define RSEQ_COMPILER_H
12
13 /*
14 * gcc prior to 4.8.2 miscompiles asm goto.
15 * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
16 *
17 * gcc prior to 8.1.0 miscompiles asm goto at O1.
18 * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103908
19 *
20 * clang prior to version 13.0.1 miscompiles asm goto at O2.
21 * https://github.com/llvm/llvm-project/issues/52735
22 *
23 * Work around these issues by adding a volatile inline asm with
24 * memory clobber in the fallthrough after the asm goto and at each
25 * label target. Emit this for all compilers in case other similar
26 * issues are found in the future.
27 */
28 #define rseq_after_asm_goto() asm volatile ("" : : : "memory")
29
30 #if defined(__SIZEOF_LONG__)
31 #define RSEQ_BITS_PER_LONG (__SIZEOF_LONG__ * 8)
32 #elif defined(_LP64)
33 #define RSEQ_BITS_PER_LONG 64
34 #else
35 #define RSEQ_BITS_PER_LONG 32
36 #endif
37
38 #endif /* RSEQ_COMPILER_H_ */
This page took 0.029907 seconds and 4 git commands to generate.