1 # SPDX-License-Identifier: GPL-2.0-only 2 3 PHONY := __default 4 __default: vmlinux.o modules.builtin.modinfo m 5 6 include include/config/auto.conf 7 include $(srctree)/scripts/Kbuild.include 8 9 # for objtool 10 include $(srctree)/scripts/Makefile.lib 11 12 # Generate a linker script to ensure correct o 13 # -------------------------------------------- 14 15 quiet_cmd_gen_initcalls_lds = GEN $@ 16 cmd_gen_initcalls_lds = \ 17 $(PYTHON3) $(srctree)/scripts/jobserve 18 $(PERL) $(real-prereqs) > $@ 19 20 .tmp_initcalls.lds: $(srctree)/scripts/generat 21 vmlinux.a $(KBUILD_VMLINUX_LIB 22 $(call if_changed,gen_initcalls_lds) 23 24 targets := .tmp_initcalls.lds 25 26 ifdef CONFIG_LTO_CLANG 27 initcalls-lds := .tmp_initcalls.lds 28 endif 29 30 # objtool for vmlinux.o 31 # -------------------------------------------- 32 # 33 # For LTO and IBT, objtool doesn't run on indi 34 # Run everything on vmlinux instead. 35 36 objtool-enabled := $(or $(delay-objtool),$(CON 37 38 vmlinux-objtool-args-$(delay-objtool) 39 vmlinux-objtool-args-$(CONFIG_GCOV_KERNEL) 40 vmlinux-objtool-args-$(CONFIG_NOINSTR_VALIDATI 41 42 43 objtool-args = $(vmlinux-objtool-args-y) --lin 44 45 # Link of vmlinux.o used for section mismatch 46 # -------------------------------------------- 47 48 vmlinux-o-ld-args-$(CONFIG_BUILTIN_MODULE_RANG 49 50 quiet_cmd_ld_vmlinux.o = LD $@ 51 cmd_ld_vmlinux.o = \ 52 $(LD) ${KBUILD_LDFLAGS} -r -o $@ \ 53 $(vmlinux-o-ld-args-y) \ 54 $(addprefix -T , $(initcalls-lds)) \ 55 --whole-archive vmlinux.a --no-whole-a 56 --start-group $(KBUILD_VMLINUX_LIBS) - 57 $(cmd_objtool) 58 59 define rule_ld_vmlinux.o 60 $(call cmd_and_savecmd,ld_vmlinux.o) 61 $(call cmd,gen_objtooldep) 62 endef 63 64 vmlinux.o: $(initcalls-lds) vmlinux.a $(KBUILD 65 $(call if_changed_rule,ld_vmlinux.o) 66 67 targets += vmlinux.o 68 69 # module.builtin.modinfo 70 # -------------------------------------------- 71 72 OBJCOPYFLAGS_modules.builtin.modinfo := -j .mo 73 74 targets += modules.builtin.modinfo 75 modules.builtin.modinfo: vmlinux.o FORCE 76 $(call if_changed,objcopy) 77 78 # module.builtin 79 # -------------------------------------------- 80 81 # The second line aids cases where multiple mo 82 83 quiet_cmd_modules_builtin = GEN $@ 84 cmd_modules_builtin = \ 85 tr '\0' '\n' < $< | \ 86 sed -n 's/^[[:alnum:]:_]*\.file=//p' | 87 tr ' ' '\n' | uniq | sed -e 's:^:kerne 88 89 targets += modules.builtin 90 modules.builtin: modules.builtin.modinfo FORCE 91 $(call if_changed,modules_builtin) 92 93 # Add FORCE to the prerequisites of a target t 94 # -------------------------------------------- 95 96 PHONY += FORCE 97 FORCE: 98 99 # Read all saved command lines and dependencie 100 # may be building above, using $(if_changed{,_ 101 # optimization, we don't need to read them if 102 # exist, we will rebuild anyway in that case. 103 104 existing-targets := $(wildcard $(sort $(target 105 106 -include $(foreach f,$(existing-targets),$(dir 107 108 .PHONY: $(PHONY)
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.