mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
Merge tag 'kbuild-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild updates from Masahiro Yamada: "Kbuild core: - remove unneeded $(call cc-option,...) switches - consolidate Clang compiler flags into CLANG_FLAGS - announce the deprecation of SUBDIRS - fix single target build for external module - simplify the dependencies of 'prepare' stage targets - allow fixdep to directly write to .*.cmd files - simplify dependency generation for CONFIG_TRIM_UNUSED_KSYMS - change if_changed_rule to accept multi-line recipe - move .SECONDARY special target to scripts/Kbuild.include - remove redundant 'set -e' - improve parallel execution for CONFIG_HEADERS_CHECK - misc cleanups Treewide fixes and cleanups - set Clang flags correctly for PowerPC boot images - fix UML build error with CONFIG_GCC_PLUGINS - remove unneeded patterns from .gitignore files - refactor firmware/Makefile - remove unneeded rules for *offsets.s - avoid unneeded regeneration of intermediate .s files - clean up ./Kbuild Modpost: - remove unused -M, -K options - fix false positive warnings about section mismatch - use simple devtable lookup instead of linker magic - misc cleanups Coccinelle: - relax boolinit.cocci checks for overall consistency - fix warning messages of boolinit.cocci Other tools: - improve -dirty check of scripts/setlocalversion - add a tool to generate compile_commands.json from .*.cmd files" * tag 'kbuild-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (51 commits) kbuild: remove unused cmd_gentimeconst kbuild: remove $(obj)/ prefixes in ./Kbuild treewide: add intermediate .s files to targets treewide: remove explicit rules for *offsets.s firmware: refactor firmware/Makefile firmware: remove unnecessary patterns from .gitignore scripts: remove unnecessary ihex2fw and check-lc_ctypes from .gitignore um: remove unused filechk_gen_header in Makefile scripts: add a tool to produce a compile_commands.json file kbuild: add -Werror=implicit-int flag unconditionally kbuild: add -Werror=strict-prototypes flag unconditionally kbuild: add -fno-PIE flag unconditionally scripts: coccinelle: Correct warning message scripts: coccinelle: only suggest true/false in files that already use them kbuild: handle part-of-module correctly for *.ll and *.symtypes kbuild: refactor part-of-module kbuild: refactor quiet_modtag kbuild: remove redundant quiet_modtag for $(obj-m) kbuild: refactor Makefile.asm-generic user/Makefile: Fix typo and capitalization in comment section ...
This commit is contained in:
@@ -81,12 +81,7 @@ KBUILD_EXTMOD
|
||||
--------------------------------------------------
|
||||
Set the directory to look for the kernel source when building external
|
||||
modules.
|
||||
The directory can be specified in several ways:
|
||||
1) Use "M=..." on the command line
|
||||
2) Environment variable KBUILD_EXTMOD
|
||||
3) Environment variable SUBDIRS
|
||||
The possibilities are listed in the order they take precedence.
|
||||
Using "M=..." will always override the others.
|
||||
Setting "M=..." takes precedence over KBUILD_EXTMOD.
|
||||
|
||||
KBUILD_OUTPUT
|
||||
--------------------------------------------------
|
||||
|
||||
@@ -16,11 +16,7 @@ bounds-file := include/generated/bounds.h
|
||||
always := $(bounds-file)
|
||||
targets := kernel/bounds.s
|
||||
|
||||
# We use internal kbuild rules to avoid the "is up to date" message from make
|
||||
kernel/bounds.s: kernel/bounds.c FORCE
|
||||
$(call if_changed_dep,cc_s_c)
|
||||
|
||||
$(obj)/$(bounds-file): kernel/bounds.s FORCE
|
||||
$(bounds-file): kernel/bounds.s FORCE
|
||||
$(call filechk,offsets,__LINUX_BOUNDS_H__)
|
||||
|
||||
#####
|
||||
@@ -30,15 +26,11 @@ timeconst-file := include/generated/timeconst.h
|
||||
|
||||
targets += $(timeconst-file)
|
||||
|
||||
quiet_cmd_gentimeconst = GEN $@
|
||||
define cmd_gentimeconst
|
||||
(echo $(CONFIG_HZ) | bc -q $< ) > $@
|
||||
endef
|
||||
define filechk_gentimeconst
|
||||
(echo $(CONFIG_HZ) | bc -q $< )
|
||||
endef
|
||||
|
||||
$(obj)/$(timeconst-file): kernel/time/timeconst.bc FORCE
|
||||
$(timeconst-file): kernel/time/timeconst.bc FORCE
|
||||
$(call filechk,gentimeconst)
|
||||
|
||||
#####
|
||||
@@ -50,12 +42,9 @@ offsets-file := include/generated/asm-offsets.h
|
||||
always += $(offsets-file)
|
||||
targets += arch/$(SRCARCH)/kernel/asm-offsets.s
|
||||
|
||||
# We use internal kbuild rules to avoid the "is up to date" message from make
|
||||
arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \
|
||||
$(obj)/$(timeconst-file) $(obj)/$(bounds-file) FORCE
|
||||
$(call if_changed_dep,cc_s_c)
|
||||
arch/$(SRCARCH)/kernel/asm-offsets.s: $(timeconst-file) $(bounds-file)
|
||||
|
||||
$(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE
|
||||
$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE
|
||||
$(call filechk,offsets,__ASM_OFFSETS_H__)
|
||||
|
||||
#####
|
||||
@@ -77,7 +66,7 @@ missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
|
||||
|
||||
extra-$(CONFIG_GDB_SCRIPTS) += build_constants_py
|
||||
|
||||
build_constants_py: $(obj)/$(timeconst-file) $(obj)/$(bounds-file)
|
||||
build_constants_py: $(timeconst-file) $(bounds-file)
|
||||
@$(MAKE) $(build)=scripts/gdb/linux $@
|
||||
|
||||
# Keep these three files during make clean
|
||||
|
||||
@@ -186,6 +186,10 @@ endif
|
||||
# Old syntax make ... SUBDIRS=$PWD is still supported
|
||||
# Setting the environment variable KBUILD_EXTMOD take precedence
|
||||
ifdef SUBDIRS
|
||||
$(warning ================= WARNING ================)
|
||||
$(warning 'SUBDIRS' will be removed after Linux 5.3)
|
||||
$(warning Please use 'M=' or 'KBUILD_EXTMOD' instead)
|
||||
$(warning ==========================================)
|
||||
KBUILD_EXTMOD ?= $(SUBDIRS)
|
||||
endif
|
||||
|
||||
@@ -422,10 +426,10 @@ LINUXINCLUDE := \
|
||||
-I$(objtree)/include \
|
||||
$(USERINCLUDE)
|
||||
|
||||
KBUILD_AFLAGS := -D__ASSEMBLY__
|
||||
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
|
||||
-fno-strict-aliasing -fno-common -fshort-wchar \
|
||||
-Werror-implicit-function-declaration \
|
||||
KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE
|
||||
KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
|
||||
-fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \
|
||||
-Werror-implicit-function-declaration -Werror=implicit-int \
|
||||
-Wno-format-security \
|
||||
-std=gnu89
|
||||
KBUILD_CPPFLAGS := -D__KERNEL__
|
||||
@@ -487,18 +491,18 @@ endif
|
||||
|
||||
ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),)
|
||||
ifneq ($(CROSS_COMPILE),)
|
||||
CLANG_TARGET := --target=$(notdir $(CROSS_COMPILE:%-=%))
|
||||
CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%))
|
||||
GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD)))
|
||||
CLANG_PREFIX := --prefix=$(GCC_TOOLCHAIN_DIR)
|
||||
CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)
|
||||
GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
|
||||
endif
|
||||
ifneq ($(GCC_TOOLCHAIN),)
|
||||
CLANG_GCC_TC := --gcc-toolchain=$(GCC_TOOLCHAIN)
|
||||
CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN)
|
||||
endif
|
||||
KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX)
|
||||
KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX)
|
||||
KBUILD_CFLAGS += $(call cc-option, -no-integrated-as)
|
||||
KBUILD_AFLAGS += $(call cc-option, -no-integrated-as)
|
||||
CLANG_FLAGS += -no-integrated-as
|
||||
KBUILD_CFLAGS += $(CLANG_FLAGS)
|
||||
KBUILD_AFLAGS += $(CLANG_FLAGS)
|
||||
export CLANG_FLAGS
|
||||
endif
|
||||
|
||||
RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register
|
||||
@@ -510,9 +514,6 @@ RETPOLINE_VDSO_CFLAGS := $(call cc-option,$(RETPOLINE_VDSO_CFLAGS_GCC),$(call cc
|
||||
export RETPOLINE_CFLAGS
|
||||
export RETPOLINE_VDSO_CFLAGS
|
||||
|
||||
KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
|
||||
KBUILD_AFLAGS += $(call cc-option,-fno-PIE)
|
||||
|
||||
# check for 'asm goto'
|
||||
ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
|
||||
CC_HAVE_ASM_GOTO := 1
|
||||
@@ -828,12 +829,6 @@ KBUILD_CFLAGS += $(call cc-option,-fno-stack-check,)
|
||||
# conserve stack if available
|
||||
KBUILD_CFLAGS += $(call cc-option,-fconserve-stack)
|
||||
|
||||
# disallow errors like 'EXPORT_GPL(foo);' with missing header
|
||||
KBUILD_CFLAGS += $(call cc-option,-Werror=implicit-int)
|
||||
|
||||
# require functions to have arguments in prototypes, not empty 'int foo()'
|
||||
KBUILD_CFLAGS += $(call cc-option,-Werror=strict-prototypes)
|
||||
|
||||
# Prohibit date/time macros, which would make the build non-deterministic
|
||||
KBUILD_CFLAGS += $(call cc-option,-Werror=date-time)
|
||||
|
||||
@@ -1026,14 +1021,13 @@ cmd_link-vmlinux = \
|
||||
$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
|
||||
|
||||
vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE
|
||||
ifdef CONFIG_HEADERS_CHECK
|
||||
$(Q)$(MAKE) -f $(srctree)/Makefile headers_check
|
||||
endif
|
||||
ifdef CONFIG_GDB_SCRIPTS
|
||||
$(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py)
|
||||
endif
|
||||
+$(call if_changed,link-vmlinux)
|
||||
|
||||
targets := vmlinux
|
||||
|
||||
# Build samples along the rest of the kernel. This needs headers_install.
|
||||
ifdef CONFIG_SAMPLES
|
||||
vmlinux-dirs += samples
|
||||
@@ -1051,7 +1045,7 @@ $(sort $(vmlinux-deps)): $(vmlinux-dirs) ;
|
||||
# Error messages still appears in the original language
|
||||
|
||||
PHONY += $(vmlinux-dirs)
|
||||
$(vmlinux-dirs): prepare scripts
|
||||
$(vmlinux-dirs): prepare
|
||||
$(Q)$(MAKE) $(build)=$@ need-builtin=1
|
||||
|
||||
define filechk_kernel.release
|
||||
@@ -1066,7 +1060,7 @@ include/config/kernel.release: $(srctree)/Makefile FORCE
|
||||
# Carefully list dependencies so we do not try to build scripts twice
|
||||
# in parallel
|
||||
PHONY += scripts
|
||||
scripts: scripts_basic scripts_dtc asm-generic gcc-plugins $(autoksyms_h)
|
||||
scripts: scripts_basic scripts_dtc
|
||||
$(Q)$(MAKE) $(build)=$(@)
|
||||
|
||||
# Things we need to do before we recursively start building the kernel
|
||||
@@ -1099,22 +1093,23 @@ prepare2: prepare3 outputmakefile asm-generic
|
||||
prepare1: prepare2 $(version_h) $(autoksyms_h) include/generated/utsrelease.h
|
||||
$(cmd_crmodverdir)
|
||||
|
||||
archprepare: archheaders archscripts prepare1 scripts_basic
|
||||
archprepare: archheaders archscripts prepare1 scripts
|
||||
|
||||
prepare0: archprepare gcc-plugins
|
||||
prepare0: archprepare
|
||||
$(Q)$(MAKE) $(build)=scripts/mod
|
||||
$(Q)$(MAKE) $(build)=.
|
||||
|
||||
# All the preparing..
|
||||
prepare: prepare0 prepare-objtool
|
||||
|
||||
# Support for using generic headers in asm-generic
|
||||
asm-generic := -f $(srctree)/scripts/Makefile.asm-generic obj
|
||||
|
||||
PHONY += asm-generic uapi-asm-generic
|
||||
asm-generic: uapi-asm-generic
|
||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
|
||||
src=asm obj=arch/$(SRCARCH)/include/generated/asm
|
||||
$(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/asm
|
||||
uapi-asm-generic:
|
||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
|
||||
src=uapi/asm obj=arch/$(SRCARCH)/include/generated/uapi/asm
|
||||
$(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/uapi/asm
|
||||
|
||||
PHONY += prepare-objtool
|
||||
prepare-objtool: $(objtool_target)
|
||||
@@ -1199,6 +1194,10 @@ headers_check: headers_install
|
||||
$(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include HDRCHECK=1
|
||||
$(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(hdr-dst) HDRCHECK=1
|
||||
|
||||
ifdef CONFIG_HEADERS_CHECK
|
||||
all: headers_check
|
||||
endif
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Kernel selftest
|
||||
|
||||
@@ -1283,7 +1282,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
|
||||
|
||||
# Target to prepare building external modules
|
||||
PHONY += modules_prepare
|
||||
modules_prepare: prepare scripts
|
||||
modules_prepare: prepare
|
||||
|
||||
# Target to install modules
|
||||
PHONY += modules_install
|
||||
@@ -1551,9 +1550,6 @@ else # KBUILD_EXTMOD
|
||||
|
||||
# We are always building modules
|
||||
KBUILD_MODULES := 1
|
||||
PHONY += crmodverdir
|
||||
crmodverdir:
|
||||
$(cmd_crmodverdir)
|
||||
|
||||
PHONY += $(objtree)/Module.symvers
|
||||
$(objtree)/Module.symvers:
|
||||
@@ -1565,7 +1561,7 @@ $(objtree)/Module.symvers:
|
||||
|
||||
module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD))
|
||||
PHONY += $(module-dirs) modules
|
||||
$(module-dirs): crmodverdir $(objtree)/Module.symvers
|
||||
$(module-dirs): prepare $(objtree)/Module.symvers
|
||||
$(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
|
||||
|
||||
modules: $(module-dirs)
|
||||
@@ -1604,10 +1600,9 @@ help:
|
||||
@echo ' clean - remove generated files in module directory only'
|
||||
@echo ''
|
||||
|
||||
# Dummies...
|
||||
PHONY += prepare scripts
|
||||
prepare: ;
|
||||
scripts: ;
|
||||
PHONY += prepare
|
||||
prepare:
|
||||
$(cmd_crmodverdir)
|
||||
endif # KBUILD_EXTMOD
|
||||
|
||||
clean: $(clean-dirs)
|
||||
@@ -1712,36 +1707,33 @@ else
|
||||
target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
|
||||
endif
|
||||
|
||||
%.s: %.c prepare scripts FORCE
|
||||
%.s: %.c prepare FORCE
|
||||
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
||||
%.i: %.c prepare scripts FORCE
|
||||
%.i: %.c prepare FORCE
|
||||
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
||||
%.o: %.c prepare scripts FORCE
|
||||
%.o: %.c prepare FORCE
|
||||
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
||||
%.lst: %.c prepare scripts FORCE
|
||||
%.lst: %.c prepare FORCE
|
||||
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
||||
%.s: %.S prepare scripts FORCE
|
||||
%.s: %.S prepare FORCE
|
||||
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
||||
%.o: %.S prepare scripts FORCE
|
||||
%.o: %.S prepare FORCE
|
||||
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
||||
%.symtypes: %.c prepare scripts FORCE
|
||||
%.symtypes: %.c prepare FORCE
|
||||
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
||||
%.ll: %.c prepare scripts FORCE
|
||||
%.ll: %.c prepare FORCE
|
||||
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
||||
|
||||
# Modules
|
||||
/: prepare scripts FORCE
|
||||
$(cmd_crmodverdir)
|
||||
/: prepare FORCE
|
||||
$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
|
||||
$(build)=$(build-dir)
|
||||
# Make sure the latest headers are built for Documentation
|
||||
Documentation/ samples/: headers_install
|
||||
%/: prepare scripts FORCE
|
||||
$(cmd_crmodverdir)
|
||||
%/: prepare FORCE
|
||||
$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
|
||||
$(build)=$(build-dir)
|
||||
%.ko: prepare scripts FORCE
|
||||
$(cmd_crmodverdir)
|
||||
%.ko: prepare FORCE
|
||||
$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
|
||||
$(build)=$(build-dir) $(@:.ko=.o)
|
||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
||||
@@ -1765,13 +1757,12 @@ quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
|
||||
cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \
|
||||
$(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*)
|
||||
|
||||
# read all saved command lines
|
||||
cmd_files := $(wildcard .*.cmd)
|
||||
# read saved command lines for existing targets
|
||||
existing-targets := $(wildcard $(sort $(targets)))
|
||||
|
||||
ifneq ($(cmd_files),)
|
||||
$(cmd_files): ; # Do not try to update included dependency files
|
||||
include $(cmd_files)
|
||||
endif
|
||||
cmd_files := $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
|
||||
$(cmd_files): ; # Do not try to update included dependency files
|
||||
-include $(cmd_files)
|
||||
|
||||
endif # ifeq ($(config-targets),1)
|
||||
endif # ifeq ($(mixed-targets),1)
|
||||
|
||||
@@ -67,4 +67,4 @@ $(src)/sha512-core.S_shipped: $(src)/sha512-armv4.pl
|
||||
$(call cmd,perl)
|
||||
endif
|
||||
|
||||
targets += sha256-core.S sha512-core.S
|
||||
clean-files += sha256-core.S sha512-core.S
|
||||
|
||||
@@ -19,10 +19,9 @@ ifeq ($(CONFIG_PM_DEBUG),y)
|
||||
CFLAGS_pm.o += -DDEBUG
|
||||
endif
|
||||
|
||||
arch/arm/mach-at91/pm_data-offsets.s: arch/arm/mach-at91/pm_data-offsets.c
|
||||
$(call if_changed_dep,cc_s_c)
|
||||
|
||||
include/generated/at91_pm_data-offsets.h: arch/arm/mach-at91/pm_data-offsets.s FORCE
|
||||
$(call filechk,offsets,__PM_DATA_OFFSETS_H__)
|
||||
|
||||
arch/arm/mach-at91/pm_suspend.o: include/generated/at91_pm_data-offsets.h
|
||||
|
||||
targets += pm_data-offsets.s
|
||||
|
||||
@@ -236,10 +236,9 @@ obj-y += omap_phy_internal.o
|
||||
|
||||
obj-$(CONFIG_MACH_OMAP2_TUSB6010) += usb-tusb6010.o
|
||||
|
||||
arch/arm/mach-omap2/pm-asm-offsets.s: arch/arm/mach-omap2/pm-asm-offsets.c
|
||||
$(call if_changed_dep,cc_s_c)
|
||||
|
||||
include/generated/ti-pm-asm-offsets.h: arch/arm/mach-omap2/pm-asm-offsets.s FORCE
|
||||
$(call filechk,offsets,__TI_PM_ASM_OFFSETS_H__)
|
||||
|
||||
$(obj)/sleep33xx.o $(obj)/sleep43xx.o: include/generated/ti-pm-asm-offsets.h
|
||||
|
||||
targets += pm-asm-offsets.s
|
||||
|
||||
@@ -78,4 +78,4 @@ $(src)/sha512-core.S_shipped: $(src)/sha512-armv8.pl
|
||||
$(call cmd,perlasm)
|
||||
endif
|
||||
|
||||
targets += sha256-core.S sha512-core.S
|
||||
clean-files += sha256-core.S sha512-core.S
|
||||
|
||||
@@ -50,10 +50,7 @@ CFLAGS_traps.o += -mfixed-range=f2-f5,f16-f31
|
||||
# The gate DSO image is built using a special linker script.
|
||||
include $(src)/Makefile.gate
|
||||
|
||||
# We use internal kbuild rules to avoid the "is up to date" message from make
|
||||
arch/$(SRCARCH)/kernel/nr-irqs.s: arch/$(SRCARCH)/kernel/nr-irqs.c
|
||||
$(Q)mkdir -p $(dir $@)
|
||||
$(call if_changed_dep,cc_s_c)
|
||||
|
||||
include/generated/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s FORCE
|
||||
$(call filechk,offsets,__ASM_NR_IRQS_H__)
|
||||
|
||||
targets += nr-irqs.s
|
||||
|
||||
@@ -55,6 +55,11 @@ BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
|
||||
|
||||
BOOTARFLAGS := -cr$(KBUILD_ARFLAGS)
|
||||
|
||||
ifdef CONFIG_CC_IS_CLANG
|
||||
BOOTCFLAGS += $(CLANG_FLAGS)
|
||||
BOOTAFLAGS += $(CLANG_FLAGS)
|
||||
endif
|
||||
|
||||
ifdef CONFIG_DEBUG_INFO
|
||||
BOOTCFLAGS += -g
|
||||
endif
|
||||
|
||||
+2
-24
@@ -23,8 +23,6 @@ OS := $(shell uname -s)
|
||||
# features.
|
||||
SHELL := /bin/bash
|
||||
|
||||
filechk_gen_header = $<
|
||||
|
||||
core-y += $(ARCH_DIR)/kernel/ \
|
||||
$(ARCH_DIR)/drivers/ \
|
||||
$(ARCH_DIR)/os-$(OS)/
|
||||
@@ -116,7 +114,8 @@ endef
|
||||
archheaders:
|
||||
$(Q)$(MAKE) -f $(srctree)/Makefile ARCH=$(HEADER_ARCH) asm-generic archheaders
|
||||
|
||||
archprepare: include/generated/user_constants.h
|
||||
archprepare:
|
||||
$(Q)$(MAKE) $(build)=$(HOST_DIR)/um include/generated/user_constants.h
|
||||
|
||||
LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
|
||||
LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib $(call cc-option, -no-pie)
|
||||
@@ -146,25 +145,4 @@ archclean:
|
||||
@find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \
|
||||
-o -name '*.gcov' \) -type f -print | xargs rm -f
|
||||
|
||||
# Generated files
|
||||
|
||||
$(HOST_DIR)/um/user-offsets.s: __headers FORCE
|
||||
$(Q)$(MAKE) $(build)=$(HOST_DIR)/um $@
|
||||
|
||||
define filechk_gen-asm-offsets
|
||||
(set -e; \
|
||||
echo "/*"; \
|
||||
echo " * DO NOT MODIFY."; \
|
||||
echo " *"; \
|
||||
echo " * This file was generated by arch/$(ARCH)/Makefile"; \
|
||||
echo " *"; \
|
||||
echo " */"; \
|
||||
echo ""; \
|
||||
sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" < $<; \
|
||||
echo ""; )
|
||||
endef
|
||||
|
||||
include/generated/user_constants.h: $(HOST_DIR)/um/user-offsets.s
|
||||
$(call filechk,gen-asm-offsets)
|
||||
|
||||
export HEADER_ARCH SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS DEV_NULL_PATH
|
||||
|
||||
@@ -36,9 +36,12 @@ subarch-$(CONFIG_MODULES) += ../kernel/module.o
|
||||
|
||||
USER_OBJS := bugs_$(BITS).o ptrace_user.o fault.o
|
||||
|
||||
extra-y += user-offsets.s
|
||||
$(obj)/user-offsets.s: c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) \
|
||||
-Iarch/x86/include/generated
|
||||
targets += user-offsets.s
|
||||
|
||||
include/generated/user_constants.h: $(obj)/user-offsets.s
|
||||
$(call filechk,offsets,__USER_CONSTANT_H__)
|
||||
|
||||
UNPROFILE_OBJS := stub_segv.o
|
||||
CFLAGS_stub_segv.o := $(CFLAGS_NO_HARDENING)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
drivers/memory/emif-asm-offsets.s: drivers/memory/emif-asm-offsets.c
|
||||
$(call if_changed_dep,cc_s_c)
|
||||
|
||||
include/generated/ti-emif-asm-offsets.h: drivers/memory/emif-asm-offsets.s FORCE
|
||||
$(call filechk,offsets,__TI_EMIF_ASM_OFFSETS_H__)
|
||||
|
||||
targets += emif-asm-offsets.s
|
||||
|
||||
@@ -216,10 +216,3 @@ static void __exit cleanup_scx200_docflash(void)
|
||||
|
||||
module_init(init_scx200_docflash);
|
||||
module_exit(cleanup_scx200_docflash);
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
compile-command: "make -k -C ../../.. SUBDIRS=drivers/mtd/maps modules"
|
||||
c-basic-offset: 8
|
||||
End:
|
||||
*/
|
||||
|
||||
@@ -262,10 +262,3 @@ static void __exit scx200_wdt_cleanup(void)
|
||||
|
||||
module_init(scx200_wdt_init);
|
||||
module_exit(scx200_wdt_cleanup);
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
compile-command: "make -k -C ../.. SUBDIRS=drivers/char modules"
|
||||
c-basic-offset: 8
|
||||
End:
|
||||
*/
|
||||
|
||||
@@ -1,6 +1 @@
|
||||
*.gen.S
|
||||
*.fw
|
||||
*.bin
|
||||
*.csp
|
||||
*.dsp
|
||||
ihex2fw
|
||||
|
||||
+28
-48
@@ -1,61 +1,41 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
#
|
||||
# kbuild file for firmware/
|
||||
#
|
||||
|
||||
# Create $(fwabs) from $(CONFIG_EXTRA_FIRMWARE_DIR) -- if it doesn't have a
|
||||
# Create $(fwdir) from $(CONFIG_EXTRA_FIRMWARE_DIR) -- if it doesn't have a
|
||||
# leading /, it's relative to $(srctree).
|
||||
fwdir := $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE_DIR))
|
||||
fwabs := $(addprefix $(srctree)/,$(filter-out /%,$(fwdir)))$(filter /%,$(fwdir))
|
||||
fwdir := $(addprefix $(srctree)/,$(filter-out /%,$(fwdir)))$(filter /%,$(fwdir))
|
||||
|
||||
fw-external-y := $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE))
|
||||
obj-y := $(addsuffix .gen.o, $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE)))
|
||||
|
||||
quiet_cmd_fwbin = MK_FW $@
|
||||
cmd_fwbin = FWNAME="$(patsubst firmware/%.gen.S,%,$@)"; \
|
||||
FWSTR="$(subst /,_,$(subst .,_,$(subst -,_,$(patsubst \
|
||||
firmware/%.gen.S,%,$@))))"; \
|
||||
ASM_WORD=$(if $(CONFIG_64BIT),.quad,.long); \
|
||||
ASM_ALIGN=$(if $(CONFIG_64BIT),3,2); \
|
||||
PROGBITS=$(if $(CONFIG_ARM),%,@)progbits; \
|
||||
echo "/* Generated by firmware/Makefile */" > $@;\
|
||||
echo " .section .rodata" >>$@;\
|
||||
echo " .p2align $${ASM_ALIGN}" >>$@;\
|
||||
echo "_fw_$${FWSTR}_bin:" >>$@;\
|
||||
echo " .incbin \"$(2)\"" >>$@;\
|
||||
echo "_fw_end:" >>$@;\
|
||||
echo " .section .rodata.str,\"aMS\",$${PROGBITS},1" >>$@;\
|
||||
echo " .p2align $${ASM_ALIGN}" >>$@;\
|
||||
echo "_fw_$${FWSTR}_name:" >>$@;\
|
||||
echo " .string \"$$FWNAME\"" >>$@;\
|
||||
echo " .section .builtin_fw,\"a\",$${PROGBITS}" >>$@;\
|
||||
echo " .p2align $${ASM_ALIGN}" >>$@;\
|
||||
echo " $${ASM_WORD} _fw_$${FWSTR}_name" >>$@;\
|
||||
echo " $${ASM_WORD} _fw_$${FWSTR}_bin" >>$@;\
|
||||
echo " $${ASM_WORD} _fw_end - _fw_$${FWSTR}_bin" >>$@;
|
||||
FWNAME = $(patsubst $(obj)/%.gen.S,%,$@)
|
||||
FWSTR = $(subst /,_,$(subst .,_,$(subst -,_,$(FWNAME))))
|
||||
ASM_WORD = $(if $(CONFIG_64BIT),.quad,.long)
|
||||
ASM_ALIGN = $(if $(CONFIG_64BIT),3,2)
|
||||
PROGBITS = $(if $(CONFIG_ARM),%,@)progbits
|
||||
|
||||
# One of these files will change, or come into existence, whenever
|
||||
# the configuration changes between 32-bit and 64-bit. The .S files
|
||||
# need to change when that happens.
|
||||
wordsize_deps := $(wildcard include/config/64bit.h include/config/32bit.h \
|
||||
include/config/ppc32.h include/config/ppc64.h \
|
||||
include/config/superh32.h include/config/superh64.h \
|
||||
include/config/x86_32.h include/config/x86_64.h \
|
||||
firmware/Makefile)
|
||||
filechk_fwbin = { \
|
||||
echo "/* Generated by $(src)/Makefile */" ;\
|
||||
echo " .section .rodata" ;\
|
||||
echo " .p2align $(ASM_ALIGN)" ;\
|
||||
echo "_fw_$(FWSTR)_bin:" ;\
|
||||
echo " .incbin \"$(fwdir)/$(FWNAME)\"" ;\
|
||||
echo "_fw_end:" ;\
|
||||
echo " .section .rodata.str,\"aMS\",$(PROGBITS),1" ;\
|
||||
echo " .p2align $(ASM_ALIGN)" ;\
|
||||
echo "_fw_$(FWSTR)_name:" ;\
|
||||
echo " .string \"$(FWNAME)\"" ;\
|
||||
echo " .section .builtin_fw,\"a\",$(PROGBITS)" ;\
|
||||
echo " .p2align $(ASM_ALIGN)" ;\
|
||||
echo " $(ASM_WORD) _fw_$(FWSTR)_name" ;\
|
||||
echo " $(ASM_WORD) _fw_$(FWSTR)_bin" ;\
|
||||
echo " $(ASM_WORD) _fw_end - _fw_$(FWSTR)_bin" ;\
|
||||
}
|
||||
|
||||
$(patsubst %,$(obj)/%.gen.S, $(fw-external-y)): %: $(wordsize_deps) \
|
||||
include/config/extra/firmware/dir.h
|
||||
$(call cmd,fwbin,$(fwabs)/$(patsubst $(obj)/%.gen.S,%,$@))
|
||||
$(obj)/%.gen.S: FORCE
|
||||
$(call filechk,fwbin)
|
||||
|
||||
# The .o files depend on the binaries directly; the .S files don't.
|
||||
$(patsubst %,$(obj)/%.gen.o, $(fw-external-y)): $(obj)/%.gen.o: $(fwdir)/%
|
||||
|
||||
obj-y += $(patsubst %,%.gen.o, $(fw-external-y))
|
||||
|
||||
ifeq ($(KBUILD_SRC),)
|
||||
# Makefile.build only creates subdirectories for O= builds, but external
|
||||
# firmware might live outside the kernel source tree
|
||||
_dummy := $(foreach d,$(addprefix $(obj)/,$(dir $(fw-external-y))), $(shell [ -d $(d) ] || mkdir -p $(d)))
|
||||
endif
|
||||
$(addprefix $(obj)/, $(obj-y)): $(obj)/%.gen.o: $(fwdir)/%
|
||||
|
||||
targets := $(patsubst $(obj)/%,%, \
|
||||
$(shell find $(obj) -name \*.gen.S 2>/dev/null))
|
||||
|
||||
@@ -59,16 +59,19 @@ __kcrctab_\name:
|
||||
.endm
|
||||
#undef __put
|
||||
|
||||
#if defined(__KSYM_DEPS__)
|
||||
|
||||
#define __EXPORT_SYMBOL(sym, val, sec) === __KSYM_##sym ===
|
||||
|
||||
#elif defined(CONFIG_TRIM_UNUSED_KSYMS)
|
||||
#if defined(CONFIG_TRIM_UNUSED_KSYMS)
|
||||
|
||||
#include <linux/kconfig.h>
|
||||
#include <generated/autoksyms.h>
|
||||
|
||||
.macro __ksym_marker sym
|
||||
.section ".discard.ksym","a"
|
||||
__ksym_marker_\sym:
|
||||
.previous
|
||||
.endm
|
||||
|
||||
#define __EXPORT_SYMBOL(sym, val, sec) \
|
||||
__ksym_marker sym; \
|
||||
__cond_export_sym(sym, val, sec, __is_defined(__KSYM_##sym))
|
||||
#define __cond_export_sym(sym, val, sec, conf) \
|
||||
___cond_export_sym(sym, val, sec, conf)
|
||||
|
||||
+11
-11
@@ -92,22 +92,22 @@ struct kernel_symbol {
|
||||
*/
|
||||
#define __EXPORT_SYMBOL(sym, sec)
|
||||
|
||||
#elif defined(__KSYM_DEPS__)
|
||||
|
||||
/*
|
||||
* For fine grained build dependencies, we want to tell the build system
|
||||
* about each possible exported symbol even if they're not actually exported.
|
||||
* We use a string pattern that is unlikely to be valid code that the build
|
||||
* system filters out from the preprocessor output (see ksym_dep_filter
|
||||
* in scripts/Kbuild.include).
|
||||
*/
|
||||
#define __EXPORT_SYMBOL(sym, sec) === __KSYM_##sym ===
|
||||
|
||||
#elif defined(CONFIG_TRIM_UNUSED_KSYMS)
|
||||
|
||||
#include <generated/autoksyms.h>
|
||||
|
||||
/*
|
||||
* For fine grained build dependencies, we want to tell the build system
|
||||
* about each possible exported symbol even if they're not actually exported.
|
||||
* We use a symbol pattern __ksym_marker_<symbol> that the build system filters
|
||||
* from the $(NM) output (see scripts/gen_ksymdeps.sh). These symbols are
|
||||
* discarded in the final link stage.
|
||||
*/
|
||||
#define __ksym_marker(sym) \
|
||||
static int __ksym_marker_##sym[0] __section(".discard.ksym") __used
|
||||
|
||||
#define __EXPORT_SYMBOL(sym, sec) \
|
||||
__ksym_marker(sym); \
|
||||
__cond_export_sym(sym, sec, __is_defined(__KSYM_##sym))
|
||||
#define __cond_export_sym(sym, sec, conf) \
|
||||
___cond_export_sym(sym, sec, conf)
|
||||
|
||||
@@ -235,12 +235,10 @@ $(LIBBPF): FORCE
|
||||
# Fix up variables inherited from Kbuild that tools/ build system won't like
|
||||
$(MAKE) -C $(dir $@) RM='rm -rf' LDFLAGS= srctree=$(BPF_SAMPLES_PATH)/../../ O=
|
||||
|
||||
$(obj)/syscall_nrs.s: $(src)/syscall_nrs.c
|
||||
$(call if_changed_dep,cc_s_c)
|
||||
|
||||
$(obj)/syscall_nrs.h: $(obj)/syscall_nrs.s FORCE
|
||||
$(call filechk,offsets,__SYSCALL_NRS_H__)
|
||||
|
||||
targets += syscall_nrs.s
|
||||
clean-files += syscall_nrs.h
|
||||
|
||||
FORCE:
|
||||
|
||||
@@ -14,4 +14,4 @@ HOSTCFLAGS_ucon.o += -I$(objtree)/usr/include
|
||||
all: modules
|
||||
|
||||
modules clean:
|
||||
$(MAKE) -C ../.. SUBDIRS=$(CURDIR) $@
|
||||
$(MAKE) -C ../.. M=$(CURDIR) $@
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user