diff mbox series

[v1] bpf: Add missing force_checksrc macro

Message ID 20240828152559.4101550-1-legion@kernel.org (mailing list archive)
State New
Headers show
Series [v1] bpf: Add missing force_checksrc macro | expand

Commit Message

Alexey Gladkov Aug. 28, 2024, 3:25 p.m. UTC
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.

Signed-off-by: Alexey Gladkov <legion@kernel.org>
---
 kernel/bpf/Makefile | 1 +
 1 file changed, 1 insertion(+)

Comments

Masahiro Yamada Aug. 28, 2024, 4:32 p.m. UTC | #1
On Thu, Aug 29, 2024 at 12:42 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.
>
> Signed-off-by: Alexey Gladkov <legion@kernel.org>


NACK.


This Makefile is already screwed up.

There is no need to duplicate the build code.

Please remove the last 6 lines of kernel/bpf/Makefile



See the following code as an example:
arch/arm/boot/compressed/fdt_rw.c




Like 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 | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile
> index 0291eef9ce92..f0ba6bf73bb6 100644
> --- a/kernel/bpf/Makefile
> +++ b/kernel/bpf/Makefile
> @@ -58,3 +58,4 @@ vpath %.c $(srctree)/kernel/bpf:$(srctree)/tools/lib/bpf
>
>  $(obj)/%.o: %.c FORCE
>         $(call if_changed_rule,cc_o_c)
> +       $(call cmd,force_checksrc)
> --
> 2.46.0
>
>
diff mbox series

Patch

diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile
index 0291eef9ce92..f0ba6bf73bb6 100644
--- a/kernel/bpf/Makefile
+++ b/kernel/bpf/Makefile
@@ -58,3 +58,4 @@  vpath %.c $(srctree)/kernel/bpf:$(srctree)/tools/lib/bpf
 
 $(obj)/%.o: %.c FORCE
 	$(call if_changed_rule,cc_o_c)
+	$(call cmd,force_checksrc)