Something went wrong. Try again.
Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596# SPDX-License-Identifier: GPL-2.0-only
PHONY := __default__default: vmlinux.o
include include/config/auto.confinclude $(srctree)/scripts/Kbuild.include
# for objtoolinclude $(srctree)/scripts/Makefile.lib
# 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 \ vmlinux.a $(KBUILD_VMLINUX_LIBS) FORCE $(call if_changed,gen_initcalls_lds)
targets := .tmp_initcalls.lds
ifdef CONFIG_LTO_CLANGinitcalls-lds := .tmp_initcalls.ldsendif
# objtool for vmlinux.o# ---------------------------------------------------------------------------## For delay-objtool (IBT or LTO), objtool doesn't run on individual translation# units. Instead it runs on vmlinux.o.## For !delay-objtool + CONFIG_NOINSTR_VALIDATION, it runs on both translation# units and vmlinux.o, with the latter only used for noinstr/unret validation.
objtool-enabled := $(or $(delay-objtool),$(CONFIG_NOINSTR_VALIDATION))
ifeq ($(delay-objtool),y)vmlinux-objtool-args-y += $(objtool-args-y)elsevmlinux-objtool-args-$(CONFIG_OBJTOOL_WERROR) += --werrorendif
vmlinux-objtool-args-$(CONFIG_NOINSTR_VALIDATION) += --noinstr \ $(if $(or $(CONFIG_MITIGATION_UNRET_ENTRY),$(CONFIG_MITIGATION_SRSO)), --unret)
objtool-args = $(vmlinux-objtool-args-y) --link
# Link of vmlinux.o used for section mismatch analysis# ---------------------------------------------------------------------------
vmlinux-o-ld-args-$(CONFIG_BUILTIN_MODULE_RANGES) += -Map=$@.map
quiet_cmd_ld_vmlinux.o = LD $@ cmd_ld_vmlinux.o = \ $(LD) ${KBUILD_LDFLAGS} -r -o $@ \ $(vmlinux-o-ld-args-y) \ $(addprefix -T , $(initcalls-lds)) \ --whole-archive vmlinux.a --no-whole-archive \ --start-group $(KBUILD_VMLINUX_LIBS) --end-group \ $(cmd_objtool)
cmd_check_function_names = $(srctree)/scripts/check-function-names.sh $@
define rule_ld_vmlinux.o $(call cmd_and_savecmd,ld_vmlinux.o) $(call cmd,gen_objtooldep) $(call cmd,check_function_names)endef
vmlinux.o: $(initcalls-lds) vmlinux.a $(KBUILD_VMLINUX_LIBS) FORCE $(call if_changed_rule,ld_vmlinux.o)
targets += vmlinux.o
# Add FORCE to the prerequisites of a target to force it to be always rebuilt.# ---------------------------------------------------------------------------
PHONY += FORCEFORCE:
# 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)