From 9a0a416d396d3c23bf7c8d53ca964d5281a97646 Mon Sep 17 00:00:00 2001 From: Leon Hwang Date: Mon, 19 Feb 2024 22:00:23 +0800 Subject: [PATCH] builder: Fix undefined __noinline__ issue When `make nocore`, there will be a compiling error: ```bash In file included from kern/boringssl_a_13_kern.c:72: In file included from ./kern/openssl.h:16: ./kern/tc.h:116:8: error: use of undeclared identifier '__noinline__' static __noinline bool filter_pcap_ebpf_l2(void *_skb, void *__skb, ^ ./kern/bpf/bpf_helpers.h:47:35: note: expanded from macro '__noinline' ^ /lib/modules/6.5.0-15-generic/build/include/linux/compiler_attributes.h:244:56: note: expanded from macro 'noinline' ^ 1 error generated. ``` This is because definition of `noinline` in `compiler_attributes.h` is incorrect for us, which makes `__noinline` expanding to clang-unrecognised `__attribute__((__attribute__((__noinline__))))`. So, we have to `undef noinline` for clang compiling for `make nocore`. Signed-off-by: Leon Hwang --- kern/bpf/bpf_helpers.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kern/bpf/bpf_helpers.h b/kern/bpf/bpf_helpers.h index 9720dc0b46..62f21d3e43 100644 --- a/kern/bpf/bpf_helpers.h +++ b/kern/bpf/bpf_helpers.h @@ -40,6 +40,9 @@ #undef __always_inline #define __always_inline inline __attribute__((always_inline)) +#if defined(NOCORE) && defined(noinline) +#undef noinline +#endif #ifndef __noinline #define __noinline __attribute__((noinline)) #endif