Re: [PATCH bpf-next v6] selftests/bpf: trace_helpers.c: optimize kallsyms cache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 22, 2023 at 08:38:58AM +0800, Rong Tao wrote:
> > I think you need to fix this on samples/bpf side
> > 
> > I tried to play with the samples/bpf/ includes, but couldn't find a way to
> > make this work.. selftests base includes on tools/include, while samples
> > have $(objtree)/usr/include as first include and AFAICS the __must_check is
> > defined under __KERNEL__ ifdef
> > 
> > I guess the reason samples use $(objtree)/usr/include is to get some struct
> > definitions which are not in tools/include, but looks like some samples objects
> > already use vmlinux.h include, so that could be the way forward to fix that
> 
> I tried the method you suggested, and some unexpected problems occurred. Maybe,
> we can apply v5 [0] first, and then solve this problem?

how about change below, seem to work for me

jirka


---
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 151ec320818b..3115f054dca7 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -316,6 +316,8 @@ XDP_SAMPLE_CFLAGS += -Wall -O2 \
 $(obj)/$(XDP_SAMPLE): TPROGS_CFLAGS = $(XDP_SAMPLE_CFLAGS)
 $(obj)/$(XDP_SAMPLE): $(src)/xdp_sample_user.h $(src)/xdp_sample_shared.h
 
+$(obj)/$(TRACE_HELPERS): TPROGS_CFLAGS := $(TPROGS_CFLAGS) -D__must_check=
+
 -include $(BPF_SAMPLES_PATH)/Makefile.target
 
 VMLINUX_BTF_PATHS ?= $(abspath $(if $(O),$(O)/vmlinux))				\
diff --git a/tools/testing/selftests/bpf/trace_helpers.c b/tools/testing/selftests/bpf/trace_helpers.c
index 316a7874a12b..551547ba6829 100644
--- a/tools/testing/selftests/bpf/trace_helpers.c
+++ b/tools/testing/selftests/bpf/trace_helpers.c
@@ -14,9 +14,6 @@
 #include <linux/limits.h>
 #include <libelf.h>
 #include <gelf.h>
-#ifndef __must_check
-#define __must_check
-#endif
 #include "bpf/libbpf_internal.h"
 
 #define TRACEFS_PIPE	"/sys/kernel/tracing/trace_pipe"



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux