Changes in 5.4.24 io_uring: grab ->fs as part of async offload EDAC: skx_common: downgrade message importance on missing PCI device net: dsa: b53: Ensure the default VID is untagged net: fib_rules: Correctly set table field when table number exceeds 8 bits net: macb: ensure interface is not suspended on at91rm9200 net: mscc: fix in frame extraction net: phy: restore mdio regs in the iproc mdio driver net: sched: correct flower port blocking net/tls: Fix to avoid gettig invalid tls record nfc: pn544: Fix occasional HW initialization failure qede: Fix race between rdma destroy workqueue and link change event Revert "net: dev: introduce support for sch BYPASS for lockless qdisc" udp: rehash on disconnect sctp: move the format error check out of __sctp_sf_do_9_1_abort bnxt_en: Improve device shutdown method. bnxt_en: Issue PCIe FLR in kdump kernel to cleanup pending DMAs. bonding: add missing netdev_update_lockdep_key() net: export netdev_next_lower_dev_rcu() bonding: fix lockdep warning in bond_get_stats() ipv6: Fix route replacement with dev-only route ipv6: Fix nlmsg_flags when splitting a multipath route ipmi:ssif: Handle a possible NULL pointer reference drm/msm: Set dma maximum segment size for mdss sched/core: Don't skip remote tick for idle CPUs timers/nohz: Update NOHZ load in remote tick sched/fair: Prevent unlimited runtime on throttled group dax: pass NOWAIT flag to iomap_apply mac80211: consider more elements in parsing CRC cfg80211: check wiphy driver existence for drvinfo report s390/zcrypt: fix card and queue total counter wrap qmi_wwan: re-add DW5821e pre-production variant qmi_wwan: unconditionally reject 2 ep interfaces NFSv4: Fix races between open and dentry revalidation perf/smmuv3: Use platform_get_irq_optional() for wired interrupt perf/x86/intel: Add Elkhart Lake support perf/x86/cstate: Add Tremont support perf/x86/msr: Add Tremont support ceph: do not execute direct write in parallel if O_APPEND is specified ARM: dts: sti: fixup sound frame-inversion for stihxxx-b2120.dtsi drm/amd/display: Do not set optimized_require to false after plane disable RDMA/siw: Remove unwanted WARN_ON in siw_cm_llp_data_ready() drm/amd/display: Check engine is not NULL before acquiring drm/amd/display: Limit minimum DPPCLK to 100MHz. drm/amd/display: Add initialitions for PLL2 clock source amdgpu: Prevent build errors regarding soft/hard-float FP ABI tags soc/tegra: fuse: Fix build with Tegra194 configuration i40e: Fix the conditional for i40e_vc_validate_vqs_bitmaps net: ena: fix potential crash when rxfh key is NULL net: ena: fix uses of round_jiffies() net: ena: add missing ethtool TX timestamping indication net: ena: fix incorrect default RSS key net: ena: rss: do not allocate key when not supported net: ena: rss: fix failure to get indirection table net: ena: rss: store hash function as values and not bits net: ena: fix incorrectly saving queue numbers when setting RSS indirection table net: ena: fix corruption of dev_idx_to_host_tbl net: ena: ethtool: use correct value for crc32 hash net: ena: ena-com.c: prevent NULL pointer dereference ice: update Unit Load Status bitmask to check after reset cifs: Fix mode output in debugging statements cfg80211: add missing policy for NL80211_ATTR_STATUS_CODE mac80211: fix wrong 160/80+80 MHz setting net: hns3: add management table after IMP reset net: hns3: fix a copying IPv6 address error in hclge_fd_get_flow_tuples() nvme/tcp: fix bug on double requeue when send fails nvme: prevent warning triggered by nvme_stop_keep_alive nvme/pci: move cqe check after device shutdown ext4: potential crash on allocation error in ext4_alloc_flex_bg_array() audit: fix error handling in audit_data_to_entry() audit: always check the netlink payload length in audit_receive_msg() ACPICA: Introduce ACPI_ACCESS_BYTE_WIDTH() macro ACPI: watchdog: Fix gas->access_width usage KVM: VMX: check descriptor table exits on instruction emulation HID: ite: Only bind to keyboard USB interface on Acer SW5-012 keyboard dock HID: core: fix off-by-one memset in hid_report_raw_event() HID: core: increase HID report buffer size to 8KiB drm/amdgpu: Drop DRIVER_USE_AGP drm/radeon: Inline drm_get_pci_dev macintosh: therm_windtunnel: fix regression when instantiating devices tracing: Disable trace_printk() on post poned tests Revert "PM / devfreq: Modify the device name as devfreq(X) for sysfs" amdgpu/gmc_v9: save/restore sdpif regs during S3 cpufreq: Fix policy initialization for internal governor drivers io_uring: fix 32-bit compatability with sendmsg/recvmsg netfilter: ipset: Fix "INFO: rcu detected stall in hash_xxx" reports net/smc: transfer fasync_list in case of fallback vhost: Check docket sk_family instead of call getname netfilter: ipset: Fix forceadd evaluation path netfilter: xt_hashlimit: reduce hashlimit_mutex scope for htable_put() HID: alps: Fix an error handling path in 'alps_input_configured()' HID: hiddev: Fix race in in hiddev_disconnect() MIPS: VPE: Fix a double free and a memory leak in 'release_vpe()' i2c: altera: Fix potential integer overflow i2c: jz4780: silence log flood on txabrt drm/i915/gvt: Fix orphan vgpu dmabuf_objs' lifetime drm/i915/gvt: Separate display reset from ALL_ENGINES reset nl80211: fix potential leak in AP start mac80211: Remove a redundant mutex unlock kbuild: fix DT binding schema rule to detect command line changes hv_netvsc: Fix unwanted wakeup in netvsc_attach() usb: charger: assign specific number for enum value nvme-pci: Hold cq_poll_lock while completing CQEs s390/qeth: vnicc Fix EOPNOTSUPP precedence net: netlink: cap max groups which will be considered in netlink_bind() net: atlantic: fix use after free kasan warn net: atlantic: fix potential error handling net: atlantic: fix out of range usage of active_vlans array net/smc: no peer ID in CLC decline for SMCD net: ena: make ena rxfh support ETH_RSS_HASH_NO_CHANGE selftests: Install settings files to fix TIMEOUT failures kbuild: remove header compile test kbuild: move headers_check rule to usr/include/Makefile kbuild: remove unneeded variable, single-all kbuild: make single target builds even faster namei: only return -ECHILD from follow_dotdot_rcu() mwifiex: drop most magic numbers from mwifiex_process_tdls_action_frame() mwifiex: delete unused mwifiex_get_intf_num() KVM: SVM: Override default MMIO mask if memory encryption is enabled KVM: Check for a bad hva before dropping into the ghc slow path sched/fair: Optimize select_idle_cpu f2fs: fix to add swap extent correctly RDMA/hns: Simplify the calculation and usage of wqe idx for post verbs RDMA/hns: Bugfix for posting a wqe with sge drivers: net: xgene: Fix the order of the arguments of 'alloc_etherdev_mqs()' ima: ima/lsm policy rule loading logic bug fixes kprobes: Set unoptimized flag after unoptimizing code lib/vdso: Make __arch_update_vdso_data() logic understandable lib/vdso: Update coarse timekeeper unconditionally pwm: omap-dmtimer: put_device() after of_find_device_by_node() perf hists browser: Restore ESC as "Zoom out" of DSO/thread/etc perf ui gtk: Add missing zalloc object x86/resctrl: Check monitoring static key in the MBM overflow handler KVM: x86: Remove spurious kvm_mmu_unload() from vcpu destruction path KVM: x86: Remove spurious clearing of async #PF MSR rcu: Allow only one expedited GP to run concurrently with wakeups ubifs: Fix ino_t format warnings in orphan_delete() thermal: db8500: Depromote debug print thermal: brcmstb_thermal: Do not use DT coefficients netfilter: nft_tunnel: no need to call htons() when dumping ports netfilter: nf_flowtable: fix documentation bus: tegra-aconnect: Remove PM_CLK dependency xfs: clear kernel only flags in XFS_IOC_ATTRMULTI_BY_HANDLE locking/lockdep: Fix lockdep_stats indentation problem mm/debug.c: always print flags in dump_page() mm/gup: allow FOLL_FORCE for get_user_pages_fast() mm/huge_memory.c: use head to check huge zero page mm, thp: fix defrag setting if newline is not used kvm: nVMX: VMWRITE checks VMCS-link pointer before VMCS field kvm: nVMX: VMWRITE checks unsupported field before read-only field blktrace: Protect q->blk_trace with RCU Linux 5.4.24 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I0b31557e16c72bd30d1e6938ed199918ff326d88
589 lines
19 KiB
Makefile
589 lines
19 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
# ==========================================================================
|
|
# Building
|
|
# ==========================================================================
|
|
|
|
src := $(obj)
|
|
|
|
PHONY := __build
|
|
__build:
|
|
|
|
# Init all relevant variables used in kbuild files so
|
|
# 1) they have correct type
|
|
# 2) they do not inherit any value from the environment
|
|
obj-y :=
|
|
obj-m :=
|
|
lib-y :=
|
|
lib-m :=
|
|
always :=
|
|
targets :=
|
|
subdir-y :=
|
|
subdir-m :=
|
|
EXTRA_AFLAGS :=
|
|
EXTRA_CFLAGS :=
|
|
EXTRA_CPPFLAGS :=
|
|
EXTRA_LDFLAGS :=
|
|
asflags-y :=
|
|
ccflags-y :=
|
|
cppflags-y :=
|
|
ldflags-y :=
|
|
|
|
subdir-asflags-y :=
|
|
subdir-ccflags-y :=
|
|
|
|
# Read auto.conf if it exists, otherwise ignore
|
|
-include include/config/auto.conf
|
|
|
|
include scripts/Kbuild.include
|
|
|
|
# The filename Kbuild has precedence over Makefile
|
|
kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
|
|
kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
|
|
include $(kbuild-file)
|
|
|
|
include scripts/Makefile.lib
|
|
|
|
# Do not include host rules unless needed
|
|
ifneq ($(hostprogs-y)$(hostprogs-m)$(hostlibs-y)$(hostlibs-m)$(hostcxxlibs-y)$(hostcxxlibs-m),)
|
|
include scripts/Makefile.host
|
|
endif
|
|
|
|
ifndef obj
|
|
$(warning kbuild: Makefile.build is included improperly)
|
|
endif
|
|
|
|
ifeq ($(need-modorder),)
|
|
ifneq ($(obj-m),)
|
|
$(warning $(patsubst %.o,'%.ko',$(obj-m)) will not be built even though obj-m is specified.)
|
|
$(warning You cannot use subdir-y/m to visit a module Makefile. Use obj-y/m instead.)
|
|
endif
|
|
endif
|
|
|
|
# ===========================================================================
|
|
|
|
ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),)
|
|
lib-target := $(obj)/lib.a
|
|
real-obj-y += $(obj)/lib-ksyms.o
|
|
endif
|
|
|
|
ifneq ($(strip $(real-obj-y) $(need-builtin)),)
|
|
builtin-target := $(obj)/built-in.a
|
|
endif
|
|
|
|
ifeq ($(CONFIG_MODULES)$(need-modorder),y1)
|
|
modorder-target := $(obj)/modules.order
|
|
endif
|
|
|
|
mod-targets := $(patsubst %.o, %.mod, $(obj-m))
|
|
|
|
# Linus' kernel sanity checking tool
|
|
ifeq ($(KBUILD_CHECKSRC),1)
|
|
quiet_cmd_checksrc = CHECK $<
|
|
cmd_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $<
|
|
else ifeq ($(KBUILD_CHECKSRC),2)
|
|
quiet_cmd_force_checksrc = CHECK $<
|
|
cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $<
|
|
endif
|
|
|
|
ifneq ($(KBUILD_EXTRA_WARN),)
|
|
cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $<
|
|
endif
|
|
|
|
# Compile C sources (.c)
|
|
# ---------------------------------------------------------------------------
|
|
|
|
quiet_cmd_cc_s_c = CC $(quiet_modtag) $@
|
|
cmd_cc_s_c = $(CC) $(filter-out $(DEBUG_CFLAGS) $(CC_FLAGS_LTO), $(c_flags)) $(DISABLE_LTO) -fverbose-asm -S -o $@ $<
|
|
|
|
$(obj)/%.s: $(src)/%.c FORCE
|
|
$(call if_changed_dep,cc_s_c)
|
|
|
|
quiet_cmd_cpp_i_c = CPP $(quiet_modtag) $@
|
|
cmd_cpp_i_c = $(CPP) $(c_flags) -o $@ $<
|
|
|
|
$(obj)/%.i: $(src)/%.c FORCE
|
|
$(call if_changed_dep,cpp_i_c)
|
|
|
|
# These mirror gensymtypes_S and co below, keep them in synch.
|
|
cmd_gensymtypes_c = \
|
|
$(CPP) -D__GENKSYMS__ $(c_flags) $< | \
|
|
scripts/genksyms/genksyms $(if $(1), -T $(2)) \
|
|
$(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \
|
|
$(if $(KBUILD_PRESERVE),-p) \
|
|
-r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
|
|
|
|
quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@
|
|
cmd_cc_symtypes_c = \
|
|
$(call cmd_gensymtypes_c,true,$@) >/dev/null; \
|
|
test -s $@ || rm -f $@
|
|
|
|
$(obj)/%.symtypes : $(src)/%.c FORCE
|
|
$(call cmd,cc_symtypes_c)
|
|
|
|
# LLVM assembly
|
|
# Generate .ll files from .c
|
|
quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@
|
|
cmd_cc_ll_c = $(CC) $(c_flags) -emit-llvm -S -o $@ $<
|
|
|
|
$(obj)/%.ll: $(src)/%.c FORCE
|
|
$(call if_changed_dep,cc_ll_c)
|
|
|
|
# C (.c) files
|
|
# The C file is compiled and updated dependency information is generated.
|
|
# (See cmd_cc_o_c + relevant part of rule_cc_o_c)
|
|
|
|
quiet_cmd_cc_o_c = CC $(quiet_modtag) $@
|
|
cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
|
|
|
|
ifdef CONFIG_MODVERSIONS
|
|
# When module versioning is enabled the following steps are executed:
|
|
# o compile a <file>.o from <file>.c
|
|
# o if <file>.o doesn't contain a __ksymtab version, i.e. does
|
|
# not export symbols, it's done.
|
|
# o otherwise, we calculate symbol versions using the good old
|
|
# genksyms on the preprocessed source and postprocess them in a way
|
|
# that they are usable as a linker script
|
|
# o generate .tmp_<file>.o from <file>.o using the linker to
|
|
# replace the unresolved symbols __crc_exported_symbol with
|
|
# the actual value of the checksum generated by genksyms
|
|
# o remove .tmp_<file>.o to <file>.o
|
|
|
|
ifdef CONFIG_LTO_CLANG
|
|
# Generate .o.symversions files for each .o with exported symbols, and link these
|
|
# to the kernel and/or modules at the end.
|
|
cmd_modversions_c = \
|
|
if $(LLVM_NM) $@ | grep -q __ksymtab; then \
|
|
$(call cmd_gensymtypes_c,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \
|
|
> $@.symversions; \
|
|
fi;
|
|
else
|
|
cmd_modversions_c = \
|
|
if $(OBJDUMP) -h $@ | grep -q __ksymtab; then \
|
|
$(call cmd_gensymtypes_c,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \
|
|
> $(@D)/.tmp_$(@F:.o=.ver); \
|
|
\
|
|
$(LD) $(KBUILD_LDFLAGS) -r -o $(@D)/.tmp_$(@F) $@ \
|
|
-T $(@D)/.tmp_$(@F:.o=.ver); \
|
|
mv -f $(@D)/.tmp_$(@F) $@; \
|
|
rm -f $(@D)/.tmp_$(@F:.o=.ver); \
|
|
fi
|
|
endif
|
|
endif
|
|
|
|
ifdef CONFIG_FTRACE_MCOUNT_RECORD
|
|
ifndef CC_USING_RECORD_MCOUNT
|
|
# compiler will not generate __mcount_loc use recordmcount or recordmcount.pl
|
|
ifdef BUILD_C_RECORDMCOUNT
|
|
ifeq ("$(origin RECORDMCOUNT_WARN)", "command line")
|
|
RECORDMCOUNT_FLAGS = -w
|
|
endif
|
|
|
|
ifdef CONFIG_LTO_CLANG
|
|
# With LTO, we postpone running recordmcount until after the LTO link step, so
|
|
# let's export the parameters for the link script.
|
|
export RECORDMCOUNT_FLAGS
|
|
else
|
|
# Due to recursion, we must skip empty.o.
|
|
# The empty.o file is created in the make process in order to determine
|
|
# the target endianness and word size. It is made before all other C
|
|
# files, including recordmcount.
|
|
sub_cmd_record_mcount = \
|
|
if [ $(@) != "scripts/mod/empty.o" ]; then \
|
|
$(objtree)/scripts/recordmcount $(RECORDMCOUNT_FLAGS) "$(@)"; \
|
|
fi;
|
|
endif
|
|
|
|
recordmcount_source := $(srctree)/scripts/recordmcount.c \
|
|
$(srctree)/scripts/recordmcount.h
|
|
else
|
|
sub_cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
|
|
"$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
|
|
"$(if $(CONFIG_64BIT),64,32)" \
|
|
"$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS)" \
|
|
"$(LD) $(KBUILD_LDFLAGS)" "$(NM)" "$(RM)" "$(MV)" \
|
|
"$(if $(part-of-module),1,0)" "$(@)";
|
|
|
|
recordmcount_source := $(srctree)/scripts/recordmcount.pl
|
|
endif # BUILD_C_RECORDMCOUNT
|
|
ifndef CONFIG_LTO_CLANG
|
|
cmd_record_mcount = $(if $(findstring $(strip $(CC_FLAGS_FTRACE)),$(_c_flags)), \
|
|
$(sub_cmd_record_mcount))
|
|
endif # CONFIG_LTO_CLANG
|
|
endif # CC_USING_RECORD_MCOUNT
|
|
endif # CONFIG_FTRACE_MCOUNT_RECORD
|
|
|
|
ifdef CONFIG_STACK_VALIDATION
|
|
ifneq ($(SKIP_STACK_VALIDATION),1)
|
|
|
|
__objtool_obj := $(objtree)/tools/objtool/objtool
|
|
|
|
objtool_args = $(if $(CONFIG_UNWINDER_ORC),orc generate,check)
|
|
|
|
objtool_args += $(if $(part-of-module), --module,)
|
|
|
|
ifndef CONFIG_FRAME_POINTER
|
|
objtool_args += --no-fp
|
|
endif
|
|
ifdef CONFIG_GCOV_KERNEL
|
|
objtool_args += --no-unreachable
|
|
endif
|
|
ifdef CONFIG_RETPOLINE
|
|
objtool_args += --retpoline
|
|
endif
|
|
ifdef CONFIG_X86_SMAP
|
|
objtool_args += --uaccess
|
|
endif
|
|
|
|
# 'OBJECT_FILES_NON_STANDARD := y': skip objtool checking for a directory
|
|
# 'OBJECT_FILES_NON_STANDARD_foo.o := 'y': skip objtool checking for a file
|
|
# 'OBJECT_FILES_NON_STANDARD_foo.o := 'n': override directory skip for a file
|
|
cmd_objtool = $(if $(patsubst y%,, \
|
|
$(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n), \
|
|
$(__objtool_obj) $(objtool_args) $@)
|
|
objtool_obj = $(if $(patsubst y%,, \
|
|
$(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n), \
|
|
$(__objtool_obj))
|
|
|
|
endif # SKIP_STACK_VALIDATION
|
|
endif # CONFIG_STACK_VALIDATION
|
|
|
|
# Rebuild all objects when objtool changes, or is enabled/disabled.
|
|
objtool_dep = $(objtool_obj) \
|
|
$(wildcard include/config/orc/unwinder.h \
|
|
include/config/stack/validation.h)
|
|
|
|
ifdef CONFIG_TRIM_UNUSED_KSYMS
|
|
cmd_gen_ksymdeps = \
|
|
$(CONFIG_SHELL) $(srctree)/scripts/gen_ksymdeps.sh $@ >> $(dot-target).cmd
|
|
endif
|
|
|
|
define rule_cc_o_c
|
|
$(call cmd,checksrc)
|
|
$(call cmd_and_fixdep,cc_o_c)
|
|
$(call cmd,gen_ksymdeps)
|
|
$(call cmd,checkdoc)
|
|
$(call cmd,objtool)
|
|
$(call cmd,modversions_c)
|
|
$(call cmd,record_mcount)
|
|
endef
|
|
|
|
define rule_as_o_S
|
|
$(call cmd_and_fixdep,as_o_S)
|
|
$(call cmd,gen_ksymdeps)
|
|
$(call cmd,objtool)
|
|
$(call cmd,modversions_S)
|
|
endef
|
|
|
|
# List module undefined symbols (or empty line if not enabled)
|
|
ifdef CONFIG_TRIM_UNUSED_KSYMS
|
|
cmd_undef_syms = $(NM) $< | sed -n 's/^ *U //p' | xargs echo
|
|
else
|
|
cmd_undef_syms = echo
|
|
endif
|
|
|
|
# Built-in and composite module parts
|
|
$(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE
|
|
$(call cmd,force_checksrc)
|
|
$(call if_changed_rule,cc_o_c)
|
|
|
|
cmd_mod = { \
|
|
echo $(if $($*-objs)$($*-y)$($*-m), $(addprefix $(obj)/, $($*-objs) $($*-y) $($*-m)), $(@:.mod=.o)); \
|
|
$(cmd_undef_syms); \
|
|
} > $@
|
|
|
|
$(obj)/%.mod: $(obj)/%.o FORCE
|
|
$(call if_changed,mod)
|
|
|
|
targets += $(mod-targets)
|
|
|
|
quiet_cmd_cc_lst_c = MKLST $@
|
|
cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \
|
|
$(CONFIG_SHELL) $(srctree)/scripts/makelst $*.o \
|
|
System.map $(OBJDUMP) > $@
|
|
|
|
$(obj)/%.lst: $(src)/%.c FORCE
|
|
$(call if_changed_dep,cc_lst_c)
|
|
|
|
# Compile assembler sources (.S)
|
|
# ---------------------------------------------------------------------------
|
|
|
|
# .S file exports must have their C prototypes defined in asm/asm-prototypes.h
|
|
# or a file that it includes, in order to get versioned symbols. We build a
|
|
# dummy C file that includes asm-prototypes and the EXPORT_SYMBOL lines from
|
|
# the .S file (with trailing ';'), and run genksyms on that, to extract vers.
|
|
#
|
|
# This is convoluted. The .S file must first be preprocessed to run guards and
|
|
# expand names, then the resulting exports must be constructed into plain
|
|
# EXPORT_SYMBOL(symbol); to build our dummy C file, and that gets preprocessed
|
|
# to make the genksyms input.
|
|
#
|
|
# These mirror gensymtypes_c and co above, keep them in synch.
|
|
cmd_gensymtypes_S = \
|
|
{ echo "\#include <linux/kernel.h>" ; \
|
|
echo "\#include <asm/asm-prototypes.h>" ; \
|
|
$(CPP) $(a_flags) $< | \
|
|
grep "\<___EXPORT_SYMBOL\>" | \
|
|
sed 's/.*___EXPORT_SYMBOL[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*,.*/EXPORT_SYMBOL(\1);/' ; } | \
|
|
$(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \
|
|
scripts/genksyms/genksyms $(if $(1), -T $(2)) \
|
|
$(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \
|
|
$(if $(KBUILD_PRESERVE),-p) \
|
|
-r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
|
|
|
|
quiet_cmd_cc_symtypes_S = SYM $(quiet_modtag) $@
|
|
cmd_cc_symtypes_S = \
|
|
$(call cmd_gensymtypes_S,true,$@) >/dev/null; \
|
|
test -s $@ || rm -f $@
|
|
|
|
$(obj)/%.symtypes : $(src)/%.S FORCE
|
|
$(call cmd,cc_symtypes_S)
|
|
|
|
|
|
quiet_cmd_cpp_s_S = CPP $(quiet_modtag) $@
|
|
cmd_cpp_s_S = $(CPP) $(a_flags) -o $@ $<
|
|
|
|
$(obj)/%.s: $(src)/%.S FORCE
|
|
$(call if_changed_dep,cpp_s_S)
|
|
|
|
quiet_cmd_as_o_S = AS $(quiet_modtag) $@
|
|
cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
|
|
|
|
ifdef CONFIG_ASM_MODVERSIONS
|
|
|
|
# versioning matches the C process described above, with difference that
|
|
# we parse asm-prototypes.h C header to get function definitions.
|
|
|
|
cmd_modversions_S = \
|
|
if $(OBJDUMP) -h $@ | grep -q __ksymtab; then \
|
|
$(call cmd_gensymtypes_S,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \
|
|
> $(@D)/.tmp_$(@F:.o=.ver); \
|
|
\
|
|
$(LD) $(KBUILD_LDFLAGS) -r -o $(@D)/.tmp_$(@F) $@ \
|
|
-T $(@D)/.tmp_$(@F:.o=.ver); \
|
|
mv -f $(@D)/.tmp_$(@F) $@; \
|
|
rm -f $(@D)/.tmp_$(@F:.o=.ver); \
|
|
fi
|
|
endif
|
|
|
|
$(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE
|
|
$(call if_changed_rule,as_o_S)
|
|
|
|
targets += $(filter-out $(subdir-obj-y), $(real-obj-y)) $(real-obj-m) $(lib-y)
|
|
targets += $(extra-y) $(MAKECMDGOALS) $(always)
|
|
|
|
# Linker scripts preprocessor (.lds.S -> .lds)
|
|
# ---------------------------------------------------------------------------
|
|
quiet_cmd_cpp_lds_S = LDS $@
|
|
cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -U$(ARCH) \
|
|
-D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $<
|
|
|
|
$(obj)/%.lds: $(src)/%.lds.S FORCE
|
|
$(call if_changed_dep,cpp_lds_S)
|
|
|
|
# ASN.1 grammar
|
|
# ---------------------------------------------------------------------------
|
|
quiet_cmd_asn1_compiler = ASN.1 $(basename $@).[ch]
|
|
cmd_asn1_compiler = $(objtree)/scripts/asn1_compiler $< \
|
|
$(basename $@).c $(basename $@).h
|
|
|
|
$(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler
|
|
$(call cmd,asn1_compiler)
|
|
|
|
# Build the compiled-in targets
|
|
# ---------------------------------------------------------------------------
|
|
|
|
# To build objects in subdirs, we need to descend into the directories
|
|
$(sort $(subdir-obj-y)): $(subdir-ym) ;
|
|
|
|
# combine symversions for later processing
|
|
quiet_cmd_update_lto_symversions = SYMVER $@
|
|
ifeq ($(CONFIG_LTO_CLANG) $(CONFIG_MODVERSIONS),y y)
|
|
cmd_update_lto_symversions = \
|
|
rm -f $@.symversions; \
|
|
for i in $(foreach n, \
|
|
$(filter-out FORCE,$^), \
|
|
$(if $(wildcard $(n).symversions),$(n))); do \
|
|
cat $$i.symversions >> $@.symversions; \
|
|
done
|
|
else
|
|
cmd_update_lto_symversions = echo >/dev/null
|
|
endif
|
|
|
|
#
|
|
# Rule to compile a set of .o files into one .a file (without symbol table)
|
|
#
|
|
ifdef builtin-target
|
|
|
|
quiet_cmd_ar_builtin = AR $@
|
|
cmd_ar_builtin = rm -f $@; $(AR) cDPrST $@ $(real-prereqs)
|
|
|
|
quiet_cmd_ar_and_symver = AR $@
|
|
cmd_ar_and_symver = $(cmd_update_lto_symversions); $(cmd_ar_builtin)
|
|
|
|
$(builtin-target): $(real-obj-y) FORCE
|
|
$(call if_changed,ar_and_symver)
|
|
|
|
targets += $(builtin-target)
|
|
endif # builtin-target
|
|
|
|
#
|
|
# Rule to create modules.order file
|
|
#
|
|
# Create commands to either record .ko file or cat modules.order from
|
|
# a subdirectory
|
|
$(modorder-target): $(subdir-ym) FORCE
|
|
$(Q){ $(foreach m, $(modorder), \
|
|
$(if $(filter %/modules.order, $m), cat $m, echo $m);) :; } \
|
|
| $(AWK) '!x[$$0]++' - > $@
|
|
|
|
#
|
|
# Rule to compile a set of .o files into one .a file (with symbol table)
|
|
#
|
|
ifdef lib-target
|
|
|
|
quiet_cmd_ar_lib = AR $@
|
|
cmd_ar_lib = $(cmd_update_lto_symversions); $(cmd_ar)
|
|
|
|
$(lib-target): $(lib-y) FORCE
|
|
$(call if_changed,ar_lib)
|
|
|
|
targets += $(lib-target)
|
|
|
|
dummy-object = $(obj)/.lib_exports.o
|
|
ksyms-lds = $(dot-target).lds
|
|
|
|
ifdef CONFIG_LTO_CLANG
|
|
# Objdump doesn't understand LLVM IR. Use llvm-nm to dump symbols.
|
|
dump_export_list = $(LLVM_NM)
|
|
else
|
|
dump_export_list = $(OBJDUMP) -h
|
|
endif
|
|
|
|
quiet_cmd_export_list = EXPORTS $@
|
|
cmd_export_list = $(dump_export_list) $< | \
|
|
sed -ne '/___ksymtab/s/.*+\([^ ]*\).*/EXTERN(\1)/p' >$(ksyms-lds);\
|
|
rm -f $(dummy-object);\
|
|
echo | $(CC) $(a_flags) -c -o $(dummy-object) -x assembler -;\
|
|
$(LD) $(ld_flags) -r -o $@ -T $(ksyms-lds) $(dummy-object);\
|
|
rm $(dummy-object) $(ksyms-lds)
|
|
|
|
$(obj)/lib-ksyms.o: $(lib-target) FORCE
|
|
$(call if_changed,export_list)
|
|
|
|
targets += $(obj)/lib-ksyms.o
|
|
|
|
endif
|
|
|
|
# NOTE:
|
|
# Do not replace $(filter %.o,^) with $(real-prereqs). When a single object
|
|
# module is turned into a multi object module, $^ will contain header file
|
|
# dependencies recorded in the .*.cmd file.
|
|
ifdef CONFIG_LTO_CLANG
|
|
quiet_cmd_link_multi-m = AR [M] $@
|
|
cmd_link_multi-m = \
|
|
$(cmd_update_lto_symversions); \
|
|
rm -f $@; \
|
|
$(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(filter %.o,$^)
|
|
else
|
|
quiet_cmd_link_multi-m = LD [M] $@
|
|
cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^)
|
|
endif
|
|
|
|
$(multi-used-m): FORCE
|
|
$(call if_changed,link_multi-m)
|
|
$(call multi_depend, $(multi-used-m), .o, -objs -y -m)
|
|
|
|
targets += $(multi-used-m)
|
|
targets := $(filter-out $(PHONY), $(targets))
|
|
|
|
# Add intermediate targets:
|
|
# When building objects with specific suffix patterns, add intermediate
|
|
# targets that the final targets are derived from.
|
|
intermediate_targets = $(foreach sfx, $(2), \
|
|
$(patsubst %$(strip $(1)),%$(sfx), \
|
|
$(filter %$(strip $(1)), $(targets))))
|
|
# %.asn1.o <- %.asn1.[ch] <- %.asn1
|
|
# %.dtb.o <- %.dtb.S <- %.dtb <- %.dts
|
|
# %.lex.o <- %.lex.c <- %.l
|
|
# %.tab.o <- %.tab.[ch] <- %.y
|
|
targets += $(call intermediate_targets, .asn1.o, .asn1.c .asn1.h) \
|
|
$(call intermediate_targets, .dtb.o, .dtb.S .dtb) \
|
|
$(call intermediate_targets, .lex.o, .lex.c) \
|
|
$(call intermediate_targets, .tab.o, .tab.c .tab.h)
|
|
|
|
# Build
|
|
# ---------------------------------------------------------------------------
|
|
|
|
ifdef single-build
|
|
|
|
curdir-single := $(sort $(foreach x, $(KBUILD_SINGLE_TARGETS), \
|
|
$(if $(filter $(x) $(basename $(x)).o, $(targets)), $(x))))
|
|
|
|
# Handle single targets without any rule: show "Nothing to be done for ..." or
|
|
# "No rule to make target ..." depending on whether the target exists.
|
|
unknown-single := $(filter-out $(addsuffix /%, $(subdir-ym)), \
|
|
$(filter $(obj)/%, \
|
|
$(filter-out $(curdir-single), \
|
|
$(KBUILD_SINGLE_TARGETS))))
|
|
|
|
__build: $(curdir-single) $(subdir-ym)
|
|
ifneq ($(unknown-single),)
|
|
$(Q)$(MAKE) -f /dev/null $(unknown-single)
|
|
endif
|
|
@:
|
|
|
|
ifeq ($(curdir-single),)
|
|
# Nothing to do in this directory. Do not include any .*.cmd file for speed-up
|
|
targets :=
|
|
else
|
|
targets += $(curdir-single)
|
|
endif
|
|
|
|
else
|
|
|
|
__build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \
|
|
$(if $(KBUILD_MODULES),$(obj-m) $(mod-targets) $(modorder-target)) \
|
|
$(subdir-ym) $(always)
|
|
@:
|
|
|
|
endif
|
|
|
|
# Descending
|
|
# ---------------------------------------------------------------------------
|
|
|
|
PHONY += $(subdir-ym)
|
|
$(subdir-ym):
|
|
$(Q)$(MAKE) $(build)=$@ \
|
|
$(if $(filter $@/, $(KBUILD_SINGLE_TARGETS)),single-build=) \
|
|
need-builtin=$(if $(filter $@/built-in.a, $(subdir-obj-y)),1) \
|
|
need-modorder=$(if $(need-modorder),$(if $(filter $@/modules.order, $(modorder)),1))
|
|
|
|
# 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)
|
|
|
|
ifdef building_out_of_srctree
|
|
# Create directories for object files if they do not exist
|
|
obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets))))
|
|
# If targets exist, their directories apparently exist. Skip mkdir.
|
|
existing-dirs := $(sort $(patsubst %/,%, $(dir $(existing-targets))))
|
|
obj-dirs := $(strip $(filter-out $(existing-dirs), $(obj-dirs)))
|
|
ifneq ($(obj-dirs),)
|
|
$(shell mkdir -p $(obj-dirs))
|
|
endif
|
|
endif
|
|
|
|
.PHONY: $(PHONY)
|