aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/bpf_helpers.h
diff options
context:
space:
mode:
authorPedro Tammela <[email protected]>2021-03-14 17:38:38 +0000
committerAndrii Nakryiko <[email protected]>2021-03-16 05:11:17 +0000
commit0205e9de42911404902728911b03fc1469242419 (patch)
treec8f0b87b5674b666291685f0cb0c0e4877d721ef /tools/lib/bpf/bpf_helpers.h
parentbpf: Add getter and setter for SO_REUSEPORT through bpf_{g,s}etsockopt (diff)
downloadkernel-0205e9de42911404902728911b03fc1469242419.tar.gz
kernel-0205e9de42911404902728911b03fc1469242419.zip
libbpf: Avoid inline hint definition from 'linux/stddef.h'
Linux headers might pull 'linux/stddef.h' which defines '__always_inline' as the following: #ifndef __always_inline #define __always_inline inline #endif This becomes an issue if the program picks up the 'linux/stddef.h' definition as the macro now just hints inline to clang. This change now enforces the proper definition for BPF programs regardless of the include order. Signed-off-by: Pedro Tammela <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/lib/bpf/bpf_helpers.h')
-rw-r--r--tools/lib/bpf/bpf_helpers.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/lib/bpf/bpf_helpers.h b/tools/lib/bpf/bpf_helpers.h
index ae6c975e0b87..53ff81c49dbd 100644
--- a/tools/lib/bpf/bpf_helpers.h
+++ b/tools/lib/bpf/bpf_helpers.h
@@ -29,9 +29,10 @@
*/
#define SEC(NAME) __attribute__((section(NAME), used))
-#ifndef __always_inline
+/* Avoid 'linux/stddef.h' definition of '__always_inline'. */
+#undef __always_inline
#define __always_inline inline __attribute__((always_inline))
-#endif
+
#ifndef __noinline
#define __noinline __attribute__((noinline))
#endif