Commit 81361b83 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'kbuild-v5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild updates from Masahiro Yamada:

 - Increase the -falign-functions alignment for the debug option.

 - Remove ugly libelf checks from the top Makefile.

 - Make the silent build (-s) more silent.

 - Re-compile the kernel if KBUILD_BUILD_TIMESTAMP is specified.

 - Various script cleanups

* tag 'kbuild-v5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (27 commits)
  scripts: add generic syscallnr.sh
  scripts: check duplicated syscall number in syscall table
  sparc: syscalls: use pattern rules to generate syscall headers
  parisc: syscalls: use pattern rules to generate syscall headers
  nds32: add arch/nds32/boot/.gitignore
  kbuild: mkcompile_h: consider timestamp if KBUILD_BUILD_TIMESTAMP is set
  kbuild: modpost: Explicitly warn about unprototyped symbols
  kbuild: remove trailing slashes from $(KBUILD_EXTMOD)
  kconfig.h: explain IS_MODULE(), IS_ENABLED()
  kconfig: constify long_opts
  scripts/setlocalversion: simplify the short version part
  scripts/setlocalversion: factor out 12-chars hash construction
  scripts/setlocalversion: add more comments to -dirty flag detection
  scripts/setlocalversion: remove workaround for old make-kpkg
  scripts/setlocalversion: remove mercurial, svn and git-svn supports
  kbuild: clean up ${quiet} checks in shell scripts
  kbuild: sink stdout from cmd for silent build
  init: use $(call cmd,) for generating include/generated/compile.h
  kbuild: merge scripts/mkmakefile to top Makefile
  sh: move core-y in arch/sh/Makefile to arch/sh/Kbuild
  ...
