forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kbuild: move vmlinux.o link to scripts/Makefile.vmlinux_o
This is a preparation for moving the objtool rule in the next commit. Signed-off-by: Masahiro Yamada <[email protected]> Tested-by: Sedat Dilek <[email protected]> # LLVM-14 (x86-64)
- Loading branch information
Showing
2 changed files
with
62 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
|
||
PHONY := __default | ||
__default: vmlinux.o | ||
|
||
include include/config/auto.conf | ||
include $(srctree)/scripts/Kbuild.include | ||
|
||
# Generate a linker script to ensure correct ordering of initcalls for Clang LTO | ||
# --------------------------------------------------------------------------- | ||
|
||
quiet_cmd_gen_initcalls_lds = GEN $@ | ||
cmd_gen_initcalls_lds = \ | ||
$(PYTHON3) $(srctree)/scripts/jobserver-exec \ | ||
$(PERL) $(real-prereqs) > $@ | ||
|
||
.tmp_initcalls.lds: $(srctree)/scripts/generate_initcall_order.pl \ | ||
$(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) FORCE | ||
$(call if_changed,gen_initcalls_lds) | ||
|
||
targets := .tmp_initcalls.lds | ||
|
||
ifdef CONFIG_LTO_CLANG | ||
initcalls-lds := .tmp_initcalls.lds | ||
endif | ||
|
||
# Link of vmlinux.o used for section mismatch analysis | ||
# --------------------------------------------------------------------------- | ||
|
||
quiet_cmd_ld_vmlinux.o = LD $@ | ||
cmd_ld_vmlinux.o = \ | ||
$(LD) ${KBUILD_LDFLAGS} -r -o $@ \ | ||
$(addprefix -T , $(initcalls-lds)) \ | ||
--whole-archive $(KBUILD_VMLINUX_OBJS) --no-whole-archive \ | ||
--start-group $(KBUILD_VMLINUX_LIBS) --end-group \ | ||
|
||
define rule_ld_vmlinux.o | ||
$(call cmd_and_savecmd,ld_vmlinux.o) | ||
endef | ||
|
||
vmlinux.o: $(initcalls-lds) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) FORCE | ||
$(call if_changed_rule,ld_vmlinux.o) | ||
|
||
targets += vmlinux.o | ||
|
||
# Add FORCE to the prequisites of a target to force it to be always rebuilt. | ||
# --------------------------------------------------------------------------- | ||
|
||
PHONY += FORCE | ||
FORCE: | ||
|
||
# Read all saved command lines and dependencies for the $(targets) we | ||
# may be building above, using $(if_changed{,_dep}). As an | ||
# optimization, we don't need to read them if the target does not | ||
# exist, we will rebuild anyway in that case. | ||
|
||
existing-targets := $(wildcard $(sort $(targets))) | ||
|
||
-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) | ||
|
||
.PHONY: $(PHONY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters