Skip to content

Commit

Permalink
Merge tag 'kbuild-v5.16' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/masahiroy/linux-kbuild

Pull Kbuild updates from Masahiro Yamada:

 - Remove the global -isystem compiler flag, which was made possible by
   the introduction of <linux/stdarg.h>

 - Improve the Kconfig help to print the location in the top menu level

 - Fix "FORCE prerequisite is missing" build warning for sparc

 - Add new build targets, tarzst-pkg and perf-tarzst-src-pkg, which
   generate a zstd-compressed tarball

 - Prevent gen_init_cpio tool from generating a corrupted cpio when
   KBUILD_BUILD_TIMESTAMP is set to 2106-02-07 or later

 - Misc cleanups

* tag 'kbuild-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (28 commits)
  kbuild: use more subdir- for visiting subdirectories while cleaning
  sh: remove meaningless archclean line
  initramfs: Check timestamp to prevent broken cpio archive
  kbuild: split DEBUG_CFLAGS out to scripts/Makefile.debug
  gen_init_cpio: add static const qualifiers
  kbuild: Add make tarzst-pkg build option
  scripts: update the comments of kallsyms support
  sparc: Add missing "FORCE" target when using if_changed
  kconfig: refactor conf_touch_dep()
  kconfig: refactor conf_write_dep()
  kconfig: refactor conf_write_autoconf()
  kconfig: add conf_get_autoheader_name()
  kconfig: move sym_escape_string_value() to confdata.c
  kconfig: refactor listnewconfig code
  kconfig: refactor conf_write_symbol()
  kconfig: refactor conf_write_heading()
  kconfig: remove 'const' from the return type of sym_escape_string_value()
  kconfig: rename a variable in the lexer to a clearer name
  kconfig: narrow the scope of variables in the lexer
  kconfig: Create links to main menu items in search
  ...
  • Loading branch information
torvalds committed Nov 8, 2021
2 parents 67b7e1f + 8212f89 commit 1e9ed93
Show file tree
Hide file tree
Showing 62 changed files with 453 additions and 479 deletions.
17 changes: 2 additions & 15 deletions Documentation/kbuild/makefiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1050,22 +1050,9 @@ is not sufficient this sometimes needs to be explicit.
The above assignment instructs kbuild to descend down in the
directory compressed/ when "make clean" is executed.

To support the clean infrastructure in the Makefiles that build the
final bootimage there is an optional target named archclean:

Example::

#arch/x86/Makefile
archclean:
$(Q)$(MAKE) $(clean)=arch/x86/boot

When "make clean" is executed, make will descend down in arch/x86/boot,
and clean as usual. The Makefile located in arch/x86/boot/ may use
the subdir- trick to descend further down.

Note 1: arch/$(SRCARCH)/Makefile cannot use "subdir-", because that file is
included in the top level makefile, and the kbuild infrastructure
is not operational at that point.
included in the top level makefile. Instead, arch/$(SRCARCH)/Kbuild can use
"subdir-".

Note 2: All directories listed in core-y, libs-y, drivers-y and net-y will
be visited during "make clean".
Expand Down
41 changes: 2 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -850,44 +850,6 @@ ifdef CONFIG_ZERO_CALL_USED_REGS
KBUILD_CFLAGS += -fzero-call-used-regs=used-gpr
endif

DEBUG_CFLAGS :=

ifdef CONFIG_DEBUG_INFO

ifdef CONFIG_DEBUG_INFO_SPLIT
DEBUG_CFLAGS += -gsplit-dwarf
else
DEBUG_CFLAGS += -g
endif

ifndef CONFIG_AS_IS_LLVM
KBUILD_AFLAGS += -Wa,-gdwarf-2
endif

ifndef CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4
dwarf-version-$(CONFIG_DEBUG_INFO_DWARF5) := 5
DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y)
endif

ifdef CONFIG_DEBUG_INFO_REDUCED
DEBUG_CFLAGS += -fno-var-tracking
ifdef CONFIG_CC_IS_GCC
DEBUG_CFLAGS += -femit-struct-debug-baseonly
endif
endif

ifdef CONFIG_DEBUG_INFO_COMPRESSED
DEBUG_CFLAGS += -gz=zlib
KBUILD_AFLAGS += -gz=zlib
KBUILD_LDFLAGS += --compress-debug-sections=zlib
endif

endif # CONFIG_DEBUG_INFO