parents e98e03d0 27932b6a
...@@ -129,6 +129,11 @@ endif ...@@ -129,6 +129,11 @@ endif
$(if $(word 2, $(KBUILD_EXTMOD)), \ $(if $(word 2, $(KBUILD_EXTMOD)), \
$(error building multiple external modules is not supported)) $(error building multiple external modules is not supported))
# Remove trailing slashes
ifneq ($(filter %/, $(KBUILD_EXTMOD)),)
KBUILD_EXTMOD := $(shell dirname $(KBUILD_EXTMOD).)
endif
export KBUILD_EXTMOD export KBUILD_EXTMOD
# Kbuild will save output files in the current working directory. # Kbuild will save output files in the current working directory.
...@@ -544,14 +549,21 @@ scripts_basic: ...@@ -544,14 +549,21 @@ scripts_basic:
$(Q)rm -f .tmp_quiet_recordmcount $(Q)rm -f .tmp_quiet_recordmcount
PHONY += outputmakefile PHONY += outputmakefile
ifdef building_out_of_srctree
# Before starting out-of-tree build, make sure the source tree is clean. # Before starting out-of-tree build, make sure the source tree is clean.
# outputmakefile generates a Makefile in the output directory, if using a # outputmakefile generates a Makefile in the output directory, if using a
# separate output directory. This allows convenient use of make in the # separate output directory. This allows convenient use of make in the
# output directory. # output directory.
# At the same time when output Makefile generated, generate .gitignore to # At the same time when output Makefile generated, generate .gitignore to
# ignore whole output directory # ignore whole output directory
quiet_cmd_makefile = GEN Makefile
cmd_makefile = { \
echo "\# Automatically generated by $(srctree)/Makefile: don't edit"; \
echo "include $(srctree)/Makefile"; \
} > Makefile
outputmakefile: outputmakefile:
ifdef building_out_of_srctree
$(Q)if [ -f $(srctree)/.config -o \ $(Q)if [ -f $(srctree)/.config -o \
-d $(srctree)/include/config -o \ -d $(srctree)/include/config -o \
-d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \ -d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \
...@@ -562,7 +574,7 @@ ifdef building_out_of_srctree ...@@ -562,7 +574,7 @@ ifdef building_out_of_srctree
false; \ false; \
fi fi
$(Q)ln -fsn $(srctree) source $(Q)ln -fsn $(srctree) source
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) $(call cmd,makefile)
$(Q)test -e .gitignore || \ $(Q)test -e .gitignore || \
{ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore { echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
endif endif
...@@ -658,7 +670,7 @@ endif ...@@ -658,7 +670,7 @@ endif
ifeq ($(KBUILD_EXTMOD),) ifeq ($(KBUILD_EXTMOD),)
# Objects we will link into vmlinux / subdirs we need to visit # Objects we will link into vmlinux / subdirs we need to visit
core-y := init/ usr/ core-y := init/ usr/ arch/$(SRCARCH)/
drivers-y := drivers/ sound/ drivers-y := drivers/ sound/
drivers-$(CONFIG_SAMPLES) += samples/ drivers-$(CONFIG_SAMPLES) += samples/
drivers-$(CONFIG_NET) += net/ drivers-$(CONFIG_NET) += net/
...@@ -961,8 +973,8 @@ KBUILD_CFLAGS += $(CC_FLAGS_CFI) ...@@ -961,8 +973,8 @@ KBUILD_CFLAGS += $(CC_FLAGS_CFI)
export CC_FLAGS_CFI export CC_FLAGS_CFI
endif endif
ifdef CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_32B ifdef CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_64B
KBUILD_CFLAGS += -falign-functions=32 KBUILD_CFLAGS += -falign-functions=64
endif endif
# arch Makefile may override CC so keep this after arch Makefile is included # arch Makefile may override CC so keep this after arch Makefile is included
...@@ -1089,41 +1101,6 @@ export INSTALL_DTBS_PATH ?= $(INSTALL_PATH)/dtbs/$(KERNELRELEASE) ...@@ -1089,41 +1101,6 @@ export INSTALL_DTBS_PATH ?= $(INSTALL_PATH)/dtbs/$(KERNELRELEASE)
MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
export MODLIB export MODLIB
HOST_LIBELF_LIBS = $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf)
has_libelf = $(call try-run,\
echo "int main() {}" | $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0)
ifdef CONFIG_STACK_VALIDATION
ifeq ($(has_libelf),1)
objtool_target := tools/objtool FORCE
else
SKIP_STACK_VALIDATION := 1
export SKIP_STACK_VALIDATION
endif
endif
PHONY += resolve_btfids_clean
resolve_btfids_O = $(abspath $(objtree))/tools/bpf/resolve_btfids
# tools/bpf/resolve_btfids directory might not exist
# in output directory, skip its clean in that case
resolve_btfids_clean:
ifneq ($(wildcard $(resolve_btfids_O)),)
$(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean
endif
ifdef CONFIG_BPF
ifdef CONFIG_DEBUG_INFO_BTF
ifeq ($(has_libelf),1)
resolve_btfids_target := tools/bpf/resolve_btfids FORCE
else
ERROR_RESOLVE_BTFIDS := 1
endif
endif # CONFIG_DEBUG_INFO_BTF
endif # CONFIG_BPF
PHONY += prepare0 PHONY += prepare0
export extmod_prefix = $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/) export extmod_prefix = $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)
...@@ -1235,7 +1212,7 @@ prepare0: archprepare ...@@ -1235,7 +1212,7 @@ prepare0: archprepare
$(Q)$(MAKE) $(build)=. $(Q)$(MAKE) $(build)=.
# All the preparing.. # All the preparing..
prepare: prepare0 prepare-objtool prepare-resolve_btfids prepare: prepare0
PHONY += remove-stale-files PHONY += remove-stale-files
remove-stale-files: remove-stale-files:
...@@ -1252,26 +1229,6 @@ uapi-asm-generic: ...@@ -1252,26 +1229,6 @@ uapi-asm-generic:
$(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/uapi/asm \ $(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/uapi/asm \
generic=include/uapi/asm-generic generic=include/uapi/asm-generic
PHONY += prepare-objtool prepare-resolve_btfids
prepare-objtool: $(objtool_target)
ifeq ($(SKIP_STACK_VALIDATION),1)
ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
@echo "error: Cannot generate __mcount_loc for CONFIG_DYNAMIC_FTRACE=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2
@false
endif
ifdef CONFIG_UNWINDER_ORC
@echo "error: Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2
@false
else
@echo "warning: Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2
endif
endif
prepare-resolve_btfids: $(resolve_btfids_target)
ifeq ($(ERROR_RESOLVE_BTFIDS),1)
@echo "error: Cannot resolve BTF IDs for CONFIG_DEBUG_INFO_BTF, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2
@false
endif
# Generate some files # Generate some files
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
...@@ -1359,6 +1316,43 @@ PHONY += scripts_unifdef ...@@ -1359,6 +1316,43 @@ PHONY += scripts_unifdef
scripts_unifdef: scripts_basic scripts_unifdef: scripts_basic
$(Q)$(MAKE) $(build)=scripts scripts/unifdef $(Q)$(MAKE) $(build)=scripts scripts/unifdef
# ---------------------------------------------------------------------------
# Tools
ifdef CONFIG_STACK_VALIDATION
prepare: tools/objtool
endif
ifdef CONFIG_BPF
ifdef CONFIG_DEBUG_INFO_BTF
prepare: tools/bpf/resolve_btfids
endif
endif
PHONY += resolve_btfids_clean
resolve_btfids_O = $(abspath $(objtree))/tools/bpf/resolve_btfids
# tools/bpf/resolve_btfids directory might not exist
# in output directory, skip its clean in that case
resolve_btfids_clean:
ifneq ($(wildcard $(resolve_btfids_O)),)
$(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean
endif
# Clear a bunch of variables before executing the submake
ifeq ($(quiet),silent_)
tools_silent=s
endif
tools/: FORCE
$(Q)mkdir -p $(objtree)/tools
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/
tools/%: FORCE
$(Q)mkdir -p $(objtree)/tools
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ $*
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Kernel selftest # Kernel selftest
...@@ -1959,20 +1953,6 @@ kernelversion: ...@@ -1959,20 +1953,6 @@ kernelversion:
image_name: image_name:
@echo $(KBUILD_IMAGE) @echo $(KBUILD_IMAGE)
# Clear a bunch of variables before executing the submake
ifeq ($(quiet),silent_)
tools_silent=s
endif
tools/: FORCE
$(Q)mkdir -p $(objtree)/tools
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/
tools/%: FORCE
$(Q)mkdir -p $(objtree)/tools
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ $*
quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
cmd_rmfiles = rm -rf $(rm-files) cmd_rmfiles = rm -rf $(rm-files)
......
# SPDX-License-Identifier: GPL-2.0-only
obj-y += kernel/ mm/
obj-$(CONFIG_MATHEMU) += math-emu/
...@@ -38,8 +38,6 @@ KBUILD_CFLAGS += $(cflags-y) -Wa,-mev6 ...@@ -38,8 +38,6 @@ KBUILD_CFLAGS += $(cflags-y) -Wa,-mev6
head-y := arch/alpha/kernel/head.o head-y := arch/alpha/kernel/head.o
core-y += arch/alpha/kernel/ arch/alpha/mm/
core-$(CONFIG_MATHEMU) += arch/alpha/math-emu/
libs-y += arch/alpha/lib/ libs-y += arch/alpha/lib/
# export what is needed by arch/alpha/boot/Makefile # export what is needed by arch/alpha/boot/Makefile
......
...@@ -85,9 +85,6 @@ KBUILD_LDFLAGS += $(ldflags-y) ...@@ -85,9 +85,6 @@ KBUILD_LDFLAGS += $(ldflags-y)
head-y := arch/arc/kernel/head.o head-y := arch/arc/kernel/head.o
# See arch/arc/Kbuild for content of core part of the kernel
core-y += arch/arc/
# w/o this dtb won't embed into kernel binary # w/o this dtb won't embed into kernel binary
core-y += arch/arc/boot/dts/ core-y += arch/arc/boot/dts/
......
...@@ -252,7 +252,6 @@ endif ...@@ -252,7 +252,6 @@ endif
export TEXT_OFFSET GZFLAGS MMUEXT export TEXT_OFFSET GZFLAGS MMUEXT
core-y += arch/arm/
# If we have a machine-specific directory, then include it in the build. # If we have a machine-specific directory, then include it in the build.
core-y += $(machdirs) $(platdirs) core-y += $(machdirs) $(platdirs)
......
...@@ -149,7 +149,6 @@ KBUILD_CFLAGS += -DKASAN_SHADOW_SCALE_SHIFT=$(KASAN_SHADOW_SCALE_SHIFT) ...@@ -149,7 +149,6 @@ KBUILD_CFLAGS += -DKASAN_SHADOW_SCALE_SHIFT=$(KASAN_SHADOW_SCALE_SHIFT)
KBUILD_CPPFLAGS += -DKASAN_SHADOW_SCALE_SHIFT=$(KASAN_SHADOW_SCALE_SHIFT) KBUILD_CPPFLAGS += -DKASAN_SHADOW_SCALE_SHIFT=$(KASAN_SHADOW_SCALE_SHIFT)
KBUILD_AFLAGS += -DKASAN_SHADOW_SCALE_SHIFT=$(KASAN_SHADOW_SCALE_SHIFT) KBUILD_AFLAGS += -DKASAN_SHADOW_SCALE_SHIFT=$(KASAN_SHADOW_SCALE_SHIFT)
core-y += arch/arm64/
libs-y := arch/arm64/lib/ $(libs-y) libs-y := arch/arm64/lib/ $(libs-y)
libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
......
# SPDX-License-Identifier: GPL-2.0-only
# SPDX-License-Identifier: GPL-2.0-only
obj-y += kernel/ mm/ boot/dts/
...@@ -30,9 +30,6 @@ ifeq ($(CROSS_COMPILE),) ...@@ -30,9 +30,6 @@ ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE := $(call cc-cross-prefix, h8300-unknown-linux- h8300-linux-) CROSS_COMPILE := $(call cc-cross-prefix, h8300-unknown-linux- h8300-linux-)
endif endif
core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/
core-y += arch/$(ARCH)/boot/dts/
libs-y += arch/$(ARCH)/lib/ libs-y += arch/$(ARCH)/lib/
boot := arch/h8300/boot boot := arch/h8300/boot
......
# SPDX-License-Identifier: GPL-2.0-only
obj-y += kernel/ mm/ lib/
...@@ -34,7 +34,3 @@ KBUILD_CFLAGS += -ffixed-$(TIR_NAME) -DTHREADINFO_REG=$(TIR_NAME) -D__linux__ ...@@ -34,7 +34,3 @@ KBUILD_CFLAGS += -ffixed-$(TIR_NAME) -DTHREADINFO_REG=$(TIR_NAME) -D__linux__
KBUILD_AFLAGS += -DTHREADINFO_REG=$(TIR_NAME) KBUILD_AFLAGS += -DTHREADINFO_REG=$(TIR_NAME)
head-y := arch/hexagon/kernel/head.o head-y := arch/hexagon/kernel/head.o
core-y += arch/hexagon/kernel/ \
arch/hexagon/mm/ \
arch/hexagon/lib/
# SPDX-License-Identifier: GPL-2.0-only
...@@ -97,7 +97,6 @@ head-$(CONFIG_SUN3) := arch/m68k/kernel/sun3-head.o ...@@ -97,7 +97,6 @@ head-$(CONFIG_SUN3) := arch/m68k/kernel/sun3-head.o
head-$(CONFIG_M68000) := arch/m68k/68000/head.o head-$(CONFIG_M68000) := arch/m68k/68000/head.o
head-$(CONFIG_COLDFIRE) := arch/m68k/coldfire/head.o head-$(CONFIG_COLDFIRE) := arch/m68k/coldfire/head.o
core-y += arch/m68k/
libs-y += arch/m68k/lib/ libs-y += arch/m68k/lib/
......
# SPDX-License-Identifier: GPL-2.0-only
...@@ -332,9 +332,6 @@ head-y := arch/mips/kernel/head.o ...@@ -332,9 +332,6 @@ head-y := arch/mips/kernel/head.o
libs-y += arch/mips/lib/ libs-y += arch/mips/lib/
libs-$(CONFIG_MIPS_FP_SUPPORT) += arch/mips/math-emu/ libs-$(CONFIG_MIPS_FP_SUPPORT) += arch/mips/math-emu/
# See arch/mips/Kbuild for content of core part of the kernel
core-y += arch/mips/
drivers-y += arch/mips/crypto/ drivers-y += arch/mips/crypto/
# suspend and hibernation support # suspend and hibernation support
......
# SPDX-License-Identifier: GPL-2.0-only
# SPDX-License-Identifier: GPL-2.0-only
/Image
# SPDX-License-Identifier: GPL-2.0-only
...@@ -42,7 +42,6 @@ endif ...@@ -42,7 +42,6 @@ endif
head-y := arch/openrisc/kernel/head.o head-y := arch/openrisc/kernel/head.o
core-y += arch/openrisc/
libs-y += $(LIBGCC) libs-y += $(LIBGCC)
PHONY += vmlinux.bin PHONY += vmlinux.bin
......
# SPDX-License-Identifier: GPL-2.0-only
...@@ -10,25 +10,15 @@ syshdr := $(srctree)/scripts/syscallhdr.sh ...@@ -10,25 +10,15 @@ syshdr := $(srctree)/scripts/syscallhdr.sh
systbl := $(srctree)/scripts/syscalltbl.sh systbl := $(srctree)/scripts/syscalltbl.sh
quiet_cmd_syshdr = SYSHDR $@ quiet_cmd_syshdr = SYSHDR $@
cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --emit-nr --abis $(abis) $< $@ cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --emit-nr --abis common,$* $< $@
quiet_cmd_systbl = SYSTBL $@ quiet_cmd_systbl = SYSTBL $@
cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis $(abis) $< $@ cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis common,$* $< $@
$(uapi)/unistd_32.h: abis := common,32 $(uapi)/unistd_%.h: $(syscall) $(syshdr) FORCE
$(uapi)/unistd_32.h: $(syscall) $(syshdr) FORCE
$(call if_changed,syshdr) $(call if_changed,syshdr)
$(uapi)/unistd_64.h: abis := common,64 $(kapi)/syscall_table_%.h: $(syscall) $(systbl) FORCE
$(uapi)/unistd_64.h: $(syscall) $(syshdr) FORCE
$(call if_changed,syshdr)
$(kapi)/syscall_table_32.h: abis := common,32
$(kapi)/syscall_table_32.h: $(syscall) $(systbl) FORCE
$(call if_changed,systbl)
$(kapi)/syscall_table_64.h: abis := common,64
$(kapi)/syscall_table_64.h: $(syscall) $(systbl) FORCE
$(call if_changed,systbl) $(call if_changed,systbl)
uapisyshdr-y += unistd_32.h unistd_64.h uapisyshdr-y += unistd_32.h unistd_64.h
......
...@@ -267,9 +267,6 @@ head-$(CONFIG_PPC_FPU) += arch/powerpc/kernel/fpu.o ...@@ -267,9 +267,6 @@ head-$(CONFIG_PPC_FPU) += arch/powerpc/kernel/fpu.o
head-$(CONFIG_ALTIVEC) += arch/powerpc/kernel/vector.o head-$(CONFIG_ALTIVEC) += arch/powerpc/kernel/vector.o
head-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += arch/powerpc/kernel/prom_init.o head-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += arch/powerpc/kernel/prom_init.o
# See arch/powerpc/Kbuild for content of core part of the kernel
core-y += arch/powerpc/
# Default to zImage, override when needed # Default to zImage, override when needed
all: zImage all: zImage
......
...@@ -99,7 +99,6 @@ endif ...@@ -99,7 +99,6 @@ endif
head-y := arch/riscv/kernel/head.o head-y := arch/riscv/kernel/head.o
core-y += arch/riscv/
core-$(CONFIG_RISCV_ERRATA_ALTERNATIVE) += arch/riscv/errata/ core-$(CONFIG_RISCV_ERRATA_ALTERNATIVE) += arch/riscv/errata/
libs-y += arch/riscv/lib/ libs-y += arch/riscv/lib/
......
...@@ -129,9 +129,6 @@ OBJCOPYFLAGS := -O binary ...@@ -129,9 +129,6 @@ OBJCOPYFLAGS := -O binary
head-y := arch/s390/kernel/head64.o head-y := arch/s390/kernel/head64.o
# See arch/s390/Kbuild for content of core part of the kernel
core-y += arch/s390/
libs-y += arch/s390/lib/ libs-y += arch/s390/lib/
drivers-y += drivers/s390/ drivers-y += drivers/s390/
......
# SPDX-License-Identifier: GPL-2.0-only
obj-y += kernel/ mm/ boards/
obj-$(CONFIG_SH_FPU_EMU) += math-emu/
obj-$(CONFIG_USE_BUILTIN_DTB) += boot/dts/
...@@ -116,11 +116,6 @@ export ld-bfd ...@@ -116,11 +116,6 @@ export ld-bfd
head-y := arch/sh/kernel/head_32.o head-y := arch/sh/kernel/head_32.o
core-y += arch/sh/kernel/ arch/sh/mm/ arch/sh/boards/
core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/
core-$(CONFIG_USE_BUILTIN_DTB) += arch/sh/boot/dts/
# Mach groups # Mach groups
machdir-$(CONFIG_SOLUTION_ENGINE) += mach-se machdir-$(CONFIG_SOLUTION_ENGINE) += mach-se
machdir-$(CONFIG_SH_HP6XX) += mach-hp6xx machdir-$(CONFIG_SH_HP6XX) += mach-hp6xx
......
...@@ -58,9 +58,6 @@ endif ...@@ -58,9 +58,6 @@ endif
head-y := arch/sparc/kernel/head_$(BITS).o head-y := arch/sparc/kernel/head_$(BITS).o
# See arch/sparc/Kbuild for the core part of the kernel
core-y += arch/sparc/
libs-y += arch/sparc/prom/ libs-y += arch/sparc/prom/
libs-y += arch/sparc/lib/ libs-y += arch/sparc/lib/
......
...@@ -10,25 +10,15 @@ syshdr := $(srctree)/scripts/syscallhdr.sh ...@@ -10,25 +10,15 @@ syshdr := $(srctree)/scripts/syscallhdr.sh
systbl := $(srctree)/scripts/syscalltbl.sh systbl := $(srctree)/scripts/syscalltbl.sh
quiet_cmd_syshdr = SYSHDR $@ quiet_cmd_syshdr = SYSHDR $@
cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --emit-nr --abis $(abis) $< $@ cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --emit-nr --abis common,$* $< $@
quiet_cmd_systbl = SYSTBL $@ quiet_cmd_systbl = SYSTBL $@
cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis $(abis) $< $@ cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis common,$* $< $@
$(uapi)/unistd_32.h: abis := common,32 $(uapi)/unistd_%.h: $(syscall) $(syshdr) FORCE
$(uapi)/unistd_32.h: $(syscall) $(syshdr) FORCE
$(call if_changed,syshdr) $(call if_changed,syshdr)
$(uapi)/unistd_64.h: abis := common,64 $(kapi)/syscall_table_%.h: $(syscall) $(systbl) FORCE
$(uapi)/unistd_64.h: $(syscall) $(syshdr) FORCE
$(call if_changed,syshdr)
$(kapi)/syscall_table_32.h: abis := common,32
$(kapi)/syscall_table_32.h: $(syscall) $(systbl) FORCE
$(call if_changed,systbl)
$(kapi)/syscall_table_64.h: abis := common,64
$(kapi)/syscall_table_64.h: $(syscall) $(systbl) FORCE
$(call if_changed,systbl) $(call if_changed,systbl)
uapisyshdr-y += unistd_32.h unistd_64.h uapisyshdr-y += unistd_32.h unistd_64.h
......
# SPDX-License-Identifier: GPL-2.0-only
...@@ -240,9 +240,6 @@ head-y += arch/x86/kernel/platform-quirks.o ...@@ -240,9 +240,6 @@ head-y += arch/x86/kernel/platform-quirks.o
libs-y += arch/x86/lib/ libs-y += arch/x86/lib/
# See arch/x86/Kbuild for content of core part of the kernel
core-y += arch/x86/
# drivers-y are linked after core-y # drivers-y are linked after core-y
drivers-$(CONFIG_MATH_EMULATION) += arch/x86/math-emu/ drivers-$(CONFIG_MATH_EMULATION) += arch/x86/math-emu/
drivers-$(CONFIG_PCI) += arch/x86/pci/ drivers-$(CONFIG_PCI) += arch/x86/pci/
......
# SPDX-License-Identifier: GPL-2.0-only
...@@ -51,7 +51,8 @@ ...@@ -51,7 +51,8 @@
/* /*
* IS_MODULE(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'm', 0 * IS_MODULE(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'm', 0
* otherwise. * otherwise. CONFIG_FOO=m results in "#define CONFIG_FOO_MODULE 1" in
* autoconf.h.
*/ */
#define IS_MODULE(option) __is_defined(option##_MODULE) #define IS_MODULE(option) __is_defined(option##_MODULE)
...@@ -66,7 +67,8 @@ ...@@ -66,7 +67,8 @@
/* /*
* IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm', * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',
* 0 otherwise. * 0 otherwise. Note that CONFIG_FOO=y results in "#define CONFIG_FOO 1" in
* autoconf.h, while CONFIG_FOO=m results in "#define CONFIG_FOO_MODULE 1".
*/ */
#define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option)) #define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option))
......
...@@ -27,11 +27,11 @@ $(obj)/version.o: include/generated/compile.h ...@@ -27,11 +27,11 @@ $(obj)/version.o: include/generated/compile.h
# mkcompile_h will make sure to only update the # mkcompile_h will make sure to only update the
# actual file if its content has changed. # actual file if its content has changed.
chk_compile.h = : quiet_cmd_compile.h = CHK $@
quiet_chk_compile.h = echo ' CHK $@' cmd_compile.h = \
silent_chk_compile.h = : $(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \
include/generated/compile.h: FORCE
@$($(quiet)chk_compile.h)
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \
"$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" \ "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" \
"$(CONFIG_PREEMPT_RT)" $(CONFIG_CC_VERSION_TEXT) "$(LD)" "$(CONFIG_PREEMPT_RT)" $(CONFIG_CC_VERSION_TEXT) "$(LD)"
include/generated/compile.h: FORCE
$(call cmd,compile.h)
...@@ -56,9 +56,7 @@ if [ -f kernel/kheaders.md5 ] && ...@@ -56,9 +56,7 @@ if [ -f kernel/kheaders.md5 ] &&
exit exit
fi fi
if [ "${quiet}" != "silent_" ]; then echo " GEN $tarfile"
echo " GEN $tarfile"
fi
rm -rf $cpio_dir rm -rf $cpio_dir
mkdir $cpio_dir mkdir $cpio_dir
......
...@@ -414,8 +414,8 @@ config SECTION_MISMATCH_WARN_ONLY ...@@ -414,8 +414,8 @@ config SECTION_MISMATCH_WARN_ONLY
If unsure, say Y. If unsure, say Y.
config DEBUG_FORCE_FUNCTION_ALIGN_32B config DEBUG_FORCE_FUNCTION_ALIGN_64B
bool "Force all function address 32B aligned" if EXPERT bool "Force all function address 64B aligned" if EXPERT
help help
There are cases that a commit from one domain changes the function There are cases that a commit from one domain changes the function
address alignment of other domains, and cause magic performance address alignment of other domains, and cause magic performance
......
...@@ -90,8 +90,13 @@ clean := -f $(srctree)/scripts/Makefile.clean obj ...@@ -90,8 +90,13 @@ clean := -f $(srctree)/scripts/Makefile.clean obj
echo-cmd = $(if $($(quiet)cmd_$(1)),\ echo-cmd = $(if $($(quiet)cmd_$(1)),\
echo ' $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';) echo ' $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';)
# sink stdout for 'make -s'
redirect :=
quiet_redirect :=
silent_redirect := exec >/dev/null;
# printing commands # printing commands
cmd = @set -e; $(echo-cmd) $(cmd_$(1)) cmd = @set -e; $(echo-cmd) $($(quiet)redirect) $(cmd_$(1))
### ###
# if_changed - execute command if any prerequisite is newer than # if_changed - execute command if any prerequisite is newer than
......
...@@ -219,7 +219,6 @@ endif # CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT ...@@ -219,7 +219,6 @@ endif # CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT
ifdef CONFIG_STACK_VALIDATION ifdef CONFIG_STACK_VALIDATION
ifndef CONFIG_LTO_CLANG ifndef CONFIG_LTO_CLANG
ifneq ($(SKIP_STACK_VALIDATION),1)
__objtool_obj := $(objtree)/tools/objtool/objtool __objtool_obj := $(objtree)/tools/objtool/objtool
...@@ -233,7 +232,6 @@ objtool_obj = $(if $(patsubst y%,, \ ...@@ -233,7 +232,6 @@ objtool_obj = $(if $(patsubst y%,, \
$(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n), \ $(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n), \
$(__objtool_obj)) $(__objtool_obj))
endif # SKIP_STACK_VALIDATION
endif # CONFIG_LTO_CLANG endif # CONFIG_LTO_CLANG
endif # CONFIG_STACK_VALIDATION endif # CONFIG_STACK_VALIDATION
......
...@@ -39,12 +39,10 @@ prelink-ext := .lto ...@@ -39,12 +39,10 @@ prelink-ext := .lto
# so let's now process the prelinked binary before we link the module. # so let's now process the prelinked binary before we link the module.
ifdef CONFIG_STACK_VALIDATION ifdef CONFIG_STACK_VALIDATION
ifneq ($(SKIP_STACK_VALIDATION),1)
cmd_ld_ko_o += \ cmd_ld_ko_o += \
$(objtree)/tools/objtool/objtool $(objtool_args) \ $(objtree)/tools/objtool/objtool $(objtool_args) \
$(@:.ko=$(prelink-ext).o); $(@:.ko=$(prelink-ext).o);
endif # SKIP_STACK_VALIDATION
endif # CONFIG_STACK_VALIDATION endif # CONFIG_STACK_VALIDATION
endif # CONFIG_LTO_CLANG endif # CONFIG_LTO_CLANG
......
...@@ -678,7 +678,7 @@ static void check_conf(struct menu *menu) ...@@ -678,7 +678,7 @@ static void check_conf(struct menu *menu)
check_conf(child); check_conf(child);
} }
static struct option long_opts[] = { static const struct option long_opts[] = {
{"help", no_argument, NULL, 'h'}, {"help", no_argument, NULL, 'h'},
{"silent", no_argument, NULL, 's'}, {"silent", no_argument, NULL, 's'},
{"oldaskconfig", no_argument, &input_mode_opt, oldaskconfig}, {"oldaskconfig", no_argument, &input_mode_opt, oldaskconfig},
......
...@@ -38,9 +38,7 @@ LDFLAGS_vmlinux="$3" ...@@ -38,9 +38,7 @@ LDFLAGS_vmlinux="$3"
# Will be supressed by "make -s" # Will be supressed by "make -s"
info() info()
{ {
if [ "${quiet}" != "silent_" ]; then printf " %-7s %s\n" "${1}" "${2}"
printf " %-7s %s\n" "${1}" "${2}"
fi
} }
# Generate a linker script to ensure correct ordering of initcalls. # Generate a linker script to ensure correct ordering of initcalls.
......
...@@ -9,8 +9,6 @@ PREEMPT_RT=$5 ...@@ -9,8 +9,6 @@ PREEMPT_RT=$5
CC_VERSION="$6" CC_VERSION="$6"
LD=$7 LD=$7
vecho() { [ "${quiet}" = "silent_" ] || echo "$@" ; }
# Do not expand names # Do not expand names
set -f set -f
...@@ -70,19 +68,27 @@ UTS_VERSION="$(echo $UTS_VERSION $CONFIG_FLAGS $TIMESTAMP | cut -b -$UTS_LEN)" ...@@ -70,19 +68,27 @@ UTS_VERSION="$(echo $UTS_VERSION $CONFIG_FLAGS $TIMESTAMP | cut -b -$UTS_LEN)"
# Only replace the real compile.h if the new one is different, # Only replace the real compile.h if the new one is different,
# in order to preserve the timestamp and avoid unnecessary # in order to preserve the timestamp and avoid unnecessary
# recompilations. # recompilations.
# We don't consider the file changed if only the date/time changed. # We don't consider the file changed if only the date/time changed,
# unless KBUILD_BUILD_TIMESTAMP was explicitly set (e.g. for
# reproducible builds with that value referring to a commit timestamp).
# A kernel config change will increase the generation number, thus # A kernel config change will increase the generation number, thus
# causing compile.h to be updated (including date/time) due to the # causing compile.h to be updated (including date/time) due to the
# changed comment in the # changed comment in the
# first line. # first line.
if [ -z "$KBUILD_BUILD_TIMESTAMP" ]; then
IGNORE_PATTERN="UTS_VERSION"
else
IGNORE_PATTERN="NOT_A_PATTERN_TO_BE_MATCHED"
fi
if [ -r $TARGET ] && \ if [ -r $TARGET ] && \
grep -v 'UTS_VERSION' $TARGET > .tmpver.1 && \ grep -v $IGNORE_PATTERN $TARGET > .tmpver.1 && \
grep -v 'UTS_VERSION' .tmpcompile > .tmpver.2 && \ grep -v $IGNORE_PATTERN .tmpcompile > .tmpver.2 && \
cmp -s .tmpver.1 .tmpver.2; then cmp -s .tmpver.1 .tmpver.2; then
rm -f .tmpcompile rm -f .tmpcompile
else else
vecho " UPD $TARGET" echo " UPD $TARGET"
mv -f .tmpcompile $TARGET mv -f .tmpcompile $TARGET
fi fi
rm -f .tmpver.1 .tmpver.2 rm -f .tmpver.1 .tmpver.2
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Generates a small Makefile used in the root of the output
# directory, to allow make to be started from there.
# The Makefile also allow for more convinient build of external modules
# Usage
# $1 - Kernel src directory
if [ "${quiet}" != "silent_" ]; then
echo " GEN Makefile"
fi
cat << EOF > Makefile
# Automatically generated by $0: don't edit
include $1/Makefile
EOF
...@@ -660,8 +660,11 @@ static void handle_modversion(const struct module *mod, ...@@ -660,8 +660,11 @@ static void handle_modversion(const struct module *mod,
unsigned int crc; unsigned int crc;
if (sym->st_shndx == SHN_UNDEF) { if (sym->st_shndx == SHN_UNDEF) {
warn("EXPORT symbol \"%s\" [%s%s] version generation failed, symbol will not be versioned.\n", warn("EXPORT symbol \"%s\" [%s%s] version ...\n"
symname, mod->name, mod->is_vmlinux ? "" : ".ko"); "Is \"%s\" prototyped in <asm/asm-prototypes.h>?\n",
symname, mod->name, mod->is_vmlinux ? "" : ".ko",
symname);
return; return;
} }
......
...@@ -59,32 +59,19 @@ scm_version() ...@@ -59,32 +59,19 @@ scm_version()
fi fi
# If we are past a tagged commit (like # If we are past a tagged commit (like
# "v2.6.30-rc5-302-g72357d5"), we pretty print it. # "v2.6.30-rc5-302-g72357d5"), we pretty print it.
# if atag="$(git describe 2>/dev/null)"; then
# Ensure the abbreviated sha1 has exactly 12 echo "$atag" | awk -F- '{printf("-%05d", $(NF-1))}'
# hex characters, to make the output
# independent of git version, local
# core.abbrev settings and/or total number of
# objects in the current repository - passing
# --abbrev=12 ensures a minimum of 12, and the
# awk substr() then picks the 'g' and first 12
# hex chars.
if atag="$(git describe --abbrev=12 2>/dev/null)"; then
echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),substr($(NF),0,13))}'
# If we don't have a tag at all we print -g{commitish},
# again using exactly 12 hex chars.
else
head="$(echo $head | cut -c1-12)"
printf '%s%s' -g $head
fi fi
fi
# Is this git on svn? # Add -g and exactly 12 hex chars.
if git config --get svn-remote.svn.url >/dev/null; then printf '%s%s' -g "$(echo $head | cut -c1-12)"
printf -- '-svn%s' "$(git svn find-rev $head)"
fi fi
# Check for uncommitted changes. # Check for uncommitted changes.
# This script must avoid any write attempt to the source tree,
# which might be read-only.
# You cannot use 'git describe --dirty' because it tries to
# create .git/index.lock .
# First, with git-status, but --no-optional-locks is only # First, with git-status, but --no-optional-locks is only
# supported in git >= 2.14, so fall back to git-diff-index if # supported in git >= 2.14, so fall back to git-diff-index if
# it fails. Note that git-diff-index does not refresh the # it fails. Note that git-diff-index does not refresh the
...@@ -93,45 +80,9 @@ scm_version() ...@@ -93,45 +80,9 @@ scm_version()
if { if {
git --no-optional-locks status -uno --porcelain 2>/dev/null || git --no-optional-locks status -uno --porcelain 2>/dev/null ||
git diff-index --name-only HEAD git diff-index --name-only HEAD
} | grep -qvE '^(.. )?scripts/package'; then } | read dummy; then
printf '%s' -dirty printf '%s' -dirty
fi fi
# All done with git
return
fi
# Check for mercurial and a mercurial repo.
if test -d .hg && hgid=$(hg id 2>/dev/null); then
# Do we have an tagged version? If so, latesttagdistance == 1
if [ "$(hg log -r . --template '{latesttagdistance}')" = "1" ]; then
id=$(hg log -r . --template '{latesttag}')
printf '%s%s' -hg "$id"
else
tag=$(printf '%s' "$hgid" | cut -d' ' -f2)
if [ -z "$tag" -o "$tag" = tip ]; then
id=$(printf '%s' "$hgid" | sed 's/[+ ].*//')
printf '%s%s' -hg "$id"
fi
fi
# Are there uncommitted changes?
# These are represented by + after the changeset id.
case "$hgid" in
*+|*+\ *) printf '%s' -dirty ;;
esac
# All done with mercurial
return
fi
# Check for svn and a svn repo.
if rev=$(LC_ALL=C svn info 2>/dev/null | grep '^Last Changed Rev'); then
rev=$(echo $rev | awk '{print $NF}')
printf -- '-svn%s' "$rev"
# All done with svn
return
fi fi
} }
...@@ -180,15 +131,13 @@ res="${res}${CONFIG_LOCALVERSION}${LOCALVERSION}" ...@@ -180,15 +131,13 @@ res="${res}${CONFIG_LOCALVERSION}${LOCALVERSION}"
if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then
# full scm version string # full scm version string
res="$res$(scm_version)" res="$res$(scm_version)"
else elif [ -z "${LOCALVERSION}" ]; then
# append a plus sign if the repository is not in a clean # append a plus sign if the repository is not in a clean
# annotated or signed tagged state (as git describe only # annotated or signed tagged state (as git describe only
# looks at signed or annotated tags - git tag -a/-s) and # looks at signed or annotated tags - git tag -a/-s) and
# LOCALVERSION= is not specified # LOCALVERSION= is not specified
if test "${LOCALVERSION+set}" != "set"; then scm=$(scm_version --short)
scm=$(scm_version --short) res="$res${scm:++}"
res="$res${scm:++}"
fi
fi fi
echo "$res" echo "$res"
...@@ -69,7 +69,7 @@ guard=_UAPI_ASM_$(basename "$outfile" | ...@@ -69,7 +69,7 @@ guard=_UAPI_ASM_$(basename "$outfile" |
sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
-e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g') -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g')
grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$infile" | sort -n | { grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$infile" | {
echo "#ifndef $guard" echo "#ifndef $guard"
echo "#define $guard" echo "#define $guard"
echo echo
......
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
#
# Generate a syscall number header.
#
# Each line of the syscall table should have the following format:
#
# NR ABI NAME [NATIVE] [COMPAT]
#
# NR syscall number
# ABI ABI name
# NAME syscall name
# NATIVE native entry point (optional)
# COMPAT compat entry point (optional)
set -e
usage() {
echo >&2 "usage: $0 [--abis ABIS] [--prefix PREFIX] INFILE OUTFILE" >&2
echo >&2
echo >&2 " INFILE input syscall table"
echo >&2 " OUTFILE output header file"
echo >&2
echo >&2 "options:"
echo >&2 " --abis ABIS ABI(s) to handle (By default, all lines are handled)"
echo >&2 " --prefix PREFIX The prefix to the macro like __NR_<PREFIX><NAME>"
exit 1
}
# default unless specified by options
abis=
prefix=
while [ $# -gt 0 ]
do
case $1 in
--abis)
abis=$(echo "($2)" | tr ',' '|')
shift 2;;
--prefix)
prefix=$2
shift 2;;
-*)
echo "$1: unknown option" >&2
usage;;
*)
break;;
esac
done
if [ $# -ne 2 ]; then
usage
fi
infile="$1"
outfile="$2"
guard=_ASM_$(basename "$outfile" |
sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
-e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g')
grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$infile" | sort -n | {
echo "#ifndef $guard"
echo "#define $guard"
echo
max=0
while read nr abi name native compat ; do
max=$nr
done
echo "#define __NR_${prefix}syscalls $(($max + 1))"
echo
echo "#endif /* $guard */"
} > "$outfile"
...@@ -52,10 +52,15 @@ outfile="$2" ...@@ -52,10 +52,15 @@ outfile="$2"
nxt=0 nxt=0
grep -E "^[0-9]+[[:space:]]+$abis" "$infile" | sort -n | { grep -E "^[0-9]+[[:space:]]+$abis" "$infile" | {
while read nr abi name native compat ; do while read nr abi name native compat ; do
if [ $nxt -gt $nr ]; then
echo "error: $infile: syscall table is not sorted or duplicates the same syscall number" >&2
exit 1
fi
while [ $nxt -lt $nr ]; do while [ $nxt -lt $nr ]; do
echo "__SYSCALL($nxt, sys_ni_syscall)" echo "__SYSCALL($nxt, sys_ni_syscall)"
nxt=$((nxt + 1)) nxt=$((nxt + 1))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment