Skip to content

Commit

Permalink
builder: Fix undefined __noinline__ issue
Browse files Browse the repository at this point in the history
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 <hffilwlqm@gmail.com>
  • Loading branch information
Asphaltt committed Feb 19, 2024
1 parent 0b3b762 commit 9a0a416
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kern/bpf/bpf_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9a0a416

Please sign in to comment.