KBUILD_CFLAGS += $(DEBUG_CFLAGS)
export DEBUG_CFLAGS

ifdef CONFIG_FUNCTION_TRACER
ifdef CONFIG_FTRACE_MCOUNT_USE_CC
CC_FLAGS_FTRACE += -mrecord-mcount
Expand Down Expand Up @@ -984,7 +946,7 @@ KBUILD_CFLAGS += -falign-functions=64
endif

# arch Makefile may override CC so keep this after arch Makefile is included
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
NOSTDINC_FLAGS += -nostdinc

# warn about C99 declaration after statement
KBUILD_CFLAGS += -Wdeclaration-after-statement
Expand Down Expand Up @@ -1051,6 +1013,7 @@ KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)

# include additional Makefiles when needed
include-y := scripts/Makefile.extrawarn
include-$(CONFIG_DEBUG_INFO) += scripts/Makefile.debug
include-$(CONFIG_KASAN) += scripts/Makefile.kasan
include-$(CONFIG_KCSAN) += scripts/Makefile.kcsan
include-$(CONFIG_UBSAN) += scripts/Makefile.ubsan
Expand Down
3 changes: 3 additions & 0 deletions arch/alpha/Kbuild
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-y += kernel/ mm/
obj-$(CONFIG_MATHEMU) += math-emu/

# for cleaning
subdir- += boot
3 changes: 0 additions & 3 deletions arch/alpha/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ $(boot)/vmlinux.gz: vmlinux
bootimage bootpfile bootpzfile: vmlinux
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@

archclean:
$(Q)$(MAKE) $(clean)=$(boot)

archheaders:
$(Q)$(MAKE) $(build)=arch/alpha/kernel/syscalls all

Expand Down
3 changes: 3 additions & 0 deletions arch/arc/Kbuild
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
obj-y += kernel/
obj-y += mm/

# for cleaning
subdir- += boot
3 changes: 0 additions & 3 deletions arch/arc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,3 @@ uImage: $(uimage-default-y)
@$(kecho) ' Image $(boot)/uImage is ready'

CLEAN_FILES += $(boot)/uImage

archclean:
$(Q)$(MAKE) $(clean)=$(boot)
3 changes: 3 additions & 0 deletions arch/arm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ obj-y += kernel/ mm/ common/
obj-y += probes/
obj-y += net/
obj-y += crypto/

# for cleaning
subdir- += boot
4 changes: 0 additions & 4 deletions arch/arm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,6 @@ ifeq ($(CONFIG_VDSO),y)
$(Q)$(MAKE) $(build)=arch/arm/vdso $@
endif

# We use MRPROPER_FILES and CLEAN_FILES now
archclean:
$(Q)$(MAKE) $(clean)=$(boot)

# My testing targets (bypasses dependencies)
bp:; $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/bootpImage

Expand Down
3 changes: 3 additions & 0 deletions arch/arm64/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ obj-$(CONFIG_KVM) += kvm/
obj-$(CONFIG_XEN) += xen/
obj-$(subst m,y,$(CONFIG_HYPERV)) += hyperv/
obj-$(CONFIG_CRYPTO) += crypto/

# for cleaning
subdir- += boot
7 changes: 0 additions & 7 deletions arch/arm64/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,6 @@ ifeq ($(CONFIG_ARM64_USE_LSE_ATOMICS),y)
endif
endif


# We use MRPROPER_FILES and CLEAN_FILES now
archclean:
$(Q)$(MAKE) $(clean)=$(boot)
$(Q)$(MAKE) $(clean)=arch/arm64/kernel/vdso
$(Q)$(MAKE) $(clean)=arch/arm64/kernel/vdso32

ifeq ($(KBUILD_EXTMOD),)
# We need to generate vdso-offsets.h before compiling certain files in kernel/.
# In order to do that, we should use the archprepare target, but we can't since
Expand Down
3 changes: 3 additions & 0 deletions arch/arm64/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,6 @@ extra-y += $(head-y) vmlinux.lds
ifeq ($(CONFIG_DEBUG_EFI),y)
AFLAGS_head.o += -DVMLINUX_PATH="\"$(realpath $(objtree)/vmlinux)\""
endif

