Skip to contentSkip to conversation

kbuild: suppress warnings for single builds of vmlinux.lds, *.a, etc.

PATCH In review Masahiro Yamada 1 participant 2 messages Sep 26, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: suppress warnings for single builds of vmlinux.lds, *.a, etc.

vmlinux-deps is unneeded because the dependency can directly list $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)

Do not cancel the rule; building an individual vmlinux.lds, built-in.a, or lib.a is working now, but the warning "overriding recipe for target" is shown.

Without this patch:

  $ make arch/x86/kernel/vmlinux.lds
  Makefile:1798: warning: overriding recipe for target 'arch/x86/kernel/vmlinux.lds'
  Makefile:1162: warning: ignoring old recipe for target 'arch/x86/kernel/vmlinux.lds'
    [ snip ]
    LDS     arch/x86/kernel/vmlinux.lds

---

 Makefile | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
Makefile +2 -5
index 244c07f1cc70..3e6974b4ebf2 100644
@@ -1118,7 +1118,8 @@ endif
 export KBUILD_VMLINUX_OBJS KBUILD_VMLINUX_LIBS
 export KBUILD_LDS          := arch/$(SRCARCH)/kernel/vmlinux.lds
 
-vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)
+# The actual objects are generated when descending.
+$(sort $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)): .
 
 # Recurse until adjust_autoksyms.sh is satisfied
 PHONY += autoksyms_recursive
@@ -1157,10 +1158,6 @@ vmlinux: scripts/link-vmlinux.sh vmlinux.o $(KBUILD_LDS) FORCE
 
 targets := vmlinux
 
-# The actual objects are generated when descending,
-# make sure no implicit rule kicks in
-$(sort $(vmlinux-deps)): . ;
-
 filechk_kernel.release = \
 	echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
 
Signature · 1 line
2.34.1
#1 lore raw
Quoted 10 lines · Masahiro Yamada

vmlinux-deps is unneeded because the dependency can directly list $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)

Do not cancel the rule; building an individual vmlinux.lds, built-in.a, or lib.a is working now, but the warning "overriding recipe for target" is shown.

Without this patch:

Quoted 8 lines
  $ make arch/x86/kernel/vmlinux.lds
  Makefile:1798: warning: overriding recipe for target 'arch/x86/kernel/vmlinux.lds'
  Makefile:1162: warning: ignoring old recipe for target 'arch/x86/kernel/vmlinux.lds'
    [ snip ]
    LDS     arch/x86/kernel/vmlinux.lds

---

I take this back.

After testing this, I noticed vmlinux was not correctly rebuilt.

Quoted 32 lines
 Makefile | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
Makefile +2 -6
index 244c07f1cc70..3e6974b4ebf2 100644
@@ -1118,7 +1118,8 @@ endif
 export KBUILD_VMLINUX_OBJS KBUILD_VMLINUX_LIBS
 export KBUILD_LDS          := arch/$(SRCARCH)/kernel/vmlinux.lds
 
-vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)
+# The actual objects are generated when descending.
+$(sort $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)): .
 
 # Recurse until adjust_autoksyms.sh is satisfied
 PHONY += autoksyms_recursive
@@ -1157,10 +1158,6 @@ vmlinux: scripts/link-vmlinux.sh vmlinux.o $(KBUILD_LDS) FORCE
 
 targets := vmlinux
 
-# The actual objects are generated when descending,
-# make sure no implicit rule kicks in
-$(sort $(vmlinux-deps)): . ;
-
 filechk_kernel.release = \
        echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
 
--

2.34.1

Signature · 2 lines
Best Regards
Masahiro Yamada