~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/scripts/Makefile.vmlinux_o

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 # SPDX-License-Identifier: GPL-2.0-only
  2 
  3 PHONY := __default
  4 __default: vmlinux.o modules.builtin.modinfo modules.builtin
  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 ordering of initcalls for Clang LTO
 13 # ---------------------------------------------------------------------------
 14 
 15 quiet_cmd_gen_initcalls_lds = GEN     $@
 16       cmd_gen_initcalls_lds = \
 17         $(PYTHON3) $(srctree)/scripts/jobserver-exec \
 18         $(PERL) $(real-prereqs) > $@
 19 
 20 .tmp_initcalls.lds: $(srctree)/scripts/generate_initcall_order.pl \
 21                 vmlinux.a $(KBUILD_VMLINUX_LIBS) FORCE
 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 individual translation units.
 34 # Run everything on vmlinux instead.
 35 
 36 objtool-enabled := $(or $(delay-objtool),$(CONFIG_NOINSTR_VALIDATION))
 37 
 38 vmlinux-objtool-args-$(delay-objtool)                   += $(objtool-args-y)
 39 vmlinux-objtool-args-$(CONFIG_GCOV_KERNEL)              += --no-unreachable
 40 vmlinux-objtool-args-$(CONFIG_NOINSTR_VALIDATION)       += --noinstr \
 41                                                            $(if $(or $(CONFIG_MITIGATION_UNRET_ENTRY),$(CONFIG_MITIGATION_SRSO)), --unret)
 42 
 43 objtool-args = $(vmlinux-objtool-args-y) --link
 44 
 45 # Link of vmlinux.o used for section mismatch analysis
 46 # ---------------------------------------------------------------------------
 47 
 48 quiet_cmd_ld_vmlinux.o = LD      $@
 49       cmd_ld_vmlinux.o = \
 50         $(LD) ${KBUILD_LDFLAGS} -r -o $@ \
 51         $(addprefix -T , $(initcalls-lds)) \
 52         --whole-archive vmlinux.a --no-whole-archive \
 53         --start-group $(KBUILD_VMLINUX_LIBS) --end-group \
 54         $(cmd_objtool)
 55 
 56 define rule_ld_vmlinux.o
 57         $(call cmd_and_savecmd,ld_vmlinux.o)
 58         $(call cmd,gen_objtooldep)
 59 endef
 60 
 61 vmlinux.o: $(initcalls-lds) vmlinux.a $(KBUILD_VMLINUX_LIBS) FORCE
 62         $(call if_changed_rule,ld_vmlinux.o)
 63 
 64 targets += vmlinux.o
 65 
 66 # module.builtin.modinfo
 67 # ---------------------------------------------------------------------------
 68 
 69 OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary
 70 
 71 targets += modules.builtin.modinfo
 72 modules.builtin.modinfo: vmlinux.o FORCE
 73         $(call if_changed,objcopy)
 74 
 75 # module.builtin
 76 # ---------------------------------------------------------------------------
 77 
 78 # The second line aids cases where multiple modules share the same object.
 79 
 80 quiet_cmd_modules_builtin = GEN     $@
 81       cmd_modules_builtin = \
 82         tr '\0' '\n' < $< | \
 83         sed -n 's/^[[:alnum:]:_]*\.file=//p' | \
 84         tr ' ' '\n' | uniq | sed -e 's:^:kernel/:' -e 's/$$/.ko/' > $@
 85 
 86 targets += modules.builtin
 87 modules.builtin: modules.builtin.modinfo FORCE
 88         $(call if_changed,modules_builtin)
 89 
 90 # Add FORCE to the prerequisites of a target to force it to be always rebuilt.
 91 # ---------------------------------------------------------------------------
 92 
 93 PHONY += FORCE
 94 FORCE:
 95 
 96 # Read all saved command lines and dependencies for the $(targets) we
 97 # may be building above, using $(if_changed{,_dep}). As an
 98 # optimization, we don't need to read them if the target does not
 99 # exist, we will rebuild anyway in that case.
100 
101 existing-targets := $(wildcard $(sort $(targets)))
102 
103 -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
104 
105 .PHONY: $(PHONY)

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php