# for cleaning
subdir- += vdso vdso32
2 changes: 2 additions & 0 deletions arch/arm64/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ ifeq ($(CONFIG_KERNEL_MODE_NEON), y)
obj-$(CONFIG_XOR_BLOCKS) += xor-neon.o
CFLAGS_REMOVE_xor-neon.o += -mgeneral-regs-only
CFLAGS_xor-neon.o += -ffreestanding
# Enable <arm_neon.h>
CFLAGS_xor-neon.o += -isystem $(shell $(CC) -print-file-name=include)
endif

lib-$(CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE) += uaccess_flushcache.o
Expand Down
3 changes: 3 additions & 0 deletions arch/csky/Kbuild
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only

# for cleaning
subdir- += boot
3 changes: 0 additions & 3 deletions arch/csky/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ all: zImage
zImage Image uImage: vmlinux
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@

archclean:
$(Q)$(MAKE) $(clean)=$(boot)

define archhelp
echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
Expand Down
3 changes: 3 additions & 0 deletions arch/h8300/Kbuild
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-y += kernel/ mm/ boot/dts/

# for cleaning
subdir- += boot
3 changes: 0 additions & 3 deletions arch/h8300/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ libs-y += arch/$(ARCH)/lib/

boot := arch/h8300/boot

archclean:
$(Q)$(MAKE) $(clean)=$(boot)

vmlinux.srec vmlinux.bin zImage uImage.bin: vmlinux
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@

Expand Down
2 changes: 0 additions & 2 deletions arch/ia64/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ vmlinux.bin: vmlinux FORCE
unwcheck: vmlinux
-$(Q)READELF=$(READELF) $(PYTHON3) $(srctree)/arch/ia64/scripts/unwcheck.py $<

archclean:

archheaders:
$(Q)$(MAKE) $(build)=arch/ia64/kernel/syscalls all

Expand Down
4 changes: 1 addition & 3 deletions arch/m68k/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
# m68k/Makefile
#
# This file is included by the global makefile so that you can add your own
# architecture-specific flags and dependencies. Remember to do have actions
# for "archclean" and "archdep" for cleaning up and making dependencies for
# this architecture
# architecture-specific flags and dependencies.
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
Expand Down
3 changes: 3 additions & 0 deletions arch/microblaze/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ obj-y += kernel/
obj-y += mm/
obj-$(CONFIG_PCI) += pci/
obj-y += boot/dts/

# for cleaning
subdir- += boot
3 changes: 0 additions & 3 deletions arch/microblaze/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ export DTB

all: linux.bin

archclean:
$(Q)$(MAKE) $(clean)=$(boot)

archheaders:
$(Q)$(MAKE) $(build)=arch/microblaze/kernel/syscalls all

Expand Down
3 changes: 3 additions & 0 deletions arch/mips/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ obj-y += vdso/
ifdef CONFIG_KVM
obj-y += kvm/
endif

# for cleaning
subdir- += boot
8 changes: 1 addition & 7 deletions arch/mips/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
# Copyright (C) 2002, 2003, 2004 Maciej W. Rozycki
#
# This file is included by the global makefile so that you can add your own
# architecture-specific flags and dependencies. Remember to do have actions
# for "archclean" cleaning up for this architecture.
# architecture-specific flags and dependencies.
#

archscripts: scripts_basic
Expand Down Expand Up @@ -426,11 +425,6 @@ endif
$(Q)install -D -m 644 .config $(INSTALL_PATH)/config-$(KERNELRELEASE)
$(Q)install -D -m 644 System.map $(INSTALL_PATH)/System.map-$(KERNELRELEASE)

archclean:
$(Q)$(MAKE) $(clean)=arch/mips/boot
$(Q)$(MAKE) $(clean)=arch/mips/boot/compressed
$(Q)$(MAKE) $(clean)=arch/mips/boot/tools

archheaders:
$(Q)$(MAKE) $(build)=arch/mips/kernel/syscalls all

Expand Down
3 changes: 3 additions & 0 deletions arch/mips/boot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,6 @@ $(obj)/vmlinux.itb: $(obj)/vmlinux.its $(obj)/vmlinux.bin FORCE

$(obj)/vmlinux.%.itb: $(obj)/vmlinux.%.its $(obj)/vmlinux.bin.% FORCE
$(call if_changed,itb-image,$<)

# for cleaning
subdir- += compressed tools
3 changes: 3 additions & 0 deletions arch/nds32/Kbuild
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only

# for cleaning
subdir- += boot
5 changes: 2 additions & 3 deletions arch/nds32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ endif
# Avoid generating FPU instructions
arch-y += -mno-ext-fpu-sp -mno-ext-fpu-dp -mfloat-abi=soft

