diff mbox series

[v3,4/7] kbuild: move vmlinux.o rule to the top Makefile

Message ID 20220924181915.3251186-5-masahiroy@kernel.org (mailing list archive)
State New, archived
Headers show
Series kbuild: various cleanups | expand

Commit Message

Masahiro Yamada Sept. 24, 2022, 6:19 p.m. UTC
Move the build rules of vmlinux.o out of scripts/link-vmlinux.sh to
clearly separate 1) pre-modpost, 2) modpost, 3) post-modpost stages.
This will make furture refactoring possible.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

(no changes since v1)

 Makefile                | 5 ++++-
 scripts/link-vmlinux.sh | 3 ---
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Nicolas Schier Sept. 28, 2022, 7:37 p.m. UTC | #1
On Sun, 25 Sep 2022 03:19:12 +0900 Masahiro Yamada wrote:
> Move the build rules of vmlinux.o out of scripts/link-vmlinux.sh to
> clearly separate 1) pre-modpost, 2) modpost, 3) post-modpost stages.
> This will make furture refactoring possible.

s/furture/future/

> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> 
> (no changes since v1)
> 
>  Makefile                | 5 ++++-
>  scripts/link-vmlinux.sh | 3 ---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 92413b6de451..b5dfb54b1993 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1142,6 +1142,9 @@ quiet_cmd_autoksyms_h = GEN     $@
>  $(autoksyms_h):
>  	$(call cmd,autoksyms_h)
>  
> +vmlinux.o: autoksyms_recursive $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) FORCE
> +	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vmlinux_o
> +
>  ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
>  
>  # Final link of vmlinux with optional arch pass after final link
> @@ -1149,7 +1152,7 @@ cmd_link-vmlinux =                                                 \
>  	$(CONFIG_SHELL) $< "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)";    \
>  	$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
>  
> -vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE
> +vmlinux: scripts/link-vmlinux.sh vmlinux.o $(KBUILD_LDS) FORCE
>  	+$(call if_changed_dep,link-vmlinux)
>  
>  targets := vmlinux
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index 161bca64e8aa..07486f90d5e2 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -214,9 +214,6 @@ if [ "$1" = "clean" ]; then
>  	exit 0
>  fi
>  
> -#link vmlinux.o
> -${MAKE} -f "${srctree}/scripts/Makefile.vmlinux_o"
> -
>  # modpost vmlinux.o to check for section mismatches
>  ${MAKE} -f "${srctree}/scripts/Makefile.modpost" MODPOST_VMLINUX=1
>  
> -- 
> 2.34.1

Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 92413b6de451..b5dfb54b1993 100644
--- a/Makefile
+++ b/Makefile
@@ -1142,6 +1142,9 @@  quiet_cmd_autoksyms_h = GEN     $@
 $(autoksyms_h):
 	$(call cmd,autoksyms_h)
 
+vmlinux.o: autoksyms_recursive $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) FORCE
+	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vmlinux_o
+
 ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
 
 # Final link of vmlinux with optional arch pass after final link
@@ -1149,7 +1152,7 @@  cmd_link-vmlinux =                                                 \
 	$(CONFIG_SHELL) $< "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)";    \
 	$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
 
-vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE
+vmlinux: scripts/link-vmlinux.sh vmlinux.o $(KBUILD_LDS) FORCE
 	+$(call if_changed_dep,link-vmlinux)
 
 targets := vmlinux
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index 161bca64e8aa..07486f90d5e2 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -214,9 +214,6 @@  if [ "$1" = "clean" ]; then
 	exit 0
 fi
 
-#link vmlinux.o
-${MAKE} -f "${srctree}/scripts/Makefile.vmlinux_o"
-
 # modpost vmlinux.o to check for section mismatches
 ${MAKE} -f "${srctree}/scripts/Makefile.modpost" MODPOST_VMLINUX=1