Skip to content

Commit 9c5a0ac

Browse files
committed
kbuild: move vmlinux.o rule to the top Makefile
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 further refactoring possible. Signed-off-by: Masahiro Yamada <[email protected]> Tested-by: Nick Desaulniers <[email protected]> Reviewed-by: Nicolas Schier <[email protected]>
1 parent 26ef40d commit 9c5a0ac

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,8 +1118,6 @@ endif
11181118
export KBUILD_VMLINUX_OBJS KBUILD_VMLINUX_LIBS
11191119
export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
11201120

1121-
vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)
1122-
11231121
# Recurse until adjust_autoksyms.sh is satisfied
11241122
PHONY += autoksyms_recursive
11251123
ifdef CONFIG_TRIM_UNUSED_KSYMS
@@ -1142,21 +1140,24 @@ quiet_cmd_autoksyms_h = GEN $@
11421140
$(autoksyms_h):
11431141
$(call cmd,autoksyms_h)
11441142

1143+
vmlinux.o: autoksyms_recursive $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) FORCE
1144+
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vmlinux_o
1145+
11451146
ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
11461147

11471148
# Final link of vmlinux with optional arch pass after final link
11481149
cmd_link-vmlinux = \
11491150
$(CONFIG_SHELL) $< "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)"; \
11501151
$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
11511152

1152-
vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE
1153+
vmlinux: scripts/link-vmlinux.sh vmlinux.o $(KBUILD_LDS) FORCE
11531154
+$(call if_changed_dep,link-vmlinux)
11541155

11551156
targets := vmlinux
11561157

11571158
# The actual objects are generated when descending,
11581159
# make sure no implicit rule kicks in
1159-
$(sort $(vmlinux-deps)): . ;
1160+
$(sort $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)): . ;
11601161

11611162
filechk_kernel.release = \
11621163
echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"

scripts/link-vmlinux.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,6 @@ if [ "$1" = "clean" ]; then
214214
exit 0
215215
fi
216216

217-
#link vmlinux.o
218-
${MAKE} -f "${srctree}/scripts/Makefile.vmlinux_o"
219-
220217
# modpost vmlinux.o to check for section mismatches
221218
${MAKE} -f "${srctree}/scripts/Makefile.modpost" MODPOST_VMLINUX=1
222219

0 commit comments

Comments
 (0)