# Enable <nds32_intrinsic.h>
KBUILD_CFLAGS += -isystem $(shell $(CC) -print-file-name=include)
KBUILD_CFLAGS += $(call cc-option, -mno-sched-prolog-epilog)
KBUILD_CFLAGS += -mcmodel=large

Expand Down Expand Up @@ -62,9 +64,6 @@ prepare: vdso_prepare
vdso_prepare: prepare0
$(Q)$(MAKE) $(build)=arch/nds32/kernel/vdso include/generated/vdso-offsets.h

archclean:
$(Q)$(MAKE) $(clean)=$(boot)

define archhelp
echo ' Image - kernel image (arch/$(ARCH)/boot/Image)'
endef
3 changes: 3 additions & 0 deletions arch/nios2/Kbuild
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only

# for cleaning
subdir- += boot
9 changes: 3 additions & 6 deletions arch/nios2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
# Written by Fredrik Markstrom
#
# This file is included by the global makefile so that you can add your own
# architecture-specific flags and dependencies. Remember to do have actions
# for "archclean" cleaning up for this architecture.
# architecture-specific flags and dependencies.
#
# Nios2 port by Wind River Systems Inc trough:
# [email protected] and [email protected]
Expand Down Expand Up @@ -53,14 +52,12 @@ core-y += $(nios2-boot)/dts/

all: vmImage

archclean:
$(Q)$(MAKE) $(clean)=$(nios2-boot)

$(BOOT_TARGETS): vmlinux
$(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@

install:
$(Q)$(MAKE) $(build)=$(nios2-boot) BOOTIMAGE=$(KBUILD_IMAGE) install
sh $(srctree)/$(nios2-boot)/install.sh $(KERNELRELEASE) \
$(KBUILD_IMAGE) System.map "$(INSTALL_PATH)"

define archhelp
echo '* vmImage - Kernel-only image for U-Boot ($(KBUILD_IMAGE))'
Expand Down
3 changes: 0 additions & 3 deletions arch/nios2/boot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,3 @@ $(obj)/zImage: $(obj)/compressed/vmlinux FORCE

$(obj)/compressed/vmlinux: $(obj)/vmlinux.gz FORCE
$(Q)$(MAKE) $(build)=$(obj)/compressed $@

install:
sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
3 changes: 3 additions & 0 deletions arch/openrisc/Kbuild
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
obj-y += lib/ kernel/ mm/
obj-y += boot/dts/

# for cleaning
subdir- += boot
7 changes: 1 addition & 6 deletions arch/openrisc/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# BK Id: %F% %I% %G% %U% %#%
#
# This file is included by the global makefile so that you can add your own
# architecture-specific flags and dependencies. Remember to do have actions
# for "archclean" and "archdep" for cleaning up and making dependencies for
# this architecture
# architecture-specific flags and dependencies.
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
Expand Down Expand Up @@ -48,6 +46,3 @@ PHONY += vmlinux.bin

vmlinux.bin: vmlinux
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@

archclean:
$(Q)$(MAKE) $(clean)=$(boot)
3 changes: 3 additions & 0 deletions arch/parisc/Kbuild
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-y += mm/ kernel/ math-emu/

# for cleaning
subdir- += boot
7 changes: 1 addition & 6 deletions arch/parisc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
# parisc/Makefile
#
# This file is included by the global makefile so that you can add your own
# architecture-specific flags and dependencies. Remember to do have actions
# for "archclean" and "archdep" for cleaning up and making dependencies for
# this architecture
# architecture-specific flags and dependencies.
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
Expand Down Expand Up @@ -181,8 +179,5 @@ define archhelp
@echo ' zinstall - Install compressed vmlinuz kernel'
endef

archclean:
$(Q)$(MAKE) $(clean)=$(boot)

archheaders:
$(Q)$(MAKE) $(build)=arch/parisc/kernel/syscalls all
3 changes: 3 additions & 0 deletions arch/powerpc/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ obj-$(CONFIG_KVM) += kvm/
obj-$(CONFIG_PERF_EVENTS) += perf/
obj-$(CONFIG_KEXEC_CORE) += kexec/
obj-$(CONFIG_KEXEC_FILE) += purgatory/

# for cleaning
subdir- += boot
Loading

0 comments on commit 1e9ed93

Please sign in to comment.