1 /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
5 * Copyright (C) 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 #ifndef _LTTNG_WRAPPER_COMPILER_H
9 #define _LTTNG_WRAPPER_COMPILER_H
11 #include <linux/compiler.h>
12 #include <lttng-kernel-version.h>
15 * Don't allow compiling with buggy compiler.
21 * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58854
24 # if GCC_VERSION >= 40800 && GCC_VERSION <= 40802
25 # error Your gcc version produces clobbered frame accesses
30 * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63293
33 # if GCC_VERSION < 50100
34 # error Your gcc version performs unsafe access to deallocated stack
41 * READ/WRITE_ONCE were introduced in kernel 3.19 and ACCESS_ONCE
42 * was removed in 4.15. Prefer READ/WRITE but fallback to ACCESS
43 * when they are not available.
46 # define READ_ONCE(x) ACCESS_ONCE(x)
50 # define WRITE_ONCE(x, val) ({ ACCESS_ONCE(x) = val; })
54 * In v4.15 a smp read barrier was added to READ_ONCE to replace
55 * lockless_dereference(), replicate this behavior on prior kernels
56 * and remove calls to smp_read_barrier_depends which was dropped
59 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,15,0))
60 #define LTTNG_READ_ONCE(x) READ_ONCE(x)
62 #define LTTNG_READ_ONCE(x) \
64 typeof(x) __val = READ_ONCE(x); \
65 smp_read_barrier_depends(); \
70 #endif /* _LTTNG_WRAPPER_COMPILER_H */
This page took 0.03287 seconds and 4 git commands to generate.