Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'kbuild-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/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
...

+470 -496
+2 -15
Documentation/kbuild/makefiles.rst
··· 1050 1050 The above assignment instructs kbuild to descend down in the 1051 1051 directory compressed/ when "make clean" is executed. 1052 1052 1053 - To support the clean infrastructure in the Makefiles that build the 1054 - final bootimage there is an optional target named archclean: 1055 - 1056 - Example:: 1057 - 1058 - #arch/x86/Makefile 1059 - archclean: 1060 - $(Q)$(MAKE) $(clean)=arch/x86/boot 1061 - 1062 - When "make clean" is executed, make will descend down in arch/x86/boot, 1063 - and clean as usual. The Makefile located in arch/x86/boot/ may use 1064 - the subdir- trick to descend further down. 1065 - 1066 1053 Note 1: arch/$(SRCARCH)/Makefile cannot use "subdir-", because that file is 1067 - included in the top level makefile, and the kbuild infrastructure 1068 - is not operational at that point. 1054 + included in the top level makefile. Instead, arch/$(SRCARCH)/Kbuild can use 1055 + "subdir-". 1069 1056 1070 1057 Note 2: All directories listed in core-y, libs-y, drivers-y and net-y will 1071 1058 be visited during "make clean".
+2 -39
Makefile
··· 850 850 KBUILD_CFLAGS += -fzero-call-used-regs=used-gpr 851 851 endif 852 852 853 - DEBUG_CFLAGS := 854 - 855 - ifdef CONFIG_DEBUG_INFO 856 - 857 - ifdef CONFIG_DEBUG_INFO_SPLIT 858 - DEBUG_CFLAGS += -gsplit-dwarf 859 - else 860 - DEBUG_CFLAGS += -g 861 - endif 862 - 863 - ifndef CONFIG_AS_IS_LLVM 864 - KBUILD_AFLAGS += -Wa,-gdwarf-2 865 - endif 866 - 867 - ifndef CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT 868 - dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4 869 - dwarf-version-$(CONFIG_DEBUG_INFO_DWARF5) := 5 870 - DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y) 871 - endif 872 - 873 - ifdef CONFIG_DEBUG_INFO_REDUCED 874 - DEBUG_CFLAGS += -fno-var-tracking 875 - ifdef CONFIG_CC_IS_GCC 876 - DEBUG_CFLAGS += -femit-struct-debug-baseonly 877 - endif 878 - endif 879 - 880 - ifdef CONFIG_DEBUG_INFO_COMPRESSED 881 - DEBUG_CFLAGS += -gz=zlib 882 - KBUILD_AFLAGS += -gz=zlib 883 - KBUILD_LDFLAGS += --compress-debug-sections=zlib 884 - endif 885 - 886 - endif # CONFIG_DEBUG_INFO 887 - 888 - KBUILD_CFLAGS += $(DEBUG_CFLAGS) 889 - export DEBUG_CFLAGS 890 - 891 853 ifdef CONFIG_FUNCTION_TRACER 892 854 ifdef CONFIG_FTRACE_MCOUNT_USE_CC 893 855 CC_FLAGS_FTRACE += -mrecord-mcount ··· 946 984 endif 947 985 948 986 # arch Makefile may override CC so keep this after arch Makefile is included 949 - NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) 987 + NOSTDINC_FLAGS += -nostdinc 950 988 951 989 # warn about C99 declaration after statement 952 990 KBUILD_CFLAGS += -Wdeclaration-after-statement ··· 1013 1051 1014 1052 # include additional Makefiles when needed 1015 1053 include-y := scripts/Makefile.extrawarn 1054 + include-$(CONFIG_DEBUG_INFO) += scripts/Makefile.debug 1016 1055 include-$(CONFIG_KASAN) += scripts/Makefile.kasan 1017 1056 include-$(CONFIG_KCSAN) += scripts/Makefile.kcsan 1018 1057 include-$(CONFIG_UBSAN) += scripts/Makefile.ubsan
+3
arch/alpha/Kbuild
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 obj-y += kernel/ mm/ 3 3 obj-$(CONFIG_MATHEMU) += math-emu/ 4 + 5 + # for cleaning 6 + subdir- += boot
-3
arch/alpha/Makefile
··· 55 55 bootimage bootpfile bootpzfile: vmlinux 56 56 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 57 57 58 - archclean: 59 - $(Q)$(MAKE) $(clean)=$(boot) 60 - 61 58 archheaders: 62 59 $(Q)$(MAKE) $(build)=arch/alpha/kernel/syscalls all 63 60
+3
arch/arc/Kbuild
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 obj-y += kernel/ 3 3 obj-y += mm/ 4 + 5 + # for cleaning 6 + subdir- += boot
-3
arch/arc/Makefile
··· 112 112 @$(kecho) ' Image $(boot)/uImage is ready' 113 113 114 114 CLEAN_FILES += $(boot)/uImage 115 - 116 - archclean: 117 - $(Q)$(MAKE) $(clean)=$(boot)
+3
arch/arm/Kbuild
··· 9 9 obj-y += probes/ 10 10 obj-y += net/ 11 11 obj-y += crypto/ 12 + 13 + # for cleaning 14 + subdir- += boot
-4
arch/arm/Makefile
··· 318 318 $(Q)$(MAKE) $(build)=arch/arm/vdso $@ 319 319 endif 320 320 321 - # We use MRPROPER_FILES and CLEAN_FILES now 322 - archclean: 323 - $(Q)$(MAKE) $(clean)=$(boot) 324 - 325 321 # My testing targets (bypasses dependencies) 326 322 bp:; $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/bootpImage 327 323
+3
arch/arm64/Kbuild
··· 4 4 obj-$(CONFIG_XEN) += xen/ 5 5 obj-$(subst m,y,$(CONFIG_HYPERV)) += hyperv/ 6 6 obj-$(CONFIG_CRYPTO) += crypto/ 7 + 8 + # for cleaning 9 + subdir- += boot
-7
arch/arm64/Makefile
··· 182 182 endif 183 183 endif 184 184 185 - 186 - # We use MRPROPER_FILES and CLEAN_FILES now 187 - archclean: 188 - $(Q)$(MAKE) $(clean)=$(boot) 189 - $(Q)$(MAKE) $(clean)=arch/arm64/kernel/vdso 190 - $(Q)$(MAKE) $(clean)=arch/arm64/kernel/vdso32 191 - 192 185 ifeq ($(KBUILD_EXTMOD),) 193 186 # We need to generate vdso-offsets.h before compiling certain files in kernel/. 194 187 # In order to do that, we should use the archprepare target, but we can't since
+3
arch/arm64/kernel/Makefile
··· 81 81 ifeq ($(CONFIG_DEBUG_EFI),y) 82 82 AFLAGS_head.o += -DVMLINUX_PATH="\"$(realpath $(objtree)/vmlinux)\"" 83 83 endif 84 + 85 + # for cleaning 86 + subdir- += vdso vdso32
+2
arch/arm64/lib/Makefile
··· 9 9 obj-$(CONFIG_XOR_BLOCKS) += xor-neon.o 10 10 CFLAGS_REMOVE_xor-neon.o += -mgeneral-regs-only 11 11 CFLAGS_xor-neon.o += -ffreestanding 12 + # Enable <arm_neon.h> 13 + CFLAGS_xor-neon.o += -isystem $(shell $(CC) -print-file-name=include) 12 14 endif 13 15 14 16 lib-$(CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE) += uaccess_flushcache.o
+3
arch/csky/Kbuild
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 + 3 + # for cleaning 4 + subdir- += boot
-3
arch/csky/Makefile
··· 76 76 zImage Image uImage: vmlinux 77 77 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 78 78 79 - archclean: 80 - $(Q)$(MAKE) $(clean)=$(boot) 81 - 82 79 define archhelp 83 80 echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)' 84 81 echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
+3
arch/h8300/Kbuild
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 obj-y += kernel/ mm/ boot/dts/ 3 + 4 + # for cleaning 5 + subdir- += boot
-3
arch/h8300/Makefile
··· 34 34 35 35 boot := arch/h8300/boot 36 36 37 - archclean: 38 - $(Q)$(MAKE) $(clean)=$(boot) 39 - 40 37 vmlinux.srec vmlinux.bin zImage uImage.bin: vmlinux 41 38 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 42 39
-2
arch/ia64/Makefile
··· 67 67 unwcheck: vmlinux 68 68 -$(Q)READELF=$(READELF) $(PYTHON3) $(srctree)/arch/ia64/scripts/unwcheck.py $< 69 69 70 - archclean: 71 - 72 70 archheaders: 73 71 $(Q)$(MAKE) $(build)=arch/ia64/kernel/syscalls all 74 72
+1 -3
arch/m68k/Makefile
··· 2 2 # m68k/Makefile 3 3 # 4 4 # This file is included by the global makefile so that you can add your own 5 - # architecture-specific flags and dependencies. Remember to do have actions 6 - # for "archclean" and "archdep" for cleaning up and making dependencies for 7 - # this architecture 5 + # architecture-specific flags and dependencies. 8 6 # 9 7 # This file is subject to the terms and conditions of the GNU General Public 10 8 # License. See the file "COPYING" in the main directory of this archive
+3
arch/microblaze/Kbuild
··· 3 3 obj-y += mm/ 4 4 obj-$(CONFIG_PCI) += pci/ 5 5 obj-y += boot/dts/ 6 + 7 + # for cleaning 8 + subdir- += boot
-3
arch/microblaze/Makefile
··· 60 60 61 61 all: linux.bin 62 62 63 - archclean: 64 - $(Q)$(MAKE) $(clean)=$(boot) 65 - 66 63 archheaders: 67 64 $(Q)$(MAKE) $(build)=arch/microblaze/kernel/syscalls all 68 65
+3
arch/mips/Kbuild
··· 25 25 ifdef CONFIG_KVM 26 26 obj-y += kvm/ 27 27 endif 28 + 29 + # for cleaning 30 + subdir- += boot
+1 -7
arch/mips/Makefile
··· 8 8 # Copyright (C) 2002, 2003, 2004 Maciej W. Rozycki 9 9 # 10 10 # This file is included by the global makefile so that you can add your own 11 - # architecture-specific flags and dependencies. Remember to do have actions 12 - # for "archclean" cleaning up for this architecture. 11 + # architecture-specific flags and dependencies. 13 12 # 14 13 15 14 archscripts: scripts_basic ··· 424 425 endif 425 426 $(Q)install -D -m 644 .config $(INSTALL_PATH)/config-$(KERNELRELEASE) 426 427 $(Q)install -D -m 644 System.map $(INSTALL_PATH)/System.map-$(KERNELRELEASE) 427 - 428 - archclean: 429 - $(Q)$(MAKE) $(clean)=arch/mips/boot 430 - $(Q)$(MAKE) $(clean)=arch/mips/boot/compressed 431 - $(Q)$(MAKE) $(clean)=arch/mips/boot/tools 432 428 433 429 archheaders: 434 430 $(Q)$(MAKE) $(build)=arch/mips/kernel/syscalls all
+3
arch/mips/boot/Makefile
··· 171 171 172 172 $(obj)/vmlinux.%.itb: $(obj)/vmlinux.%.its $(obj)/vmlinux.bin.% FORCE 173 173 $(call if_changed,itb-image,$<) 174 + 175 + # for cleaning 176 + subdir- += compressed tools
+3
arch/nds32/Kbuild
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 + 3 + # for cleaning 4 + subdir- += boot
+2 -3
arch/nds32/Makefile
··· 9 9 # Avoid generating FPU instructions 10 10 arch-y += -mno-ext-fpu-sp -mno-ext-fpu-dp -mfloat-abi=soft 11 11 12 + # Enable <nds32_intrinsic.h> 13 + KBUILD_CFLAGS += -isystem $(shell $(CC) -print-file-name=include) 12 14 KBUILD_CFLAGS += $(call cc-option, -mno-sched-prolog-epilog) 13 15 KBUILD_CFLAGS += -mcmodel=large 14 16 ··· 63 61 prepare: vdso_prepare 64 62 vdso_prepare: prepare0 65 63 $(Q)$(MAKE) $(build)=arch/nds32/kernel/vdso include/generated/vdso-offsets.h 66 - 67 - archclean: 68 - $(Q)$(MAKE) $(clean)=$(boot) 69 64 70 65 define archhelp 71 66 echo ' Image - kernel image (arch/$(ARCH)/boot/Image)'
+3
arch/nios2/Kbuild
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 + 3 + # for cleaning 4 + subdir- += boot
+3 -6
arch/nios2/Makefile
··· 8 8 # Written by Fredrik Markstrom 9 9 # 10 10 # This file is included by the global makefile so that you can add your own 11 - # architecture-specific flags and dependencies. Remember to do have actions 12 - # for "archclean" cleaning up for this architecture. 11 + # architecture-specific flags and dependencies. 13 12 # 14 13 # Nios2 port by Wind River Systems Inc trough: 15 14 # fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com ··· 52 53 53 54 all: vmImage 54 55 55 - archclean: 56 - $(Q)$(MAKE) $(clean)=$(nios2-boot) 57 - 58 56 $(BOOT_TARGETS): vmlinux 59 57 $(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@ 60 58 61 59 install: 62 - $(Q)$(MAKE) $(build)=$(nios2-boot) BOOTIMAGE=$(KBUILD_IMAGE) install 60 + sh $(srctree)/$(nios2-boot)/install.sh $(KERNELRELEASE) \ 61 + $(KBUILD_IMAGE) System.map "$(INSTALL_PATH)" 63 62 64 63 define archhelp 65 64 echo '* vmImage - Kernel-only image for U-Boot ($(KBUILD_IMAGE))'
-3
arch/nios2/boot/Makefile
··· 30 30 31 31 $(obj)/compressed/vmlinux: $(obj)/vmlinux.gz FORCE 32 32 $(Q)$(MAKE) $(build)=$(obj)/compressed $@ 33 - 34 - install: 35 - sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
+3
arch/openrisc/Kbuild
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 obj-y += lib/ kernel/ mm/ 3 3 obj-y += boot/dts/ 4 + 5 + # for cleaning 6 + subdir- += boot
+1 -6
arch/openrisc/Makefile
··· 1 1 # BK Id: %F% %I% %G% %U% %#% 2 2 # 3 3 # This file is included by the global makefile so that you can add your own 4 - # architecture-specific flags and dependencies. Remember to do have actions 5 - # for "archclean" and "archdep" for cleaning up and making dependencies for 6 - # this architecture 4 + # architecture-specific flags and dependencies. 7 5 # 8 6 # This file is subject to the terms and conditions of the GNU General Public 9 7 # License. See the file "COPYING" in the main directory of this archive ··· 46 48 47 49 vmlinux.bin: vmlinux 48 50 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 49 - 50 - archclean: 51 - $(Q)$(MAKE) $(clean)=$(boot)
+3
arch/parisc/Kbuild
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 obj-y += mm/ kernel/ math-emu/ 3 + 4 + # for cleaning 5 + subdir- += boot
+1 -6
arch/parisc/Makefile
··· 2 2 # parisc/Makefile 3 3 # 4 4 # This file is included by the global makefile so that you can add your own 5 - # architecture-specific flags and dependencies. Remember to do have actions 6 - # for "archclean" and "archdep" for cleaning up and making dependencies for 7 - # this architecture 5 + # architecture-specific flags and dependencies. 8 6 # 9 7 # This file is subject to the terms and conditions of the GNU General Public 10 8 # License. See the file "COPYING" in the main directory of this archive ··· 178 180 @echo ' copy to $$(INSTALL_PATH)' 179 181 @echo ' zinstall - Install compressed vmlinuz kernel' 180 182 endef 181 - 182 - archclean: 183 - $(Q)$(MAKE) $(clean)=$(boot) 184 183 185 184 archheaders: 186 185 $(Q)$(MAKE) $(build)=arch/parisc/kernel/syscalls all
+3
arch/powerpc/Kbuild
··· 16 16 obj-$(CONFIG_PERF_EVENTS) += perf/ 17 17 obj-$(CONFIG_KEXEC_CORE) += kexec/ 18 18 obj-$(CONFIG_KEXEC_FILE) += purgatory/ 19 + 20 + # for cleaning 21 + subdir- += boot
+1 -6
arch/powerpc/Makefile
··· 1 1 # This file is included by the global makefile so that you can add your own 2 - # architecture-specific flags and dependencies. Remember to do have actions 3 - # for "archclean" and "archdep" for cleaning up and making dependencies for 4 - # this architecture. 2 + # architecture-specific flags and dependencies. 5 3 # 6 4 # This file is subject to the terms and conditions of the GNU General Public 7 5 # License. See the file "COPYING" in the main directory of this archive ··· 408 410 install: 409 411 sh -x $(srctree)/$(boot)/install.sh "$(KERNELRELEASE)" vmlinux \ 410 412 System.map "$(INSTALL_PATH)" 411 - 412 - archclean: 413 - $(Q)$(MAKE) $(clean)=$(boot) 414 413 415 414 ifeq ($(KBUILD_EXTMOD),) 416 415 # We need to generate vdso-offsets.h before compiling certain files in kernel/.
+2
arch/powerpc/lib/Makefile
··· 65 65 66 66 obj-$(CONFIG_ALTIVEC) += xor_vmx.o xor_vmx_glue.o 67 67 CFLAGS_xor_vmx.o += -maltivec $(call cc-option,-mabi=altivec) 68 + # Enable <altivec.h> 69 + CFLAGS_xor_vmx.o += -isystem $(shell $(CC) -print-file-name=include) 68 70 69 71 obj-$(CONFIG_PPC64) += $(obj64-y)
+3
arch/riscv/Kbuild
··· 2 2 3 3 obj-y += kernel/ mm/ net/ 4 4 obj-$(CONFIG_BUILTIN_DTB) += boot/dts/ 5 + 6 + # for cleaning 7 + subdir- += boot
+1 -6
arch/riscv/Makefile
··· 1 1 # This file is included by the global makefile so that you can add your own 2 - # architecture-specific flags and dependencies. Remember to do have actions 3 - # for "archclean" and "archdep" for cleaning up and making dependencies for 4 - # this architecture 2 + # architecture-specific flags and dependencies. 5 3 # 6 4 # This file is subject to the terms and conditions of the GNU General Public 7 5 # License. See the file "COPYING" in the main directory of this archive ··· 136 138 install zinstall: 137 139 $(CONFIG_SHELL) $(srctree)/$(boot)/install.sh $(KERNELRELEASE) \ 138 140 $(boot)/$(install-image) System.map "$(INSTALL_PATH)" 139 - 140 - archclean: 141 - $(Q)$(MAKE) $(clean)=$(boot)
+3
arch/s390/Kbuild
··· 8 8 obj-y += net/ 9 9 obj-$(CONFIG_PCI) += pci/ 10 10 obj-$(CONFIG_ARCH_HAS_KEXEC_PURGATORY) += purgatory/ 11 + 12 + # for cleaning 13 + subdir- += boot tools
+1 -7
arch/s390/Makefile
··· 3 3 # s390/Makefile 4 4 # 5 5 # This file is included by the global makefile so that you can add your own 6 - # architecture-specific flags and dependencies. Remember to do have actions 7 - # for "archclean" and "archdep" for cleaning up and making dependencies for 8 - # this architecture 6 + # architecture-specific flags and dependencies. 9 7 # 10 8 # Copyright (C) 1994 by Linus Torvalds 11 9 # ··· 144 146 145 147 vdso_install: 146 148 $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@ 147 - 148 - archclean: 149 - $(Q)$(MAKE) $(clean)=$(boot) 150 - $(Q)$(MAKE) $(clean)=$(tools) 151 149 152 150 archheaders: 153 151 $(Q)$(MAKE) $(build)=$(syscalls) uapi
+3
arch/sh/Kbuild
··· 2 2 obj-y += kernel/ mm/ boards/ 3 3 obj-$(CONFIG_SH_FPU_EMU) += math-emu/ 4 4 obj-$(CONFIG_USE_BUILTIN_DTB) += boot/dts/ 5 + 6 + # for cleaning 7 + subdir- += boot
-4
arch/sh/Makefile
··· 198 198 archprepare: 199 199 $(Q)$(MAKE) $(build)=arch/sh/tools include/generated/machtypes.h 200 200 201 - archclean: 202 - $(Q)$(MAKE) $(clean)=$(boot) 203 - $(Q)$(MAKE) $(clean)=arch/sh/kernel/vsyscall 204 - 205 201 archheaders: 206 202 $(Q)$(MAKE) $(build)=arch/sh/kernel/syscalls all 207 203
+3
arch/sparc/Kbuild
··· 9 9 obj-y += net/ 10 10 obj-y += crypto/ 11 11 obj-$(CONFIG_SPARC64) += vdso/ 12 + 13 + # for cleaning 14 + subdir- += boot
-3
arch/sparc/Makefile
··· 75 75 sh $(srctree)/$(boot)/install.sh $(KERNELRELEASE) $(KBUILD_IMAGE) \ 76 76 System.map "$(INSTALL_PATH)" 77 77 78 - archclean: 79 - $(Q)$(MAKE) $(clean)=$(boot) 80 - 81 78 archheaders: 82 79 $(Q)$(MAKE) $(build)=arch/sparc/kernel/syscalls all 83 80
+4 -4
arch/sparc/boot/Makefile
··· 22 22 23 23 # Actual linking 24 24 25 - $(obj)/zImage: $(obj)/image 25 + $(obj)/zImage: $(obj)/image FORCE 26 26 $(call if_changed,gzip) 27 27 @echo ' kernel: $@ is ready' 28 28 ··· 31 31 @echo ' kernel: $@ is ready' 32 32 else 33 33 34 - $(obj)/zImage: $(obj)/image 34 + $(obj)/zImage: $(obj)/image FORCE 35 35 $(call if_changed,strip) 36 36 @echo ' kernel: $@ is ready' 37 37 ··· 44 44 $(obj)/image.bin: $(obj)/image FORCE 45 45 $(call if_changed,objcopy) 46 46 47 - $(obj)/image.gz: $(obj)/image.bin 47 + $(obj)/image.gz: $(obj)/image.bin FORCE 48 48 $(call if_changed,gzip) 49 49 50 50 UIMAGE_LOADADDR = $(CONFIG_UBOOT_LOAD_ADDR) ··· 56 56 -r -b binary $@ -o $@.o 57 57 58 58 targets += uImage 59 - $(obj)/uImage: $(obj)/image.gz 59 + $(obj)/uImage: $(obj)/image.gz FORCE 60 60 $(call if_changed,uimage) 61 61 $(call if_changed,uimage.o) 62 62 @echo ' Image $@ is ready'
+3
arch/x86/Kbuild
··· 25 25 obj-y += net/ 26 26 27 27 obj-$(CONFIG_KEXEC_FILE) += purgatory/ 28 + 29 + # for cleaning 30 + subdir- += boot tools
-2
arch/x86/Makefile
··· 283 283 archclean: 284 284 $(Q)rm -rf $(objtree)/arch/i386 285 285 $(Q)rm -rf $(objtree)/arch/x86_64 286 - $(Q)$(MAKE) $(clean)=$(boot) 287 - $(Q)$(MAKE) $(clean)=arch/x86/tools 288 286 289 287 define archhelp 290 288 echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)'
+1 -3
arch/xtensa/Makefile
··· 7 7 # Copyright (C) 2014 Cadence Design Systems Inc. 8 8 # 9 9 # This file is included by the global makefile so that you can add your own 10 - # architecture-specific flags and dependencies. Remember to do have actions 11 - # for "archclean" and "archdep" for cleaning up and making dependencies for 12 - # this architecture 10 + # architecture-specific flags and dependencies. 13 11 14 12 # Core configuration. 15 13 # (Use VAR=<xtensa_config> to use another default compiler.)
+2
crypto/Makefile
··· 119 119 CFLAGS_REMOVE_aegis128-neon-inner.o += -mgeneral-regs-only 120 120 aegis128-$(CONFIG_CRYPTO_AEGIS128_SIMD) += aegis128-neon.o aegis128-neon-inner.o 121 121 endif 122 + # Enable <arm_neon.h> 123 + CFLAGS_aegis128-neon-inner.o += -isystem $(shell $(CC) -print-file-name=include) 122 124 123 125 obj-$(CONFIG_CRYPTO_PCRYPT) += pcrypt.o 124 126 obj-$(CONFIG_CRYPTO_CRYPTD) += cryptd.o
+4
lib/raid6/Makefile
··· 14 14 15 15 ifeq ($(CONFIG_ALTIVEC),y) 16 16 altivec_flags := -maltivec $(call cc-option,-mabi=altivec) 17 + # Enable <altivec.h> 18 + altivec_flags += -isystem $(shell $(CC) -print-file-name=include) 17 19 18 20 ifdef CONFIG_CC_IS_CLANG 19 21 # clang ppc port does not yet support -maltivec when -msoft-float is ··· 36 34 # ARM/NEON intrinsics in a non C99-compliant environment (such as the kernel) 37 35 ifeq ($(CONFIG_KERNEL_MODE_NEON),y) 38 36 NEON_FLAGS := -ffreestanding 37 + # Enable <arm_neon.h> 38 + NEON_FLAGS += -isystem $(shell $(CC) -print-file-name=include) 39 39 ifeq ($(ARCH),arm) 40 40 NEON_FLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=neon 41 41 endif
+35 -26
scripts/Makefile.build
··· 155 155 # (See cmd_cc_o_c + relevant part of rule_cc_o_c) 156 156 157 157 quiet_cmd_cc_o_c = CC $(quiet_modtag) $@ 158 - cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< 158 + cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< $(cmd_objtool) 159 159 160 160 ifdef CONFIG_MODVERSIONS 161 161 # When module versioning is enabled the following steps are executed: ··· 224 224 endif # CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT 225 225 226 226 ifdef CONFIG_STACK_VALIDATION 227 - ifndef CONFIG_LTO_CLANG 228 227 229 - __objtool_obj := $(objtree)/tools/objtool/objtool 228 + objtool := $(objtree)/tools/objtool/objtool 229 + 230 + objtool_args = \ 231 + $(if $(CONFIG_UNWINDER_ORC),orc generate,check) \ 232 + $(if $(part-of-module), --module) \ 233 + $(if $(CONFIG_FRAME_POINTER),, --no-fp) \ 234 + $(if $(CONFIG_GCOV_KERNEL)$(CONFIG_LTO_CLANG), --no-unreachable)\ 235 + $(if $(CONFIG_RETPOLINE), --retpoline) \ 236 + $(if $(CONFIG_X86_SMAP), --uaccess) \ 237 + $(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL), --mcount) 238 + 239 + cmd_objtool = $(if $(objtool-enabled), ; $(objtool) $(objtool_args) $@) 240 + cmd_gen_objtooldep = $(if $(objtool-enabled), { echo ; echo '$@: $$(wildcard $(objtool))' ; } >> $(dot-target).cmd) 241 + 242 + endif # CONFIG_STACK_VALIDATION 243 + 244 + ifdef CONFIG_LTO_CLANG 245 + 246 + # Skip objtool for LLVM bitcode 247 + $(obj)/%.o: objtool-enabled := 248 + 249 + else 230 250 231 251 # 'OBJECT_FILES_NON_STANDARD := y': skip objtool checking for a directory 232 252 # 'OBJECT_FILES_NON_STANDARD_foo.o := 'y': skip objtool checking for a file 233 253 # 'OBJECT_FILES_NON_STANDARD_foo.o := 'n': override directory skip for a file 234 - cmd_objtool = $(if $(patsubst y%,, \ 235 - $(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n), \ 236 - $(__objtool_obj) $(objtool_args) $@) 237 - objtool_obj = $(if $(patsubst y%,, \ 238 - $(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n), \ 239 - $(__objtool_obj)) 240 254 241 - endif # CONFIG_LTO_CLANG 242 - endif # CONFIG_STACK_VALIDATION 255 + $(obj)/%.o: objtool-enabled = $(if $(filter-out y%, \ 256 + $(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n),y) 243 257 244 - # Rebuild all objects when objtool changes, or is enabled/disabled. 245 - objtool_dep = $(objtool_obj) \ 246 - $(wildcard include/config/ORC_UNWINDER \ 247 - include/config/STACK_VALIDATION) 258 + endif 248 259 249 260 ifdef CONFIG_TRIM_UNUSED_KSYMS 250 261 cmd_gen_ksymdeps = \ ··· 270 259 $(call cmd,gen_ksymdeps) 271 260 $(call cmd,checksrc) 272 261 $(call cmd,checkdoc) 273 - $(call cmd,objtool) 262 + $(call cmd,gen_objtooldep) 274 263 $(call cmd,modversions_c) 275 264 $(call cmd,record_mcount) 276 265 endef ··· 278 267 define rule_as_o_S 279 268 $(call cmd_and_fixdep,as_o_S) 280 269 $(call cmd,gen_ksymdeps) 281 - $(call cmd,objtool) 270 + $(call cmd,gen_objtooldep) 282 271 $(call cmd,modversions_S) 283 272 endef 284 273 285 274 # Built-in and composite module parts 286 - .SECONDEXPANSION: 287 - $(obj)/%.o: $(src)/%.c $(recordmcount_source) $$(objtool_dep) FORCE 275 + $(obj)/%.o: $(src)/%.c $(recordmcount_source) FORCE 288 276 $(call if_changed_rule,cc_o_c) 289 277 $(call cmd,force_checksrc) 290 278 ··· 295 285 $(LD) $(ld_flags) -r -o $@ \ 296 286 $(shell [ -s $(@:.lto.o=.o.symversions) ] && \ 297 287 echo -T $(@:.lto.o=.o.symversions)) \ 298 - --whole-archive $(filter-out FORCE,$^) 288 + --whole-archive $(filter-out FORCE,$^) \ 289 + $(cmd_objtool) 299 290 300 - ifdef CONFIG_STACK_VALIDATION 301 291 # objtool was skipped for LLVM bitcode, run it now that we have compiled 302 292 # modules into native code 303 - cmd_cc_lto_link_modules += ; \ 304 - $(objtree)/tools/objtool/objtool $(objtool_args) --module $@ 305 - endif 293 + $(obj)/%.lto.o: objtool-enabled = y 294 + $(obj)/%.lto.o: part-of-module := y 306 295 307 296 $(obj)/%.lto.o: $(obj)/%.o FORCE 308 297 $(call if_changed,cc_lto_link_modules) ··· 365 356 $(call if_changed_dep,cpp_s_S) 366 357 367 358 quiet_cmd_as_o_S = AS $(quiet_modtag) $@ 368 - cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< 359 + cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< $(cmd_objtool) 369 360 370 361 ifdef CONFIG_ASM_MODVERSIONS 371 362 ··· 384 375 fi 385 376 endif 386 377 387 - $(obj)/%.o: $(src)/%.S $$(objtool_dep) FORCE 378 + $(obj)/%.o: $(src)/%.S FORCE 388 379 $(call if_changed_rule,as_o_S) 389 380 390 381 targets += $(filter-out $(subdir-builtin), $(real-obj-y))
+33
scripts/Makefile.debug
··· 1 + DEBUG_CFLAGS := 2 + 3 + ifdef CONFIG_DEBUG_INFO_SPLIT 4 + DEBUG_CFLAGS += -gsplit-dwarf 5 + else 6 + DEBUG_CFLAGS += -g 7 + endif 8 + 9 + ifndef CONFIG_AS_IS_LLVM 10 + KBUILD_AFLAGS += -Wa,-gdwarf-2 11 + endif 12 + 13 + ifndef CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT 14 + dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4 15 + dwarf-version-$(CONFIG_DEBUG_INFO_DWARF5) := 5 16 + DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y) 17 + endif 18 + 19 + ifdef CONFIG_DEBUG_INFO_REDUCED 20 + DEBUG_CFLAGS += -fno-var-tracking 21 + ifdef CONFIG_CC_IS_GCC 22 + DEBUG_CFLAGS += -femit-struct-debug-baseonly 23 + endif 24 + endif 25 + 26 + ifdef CONFIG_DEBUG_INFO_COMPRESSED 27 + DEBUG_CFLAGS += -gz=zlib 28 + KBUILD_AFLAGS += -gz=zlib 29 + KBUILD_LDFLAGS += --compress-debug-sections=zlib 30 + endif 31 + 32 + KBUILD_CFLAGS += $(DEBUG_CFLAGS) 33 + export DEBUG_CFLAGS
-11
scripts/Makefile.lib
··· 232 232 mod-prelink-ext := .lto 233 233 endif 234 234 235 - # Objtool arguments are also needed for modfinal with LTO, so we define 236 - # then here to avoid duplication. 237 - objtool_args = \ 238 - $(if $(CONFIG_UNWINDER_ORC),orc generate,check) \ 239 - $(if $(part-of-module), --module) \ 240 - $(if $(CONFIG_FRAME_POINTER),, --no-fp) \ 241 - $(if $(CONFIG_GCOV_KERNEL)$(CONFIG_LTO_CLANG), --no-unreachable)\ 242 - $(if $(CONFIG_RETPOLINE), --retpoline) \ 243 - $(if $(CONFIG_X86_SMAP), --uaccess) \ 244 - $(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL), --mcount) 245 - 246 235 # Useful for describing the dependency of composite objects 247 236 # Usage: 248 237 # $(call multi_depend, multi_used_targets, suffix_to_remove, suffix_to_add)
+7 -3
scripts/Makefile.package
··· 103 103 104 104 # tarball targets 105 105 # --------------------------------------------------------------------------- 106 - tar-pkgs := dir-pkg tar-pkg targz-pkg tarbz2-pkg tarxz-pkg 106 + tar-pkgs := dir-pkg tar-pkg targz-pkg tarbz2-pkg tarxz-pkg tarzst-pkg 107 107 PHONY += $(tar-pkgs) 108 108 $(tar-pkgs): 109 109 $(MAKE) -f $(srctree)/Makefile ··· 130 130 $(if $(findstring bz2,$@),$(KBZIP2), \ 131 131 $(if $(findstring gz,$@),$(KGZIP), \ 132 132 $(if $(findstring xz,$@),$(XZ), \ 133 - $(error unknown target $@)))) \ 133 + $(if $(findstring zst,$@),$(ZSTD), \ 134 + $(error unknown target $@))))) \ 134 135 -f -9 $(perf-tar).tar) 135 136 136 - perf-tar-pkgs := perf-tar-src-pkg perf-targz-src-pkg perf-tarbz2-src-pkg perf-tarxz-src-pkg 137 + perf-tar-pkgs := perf-tar-src-pkg perf-targz-src-pkg perf-tarbz2-src-pkg \ 138 + perf-tarxz-src-pkg perf-tarzst-src-pkg 137 139 PHONY += $(perf-tar-pkgs) 138 140 $(perf-tar-pkgs): 139 141 $(call cmd,perf_tar) ··· 155 153 @echo ' targz-pkg - Build the kernel as a gzip compressed tarball' 156 154 @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball' 157 155 @echo ' tarxz-pkg - Build the kernel as a xz compressed tarball' 156 + @echo ' tarzst-pkg - Build the kernel as a zstd compressed tarball' 158 157 @echo ' perf-tar-src-pkg - Build $(perf-tar).tar source tarball' 159 158 @echo ' perf-targz-src-pkg - Build $(perf-tar).tar.gz source tarball' 160 159 @echo ' perf-tarbz2-src-pkg - Build $(perf-tar).tar.bz2 source tarball' 161 160 @echo ' perf-tarxz-src-pkg - Build $(perf-tar).tar.xz source tarball' 161 + @echo ' perf-tarzst-src-pkg - Build $(perf-tar).tar.zst source tarball' 162 162 163 163 .PHONY: $(PHONY)
+2 -13
scripts/kconfig/conf.c
··· 646 646 647 647 switch (input_mode) { 648 648 case listnewconfig: 649 - if (sym->name) { 650 - const char *str; 651 - 652 - if (sym->type == S_STRING) { 653 - str = sym_get_string_value(sym); 654 - str = sym_escape_string_value(str); 655 - printf("%s%s=%s\n", CONFIG_, sym->name, str); 656 - free((void *)str); 657 - } else { 658 - str = sym_get_string_value(sym); 659 - printf("%s%s=%s\n", CONFIG_, sym->name, str); 660 - } 661 - } 649 + if (sym->name) 650 + print_symbol_for_listconfig(sym); 662 651 break; 663 652 case helpnewconfig: 664 653 printf("-----\n");
+253 -224
scripts/kconfig/confdata.c
··· 11 11 #include <fcntl.h> 12 12 #include <limits.h> 13 13 #include <stdarg.h> 14 + #include <stdbool.h> 14 15 #include <stdio.h> 15 16 #include <stdlib.h> 16 17 #include <string.h> ··· 130 129 /* touch depfile for symbol 'name' */ 131 130 static int conf_touch_dep(const char *name) 132 131 { 133 - int fd, ret; 134 - char *d; 132 + int fd; 135 133 136 134 /* check overflow: prefix + name + '\0' must fit in buffer. */ 137 135 if (depfile_prefix_len + strlen(name) + 1 > sizeof(depfile_path)) 138 136 return -1; 139 137 140 - d = depfile_path + depfile_prefix_len; 141 - strcpy(d, name); 138 + strcpy(depfile_path + depfile_prefix_len, name); 142 139 143 - /* Assume directory path already exists. */ 144 140 fd = open(depfile_path, O_WRONLY | O_CREAT | O_TRUNC, 0644); 145 - if (fd == -1) { 146 - if (errno != ENOENT) 147 - return -1; 148 - 149 - ret = make_parent_dir(depfile_path); 150 - if (ret) 151 - return ret; 152 - 153 - /* Try it again. */ 154 - fd = open(depfile_path, O_WRONLY | O_CREAT | O_TRUNC, 0644); 155 - if (fd == -1) 156 - return -1; 157 - } 141 + if (fd == -1) 142 + return -1; 158 143 close(fd); 159 144 160 145 return 0; 161 146 } 162 - 163 - struct conf_printer { 164 - void (*print_symbol)(FILE *, struct symbol *, const char *, void *); 165 - void (*print_comment)(FILE *, const char *, void *); 166 - }; 167 147 168 148 static void conf_warning(const char *fmt, ...) 169 149 __attribute__ ((format (printf, 1, 2))); ··· 207 225 char *name = getenv("KCONFIG_AUTOCONFIG"); 208 226 209 227 return name ? name : "include/config/auto.conf"; 228 + } 229 + 230 + static const char *conf_get_autoheader_name(void) 231 + { 232 + char *name = getenv("KCONFIG_AUTOHEADER"); 233 + 234 + return name ? name : "include/generated/autoconf.h"; 210 235 } 211 236 212 237 static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) ··· 583 594 return 0; 584 595 } 585 596 597 + struct comment_style { 598 + const char *decoration; 599 + const char *prefix; 600 + const char *postfix; 601 + }; 602 + 603 + static const struct comment_style comment_style_pound = { 604 + .decoration = "#", 605 + .prefix = "#", 606 + .postfix = "#", 607 + }; 608 + 609 + static const struct comment_style comment_style_c = { 610 + .decoration = " *", 611 + .prefix = "/*", 612 + .postfix = " */", 613 + }; 614 + 615 + static void conf_write_heading(FILE *fp, const struct comment_style *cs) 616 + { 617 + fprintf(fp, "%s\n", cs->prefix); 618 + 619 + fprintf(fp, "%s Automatically generated file; DO NOT EDIT.\n", 620 + cs->decoration); 621 + 622 + fprintf(fp, "%s %s\n", cs->decoration, rootmenu.prompt->text); 623 + 624 + fprintf(fp, "%s\n", cs->postfix); 625 + } 626 + 627 + /* The returned pointer must be freed on the caller side */ 628 + static char *escape_string_value(const char *in) 629 + { 630 + const char *p; 631 + char *out; 632 + size_t len; 633 + 634 + len = strlen(in) + strlen("\"\"") + 1; 635 + 636 + p = in; 637 + while (1) { 638 + p += strcspn(p, "\"\\"); 639 + 640 + if (p[0] == '\0') 641 + break; 642 + 643 + len++; 644 + p++; 645 + } 646 + 647 + out = xmalloc(len); 648 + out[0] = '\0'; 649 + 650 + strcat(out, "\""); 651 + 652 + p = in; 653 + while (1) { 654 + len = strcspn(p, "\"\\"); 655 + strncat(out, p, len); 656 + p += len; 657 + 658 + if (p[0] == '\0') 659 + break; 660 + 661 + strcat(out, "\\"); 662 + strncat(out, p++, 1); 663 + } 664 + 665 + strcat(out, "\""); 666 + 667 + return out; 668 + } 669 + 586 670 /* 587 671 * Kconfig configuration printer 588 672 * 589 673 * This printer is used when generating the resulting configuration after 590 674 * kconfig invocation and `defconfig' files. Unset symbol might be omitted by 591 675 * passing a non-NULL argument to the printer. 592 - * 593 676 */ 594 - static void 595 - kconfig_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) 677 + enum output_n { OUTPUT_N, OUTPUT_N_AS_UNSET, OUTPUT_N_NONE }; 678 + 679 + static void __print_symbol(FILE *fp, struct symbol *sym, enum output_n output_n, 680 + bool escape_string) 596 681 { 682 + const char *val; 683 + char *escaped = NULL; 684 + 685 + if (sym->type == S_UNKNOWN) 686 + return; 687 + 688 + val = sym_get_string_value(sym); 689 + 690 + if ((sym->type == S_BOOLEAN || sym->type == S_TRISTATE) && 691 + output_n != OUTPUT_N && *val == 'n') { 692 + if (output_n == OUTPUT_N_AS_UNSET) 693 + fprintf(fp, "# %s%s is not set\n", CONFIG_, sym->name); 694 + return; 695 + } 696 + 697 + if (sym->type == S_STRING && escape_string) { 698 + escaped = escape_string_value(val); 699 + val = escaped; 700 + } 701 + 702 + fprintf(fp, "%s%s=%s\n", CONFIG_, sym->name, val); 703 + 704 + free(escaped); 705 + } 706 + 707 + static void print_symbol_for_dotconfig(FILE *fp, struct symbol *sym) 708 + { 709 + __print_symbol(fp, sym, OUTPUT_N_AS_UNSET, true); 710 + } 711 + 712 + static void print_symbol_for_autoconf(FILE *fp, struct symbol *sym) 713 + { 714 + __print_symbol(fp, sym, OUTPUT_N_NONE, true); 715 + } 716 + 717 + void print_symbol_for_listconfig(struct symbol *sym) 718 + { 719 + __print_symbol(stdout, sym, OUTPUT_N, true); 720 + } 721 + 722 + static void print_symbol_for_c(FILE *fp, struct symbol *sym) 723 + { 724 + const char *val; 725 + const char *sym_suffix = ""; 726 + const char *val_prefix = ""; 727 + char *escaped = NULL; 728 + 729 + if (sym->type == S_UNKNOWN) 730 + return; 731 + 732 + val = sym_get_string_value(sym); 597 733 598 734 switch (sym->type) { 599 735 case S_BOOLEAN: 600 736 case S_TRISTATE: 601 - if (*value == 'n') { 602 - bool skip_unset = (arg != NULL); 603 - 604 - if (!skip_unset) 605 - fprintf(fp, "# %s%s is not set\n", 606 - CONFIG_, sym->name); 607 - return; 608 - } 609 - break; 610 - default: 611 - break; 612 - } 613 - 614 - fprintf(fp, "%s%s=%s\n", CONFIG_, sym->name, value); 615 - } 616 - 617 - static void 618 - kconfig_print_comment(FILE *fp, const char *value, void *arg) 619 - { 620 - const char *p = value; 621 - size_t l; 622 - 623 - for (;;) { 624 - l = strcspn(p, "\n"); 625 - fprintf(fp, "#"); 626 - if (l) { 627 - fprintf(fp, " "); 628 - xfwrite(p, l, 1, fp); 629 - p += l; 630 - } 631 - fprintf(fp, "\n"); 632 - if (*p++ == '\0') 633 - break; 634 - } 635 - } 636 - 637 - static struct conf_printer kconfig_printer_cb = 638 - { 639 - .print_symbol = kconfig_print_symbol, 640 - .print_comment = kconfig_print_comment, 641 - }; 642 - 643 - /* 644 - * Header printer 645 - * 646 - * This printer is used when generating the `include/generated/autoconf.h' file. 647 - */ 648 - static void 649 - header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) 650 - { 651 - 652 - switch (sym->type) { 653 - case S_BOOLEAN: 654 - case S_TRISTATE: { 655 - const char *suffix = ""; 656 - 657 - switch (*value) { 737 + switch (*val) { 658 738 case 'n': 659 - break; 739 + return; 660 740 case 'm': 661 - suffix = "_MODULE"; 741 + sym_suffix = "_MODULE"; 662 742 /* fall through */ 663 743 default: 664 - fprintf(fp, "#define %s%s%s 1\n", 665 - CONFIG_, sym->name, suffix); 744 + val = "1"; 666 745 } 667 746 break; 668 - } 669 - case S_HEX: { 670 - const char *prefix = ""; 671 - 672 - if (value[0] != '0' || (value[1] != 'x' && value[1] != 'X')) 673 - prefix = "0x"; 674 - fprintf(fp, "#define %s%s %s%s\n", 675 - CONFIG_, sym->name, prefix, value); 747 + case S_HEX: 748 + if (val[0] != '0' || (val[1] != 'x' && val[1] != 'X')) 749 + val_prefix = "0x"; 676 750 break; 677 - } 678 751 case S_STRING: 679 - case S_INT: 680 - fprintf(fp, "#define %s%s %s\n", 681 - CONFIG_, sym->name, value); 682 - break; 752 + escaped = escape_string_value(val); 753 + val = escaped; 683 754 default: 684 755 break; 685 756 } 686 757 687 - } 758 + fprintf(fp, "#define %s%s%s %s%s\n", CONFIG_, sym->name, sym_suffix, 759 + val_prefix, val); 688 760 689 - static void 690 - header_print_comment(FILE *fp, const char *value, void *arg) 691 - { 692 - const char *p = value; 693 - size_t l; 694 - 695 - fprintf(fp, "/*\n"); 696 - for (;;) { 697 - l = strcspn(p, "\n"); 698 - fprintf(fp, " *"); 699 - if (l) { 700 - fprintf(fp, " "); 701 - xfwrite(p, l, 1, fp); 702 - p += l; 703 - } 704 - fprintf(fp, "\n"); 705 - if (*p++ == '\0') 706 - break; 707 - } 708 - fprintf(fp, " */\n"); 709 - } 710 - 711 - static struct conf_printer header_printer_cb = 712 - { 713 - .print_symbol = header_print_symbol, 714 - .print_comment = header_print_comment, 715 - }; 716 - 717 - static void conf_write_symbol(FILE *fp, struct symbol *sym, 718 - struct conf_printer *printer, void *printer_arg) 719 - { 720 - const char *str; 721 - 722 - switch (sym->type) { 723 - case S_UNKNOWN: 724 - break; 725 - case S_STRING: 726 - str = sym_get_string_value(sym); 727 - str = sym_escape_string_value(str); 728 - printer->print_symbol(fp, sym, str, printer_arg); 729 - free((void *)str); 730 - break; 731 - default: 732 - str = sym_get_string_value(sym); 733 - printer->print_symbol(fp, sym, str, printer_arg); 734 - } 735 - } 736 - 737 - static void 738 - conf_write_heading(FILE *fp, struct conf_printer *printer, void *printer_arg) 739 - { 740 - char buf[256]; 741 - 742 - snprintf(buf, sizeof(buf), 743 - "\n" 744 - "Automatically generated file; DO NOT EDIT.\n" 745 - "%s\n", 746 - rootmenu.prompt->text); 747 - 748 - printer->print_comment(fp, buf, printer_arg); 761 + free(escaped); 749 762 } 750 763 751 764 /* ··· 806 815 goto next_menu; 807 816 } 808 817 } 809 - conf_write_symbol(out, sym, &kconfig_printer_cb, NULL); 818 + print_symbol_for_dotconfig(out, sym); 810 819 } 811 820 next_menu: 812 821 if (menu->list != NULL) { ··· 866 875 if (!out) 867 876 return 1; 868 877 869 - conf_write_heading(out, &kconfig_printer_cb, NULL); 878 + conf_write_heading(out, &comment_style_pound); 870 879 871 880 if (!conf_get_changed()) 872 881 sym_clear_all_valid(); ··· 893 902 need_newline = false; 894 903 } 895 904 sym->flags |= SYMBOL_WRITTEN; 896 - conf_write_symbol(out, sym, &kconfig_printer_cb, NULL); 905 + print_symbol_for_dotconfig(out, sym); 897 906 } 898 907 899 908 next: ··· 943 952 } 944 953 945 954 /* write a dependency file as used by kbuild to track dependencies */ 946 - static int conf_write_dep(const char *name) 955 + static int conf_write_autoconf_cmd(const char *autoconf_name) 947 956 { 957 + char name[PATH_MAX], tmp[PATH_MAX]; 948 958 struct file *file; 949 959 FILE *out; 960 + int ret; 950 961 951 - out = fopen("..config.tmp", "w"); 952 - if (!out) 953 - return 1; 954 - fprintf(out, "deps_config := \\\n"); 955 - for (file = file_list; file; file = file->next) { 956 - if (file->next) 957 - fprintf(out, "\t%s \\\n", file->name); 958 - else 959 - fprintf(out, "\t%s\n", file->name); 960 - } 961 - fprintf(out, "\n%s: \\\n" 962 - "\t$(deps_config)\n\n", conf_get_autoconfig_name()); 963 - 964 - env_write_dep(out, conf_get_autoconfig_name()); 965 - 966 - fprintf(out, "\n$(deps_config): ;\n"); 967 - fclose(out); 962 + ret = snprintf(name, sizeof(name), "%s.cmd", autoconf_name); 963 + if (ret >= sizeof(name)) /* check truncation */ 964 + return -1; 968 965 969 966 if (make_parent_dir(name)) 970 - return 1; 971 - rename("..config.tmp", name); 967 + return -1; 968 + 969 + ret = snprintf(tmp, sizeof(tmp), "%s.cmd.tmp", autoconf_name); 970 + if (ret >= sizeof(tmp)) /* check truncation */ 971 + return -1; 972 + 973 + out = fopen(tmp, "w"); 974 + if (!out) { 975 + perror("fopen"); 976 + return -1; 977 + } 978 + 979 + fprintf(out, "deps_config := \\\n"); 980 + for (file = file_list; file; file = file->next) 981 + fprintf(out, "\t%s \\\n", file->name); 982 + 983 + fprintf(out, "\n%s: $(deps_config)\n\n", autoconf_name); 984 + 985 + env_write_dep(out, autoconf_name); 986 + 987 + fprintf(out, "\n$(deps_config): ;\n"); 988 + 989 + if (ferror(out)) /* error check for all fprintf() calls */ 990 + return -1; 991 + 992 + fclose(out); 993 + 994 + if (rename(tmp, name)) { 995 + perror("rename"); 996 + return -1; 997 + } 998 + 972 999 return 0; 973 1000 } 974 1001 ··· 1062 1053 return 0; 1063 1054 } 1064 1055 1056 + static int __conf_write_autoconf(const char *filename, 1057 + void (*print_symbol)(FILE *, struct symbol *), 1058 + const struct comment_style *comment_style) 1059 + { 1060 + char tmp[PATH_MAX]; 1061 + FILE *file; 1062 + struct symbol *sym; 1063 + int ret, i; 1064 + 1065 + if (make_parent_dir(filename)) 1066 + return -1; 1067 + 1068 + ret = snprintf(tmp, sizeof(tmp), "%s.tmp", filename); 1069 + if (ret >= sizeof(tmp)) /* check truncation */ 1070 + return -1; 1071 + 1072 + file = fopen(tmp, "w"); 1073 + if (!file) { 1074 + perror("fopen"); 1075 + return -1; 1076 + } 1077 + 1078 + conf_write_heading(file, comment_style); 1079 + 1080 + for_all_symbols(i, sym) 1081 + if ((sym->flags & SYMBOL_WRITE) && sym->name) 1082 + print_symbol(file, sym); 1083 + 1084 + /* check possible errors in conf_write_heading() and print_symbol() */ 1085 + if (ferror(file)) 1086 + return -1; 1087 + 1088 + fclose(file); 1089 + 1090 + if (rename(tmp, filename)) { 1091 + perror("rename"); 1092 + return -1; 1093 + } 1094 + 1095 + return 0; 1096 + } 1097 + 1065 1098 int conf_write_autoconf(int overwrite) 1066 1099 { 1067 1100 struct symbol *sym; 1068 - const char *name; 1069 1101 const char *autoconf_name = conf_get_autoconfig_name(); 1070 - FILE *out, *out_h; 1071 - int i; 1102 + int ret, i; 1072 1103 1073 1104 if (!overwrite && is_present(autoconf_name)) 1074 1105 return 0; 1075 1106 1076 - conf_write_dep("include/config/auto.conf.cmd"); 1107 + ret = conf_write_autoconf_cmd(autoconf_name); 1108 + if (ret) 1109 + return -1; 1077 1110 1078 1111 if (conf_touch_deps()) 1079 1112 return 1; 1080 1113 1081 - out = fopen(".tmpconfig", "w"); 1082 - if (!out) 1083 - return 1; 1084 - 1085 - out_h = fopen(".tmpconfig.h", "w"); 1086 - if (!out_h) { 1087 - fclose(out); 1088 - return 1; 1089 - } 1090 - 1091 - conf_write_heading(out, &kconfig_printer_cb, NULL); 1092 - conf_write_heading(out_h, &header_printer_cb, NULL); 1093 - 1094 - for_all_symbols(i, sym) { 1114 + for_all_symbols(i, sym) 1095 1115 sym_calc_value(sym); 1096 - if (!(sym->flags & SYMBOL_WRITE) || !sym->name) 1097 - continue; 1098 1116 1099 - /* write symbols to auto.conf and autoconf.h */ 1100 - conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1); 1101 - conf_write_symbol(out_h, sym, &header_printer_cb, NULL); 1102 - } 1103 - fclose(out); 1104 - fclose(out_h); 1117 + ret = __conf_write_autoconf(conf_get_autoheader_name(), 1118 + print_symbol_for_c, 1119 + &comment_style_c); 1120 + if (ret) 1121 + return ret; 1105 1122 1106 - name = getenv("KCONFIG_AUTOHEADER"); 1107 - if (!name) 1108 - name = "include/generated/autoconf.h"; 1109 - if (make_parent_dir(name)) 1110 - return 1; 1111 - if (rename(".tmpconfig.h", name)) 1112 - return 1; 1113 - 1114 - if (make_parent_dir(autoconf_name)) 1115 - return 1; 1116 1123 /* 1117 - * This must be the last step, kbuild has a dependency on auto.conf 1118 - * and this marks the successful completion of the previous steps. 1124 + * Create include/config/auto.conf. This must be the last step because 1125 + * Kbuild has a dependency on auto.conf and this marks the successful 1126 + * completion of the previous steps. 1119 1127 */ 1120 - if (rename(".tmpconfig", autoconf_name)) 1121 - return 1; 1128 + ret = __conf_write_autoconf(conf_get_autoconfig_name(), 1129 + print_symbol_for_autoconf, 1130 + &comment_style_pound); 1131 + if (ret) 1132 + return ret; 1122 1133 1123 1134 return 0; 1124 1135 }
+5 -4
scripts/kconfig/lexer.l
··· 84 84 n [A-Za-z0-9_-] 85 85 86 86 %% 87 - int str = 0; 88 - int ts, i; 87 + char open_quote = 0; 89 88 90 89 #.* /* ignore comment */ 91 90 [ \t]* /* whitespaces */ ··· 133 134 ":=" return T_COLON_EQUAL; 134 135 "+=" return T_PLUS_EQUAL; 135 136 \"|\' { 136 - str = yytext[0]; 137 + open_quote = yytext[0]; 137 138 new_string(); 138 139 BEGIN(STRING); 139 140 } ··· 170 171 append_string(yytext + 1, yyleng - 1); 171 172 } 172 173 \'|\" { 173 - if (str == yytext[0]) { 174 + if (open_quote == yytext[0]) { 174 175 BEGIN(INITIAL); 175 176 yylval.string = text; 176 177 return T_WORD_QUOTE; ··· 195 196 196 197 <HELP>{ 197 198 [ \t]+ { 199 + int ts, i; 200 + 198 201 ts = 0; 199 202 for (i = 0; i < yyleng; i++) { 200 203 if (yytext[i] == '\t')
+1 -1
scripts/kconfig/lkc_proto.h
··· 18 18 19 19 struct symbol * sym_lookup(const char *name, int flags); 20 20 struct symbol * sym_find(const char *name); 21 - const char * sym_escape_string_value(const char *in); 21 + void print_symbol_for_listconfig(struct symbol *sym); 22 22 struct symbol ** sym_re_search(const char *pattern); 23 23 const char * sym_type_name(enum symbol_type type); 24 24 void sym_calc_value(struct symbol *sym);
+18 -15
scripts/kconfig/menu.c
··· 728 728 get_dep_str(r, prop->visible.expr, " Visible if: "); 729 729 730 730 menu = prop->menu->parent; 731 - for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) { 731 + for (i = 0; menu && i < 8; menu = menu->parent) { 732 732 bool accessible = menu_is_visible(menu); 733 733 734 734 submenu[i++] = menu; ··· 758 758 list_add_tail(&jump->entries, head); 759 759 } 760 760 761 - if (i > 0) { 762 - str_printf(r, " Location:\n"); 763 - for (j = 4; --i >= 0; j += 2) { 764 - menu = submenu[i]; 765 - if (jump && menu == location) 766 - jump->offset = strlen(r->s); 767 - str_printf(r, "%*c-> %s", j, ' ', 768 - menu_get_prompt(menu)); 769 - if (menu->sym) { 770 - str_printf(r, " (%s [=%s])", menu->sym->name ? 771 - menu->sym->name : "<choice>", 772 - sym_get_string_value(menu->sym)); 773 - } 774 - str_append(r, "\n"); 761 + str_printf(r, " Location:\n"); 762 + for (j = 4; --i >= 0; j += 2) { 763 + menu = submenu[i]; 764 + if (jump && menu == location) 765 + jump->offset = strlen(r->s); 766 + 767 + if (menu == &rootmenu) 768 + /* The real rootmenu prompt is ugly */ 769 + str_printf(r, "%*cMain menu", j, ' '); 770 + else 771 + str_printf(r, "%*c-> %s", j, ' ', menu_get_prompt(menu)); 772 + 773 + if (menu->sym) { 774 + str_printf(r, " (%s [=%s])", menu->sym->name ? 775 + menu->sym->name : "<choice>", 776 + sym_get_string_value(menu->sym)); 775 777 } 778 + str_append(r, "\n"); 776 779 } 777 780 } 778 781
-43
scripts/kconfig/symbol.c
··· 871 871 return symbol; 872 872 } 873 873 874 - const char *sym_escape_string_value(const char *in) 875 - { 876 - const char *p; 877 - size_t reslen; 878 - char *res; 879 - size_t l; 880 - 881 - reslen = strlen(in) + strlen("\"\"") + 1; 882 - 883 - p = in; 884 - for (;;) { 885 - l = strcspn(p, "\"\\"); 886 - p += l; 887 - 888 - if (p[0] == '\0') 889 - break; 890 - 891 - reslen++; 892 - p++; 893 - } 894 - 895 - res = xmalloc(reslen); 896 - res[0] = '\0'; 897 - 898 - strcat(res, "\""); 899 - 900 - p = in; 901 - for (;;) { 902 - l = strcspn(p, "\"\\"); 903 - strncat(res, p, l); 904 - p += l; 905 - 906 - if (p[0] == '\0') 907 - break; 908 - 909 - strcat(res, "\\"); 910 - strncat(res, p++, 1); 911 - } 912 - 913 - strcat(res, "\""); 914 - return res; 915 - } 916 - 917 874 struct sym_match { 918 875 struct symbol *sym; 919 876 off_t so, eo;
+4
scripts/package/buildtar
··· 39 39 opts="-I ${XZ}" 40 40 tarball=${tarball}.xz 41 41 ;; 42 + tarzst-pkg) 43 + opts="-I ${ZSTD}" 44 + tarball=${tarball}.zst 45 + ;; 42 46 *) 43 47 echo "Unknown tarball target \"${1}\" requested, please add it to ${0}." >&2 44 48 exit 1
+18 -2
usr/gen_init_cpio.c
··· 188 188 mode_t mode; 189 189 }; 190 190 191 - static struct generic_type generic_type_table[] = { 191 + static const struct generic_type generic_type_table[] = { 192 192 [GT_DIR] = { 193 193 .type = "dir", 194 194 .mode = S_IFDIR ··· 318 318 if (retval) { 319 319 fprintf(stderr, "File %s could not be stat()'ed\n", location); 320 320 goto error; 321 + } 322 + 323 + if (buf.st_mtime > 0xffffffff) { 324 + fprintf(stderr, "%s: Timestamp exceeds maximum cpio timestamp, clipping.\n", 325 + location); 326 + buf.st_mtime = 0xffffffff; 321 327 } 322 328 323 329 filebuf = malloc(buf.st_size); ··· 497 491 prog); 498 492 } 499 493 500 - struct file_handler file_handler_table[] = { 494 + static const struct file_handler file_handler_table[] = { 501 495 { 502 496 .type = "file", 503 497 .handler = cpio_mkfile_line, ··· 555 549 usage(argv[0]); 556 550 exit(opt == 'h' ? 0 : 1); 557 551 } 552 + } 553 + 554 + /* 555 + * Timestamps after 2106-02-07 06:28:15 UTC have an ascii hex time_t 556 + * representation that exceeds 8 chars and breaks the cpio header 557 + * specification. 558 + */ 559 + if (default_mtime > 0xffffffff) { 560 + fprintf(stderr, "ERROR: Timestamp too large for cpio format\n"); 561 + exit(1); 558 562 } 559 563 560 564 if (argc - optind != 1) {