Message ID | 20240828170635.4112907-1-legion@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [v2] bpf: Remove custom build rule | expand |
On Thu, Aug 29, 2024 at 2:07 AM Alexey Gladkov <legion@kernel.org> wrote: > > According to the documentation, when building a kernel with the C=2 > parameter, all source files should be checked. But this does not happen > for the kernel/bpf/ directory. > > $ touch kernel/bpf/core.o > $ make C=2 CHECK=true kernel/bpf/core.o > > Outputs: > > CHECK scripts/mod/empty.c > CALL scripts/checksyscalls.sh > DESCEND objtool > INSTALL libsubcmd_headers > CC kernel/bpf/core.o > > As can be seen the compilation is done, but CHECK is not executed. This > happens because kernel/bpf/Makefile has defined its own rule for > compilation and forgotten the macro that does the check. > > There is no need to duplicate the build code, and this rule can be > removed to use generic rules. > > Signed-off-by: Alexey Gladkov <legion@kernel.org> Did you compile-test this? See my previous email. I said this: $ cat kernel/bpf/btf_iter.c #include "../../tools/lib/bpf/btf_iter.c" Same for kernel/bpf/btf_relocate.c kernel/bpf/relo_core.c > --- > kernel/bpf/Makefile | 6 ------ > 1 file changed, 6 deletions(-) > > diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile > index 0291eef9ce92..9b9c151b5c82 100644 > --- a/kernel/bpf/Makefile > +++ b/kernel/bpf/Makefile > @@ -52,9 +52,3 @@ obj-$(CONFIG_BPF_PRELOAD) += preload/ > obj-$(CONFIG_BPF_SYSCALL) += relo_core.o > obj-$(CONFIG_BPF_SYSCALL) += btf_iter.o > obj-$(CONFIG_BPF_SYSCALL) += btf_relocate.o > - > -# Some source files are common to libbpf. > -vpath %.c $(srctree)/kernel/bpf:$(srctree)/tools/lib/bpf > - > -$(obj)/%.o: %.c FORCE > - $(call if_changed_rule,cc_o_c) > -- > 2.46.0 > -- Best Regards Masahiro Yamada
On Thu, Aug 29, 2024 at 02:22:33AM +0900, Masahiro Yamada wrote: > On Thu, Aug 29, 2024 at 2:07 AM Alexey Gladkov <legion@kernel.org> wrote: > > > > According to the documentation, when building a kernel with the C=2 > > parameter, all source files should be checked. But this does not happen > > for the kernel/bpf/ directory. > > > > $ touch kernel/bpf/core.o > > $ make C=2 CHECK=true kernel/bpf/core.o > > > > Outputs: > > > > CHECK scripts/mod/empty.c > > CALL scripts/checksyscalls.sh > > DESCEND objtool > > INSTALL libsubcmd_headers > > CC kernel/bpf/core.o > > > > As can be seen the compilation is done, but CHECK is not executed. This > > happens because kernel/bpf/Makefile has defined its own rule for > > compilation and forgotten the macro that does the check. > > > > There is no need to duplicate the build code, and this rule can be > > removed to use generic rules. > > > > Signed-off-by: Alexey Gladkov <legion@kernel.org> > > > Did you compile-test this? Yes. I repeated my steps for reproduce: $ touch kernel/bpf/core.c $ make C=2 CHECK=true |grep kernel/bpf/core CC kernel/bpf/core.o CHECK kernel/bpf/core.c but maybe my config is too small. > > See my previous email. > > > > > I said this: > > $ cat kernel/bpf/btf_iter.c > #include "../../tools/lib/bpf/btf_iter.c" > > > Same for > kernel/bpf/btf_relocate.c > kernel/bpf/relo_core.c > > > > > > > > > > > > > --- > > kernel/bpf/Makefile | 6 ------ > > 1 file changed, 6 deletions(-) > > > > diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile > > index 0291eef9ce92..9b9c151b5c82 100644 > > --- a/kernel/bpf/Makefile > > +++ b/kernel/bpf/Makefile > > @@ -52,9 +52,3 @@ obj-$(CONFIG_BPF_PRELOAD) += preload/ > > obj-$(CONFIG_BPF_SYSCALL) += relo_core.o > > obj-$(CONFIG_BPF_SYSCALL) += btf_iter.o > > obj-$(CONFIG_BPF_SYSCALL) += btf_relocate.o > > - > > -# Some source files are common to libbpf. > > -vpath %.c $(srctree)/kernel/bpf:$(srctree)/tools/lib/bpf > > - > > -$(obj)/%.o: %.c FORCE > > - $(call if_changed_rule,cc_o_c) > > -- > > 2.46.0 > > > > > -- > Best Regards > Masahiro Yamada >
diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile index 0291eef9ce92..9b9c151b5c82 100644 --- a/kernel/bpf/Makefile +++ b/kernel/bpf/Makefile @@ -52,9 +52,3 @@ obj-$(CONFIG_BPF_PRELOAD) += preload/ obj-$(CONFIG_BPF_SYSCALL) += relo_core.o obj-$(CONFIG_BPF_SYSCALL) += btf_iter.o obj-$(CONFIG_BPF_SYSCALL) += btf_relocate.o - -# Some source files are common to libbpf. -vpath %.c $(srctree)/kernel/bpf:$(srctree)/tools/lib/bpf - -$(obj)/%.o: %.c FORCE - $(call if_changed_rule,cc_o_c)
According to the documentation, when building a kernel with the C=2 parameter, all source files should be checked. But this does not happen for the kernel/bpf/ directory. $ touch kernel/bpf/core.o $ make C=2 CHECK=true kernel/bpf/core.o Outputs: CHECK scripts/mod/empty.c CALL scripts/checksyscalls.sh DESCEND objtool INSTALL libsubcmd_headers CC kernel/bpf/core.o As can be seen the compilation is done, but CHECK is not executed. This happens because kernel/bpf/Makefile has defined its own rule for compilation and forgotten the macro that does the check. There is no need to duplicate the build code, and this rule can be removed to use generic rules. Signed-off-by: Alexey Gladkov <legion@kernel.org> --- kernel/bpf/Makefile | 6 ------ 1 file changed, 6 deletions(-)