Merge tag 'kbuild-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 10 Oct 2022 19:00:45 +0000 (12:00 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 10 Oct 2022 19:00:45 +0000 (12:00 -0700)
Pull Kbuild updates from Masahiro Yamada:

 - Remove potentially incomplete targets when Kbuid is interrupted by
   SIGINT etc in case GNU Make may miss to do that when stderr is piped
   to another program.

 - Rewrite the single target build so it works more correctly.

 - Fix rpm-pkg builds with V=1.

 - List top-level subdirectories in ./Kbuild.

 - Ignore auto-generated __kstrtab_* and __kstrtabns_* symbols in
   kallsyms.

 - Avoid two different modules in lib/zstd/ having shared code, which
   potentially causes building the common code as build-in and modular
   back-and-forth.

 - Unify two modpost invocations to optimize the build process.

 - Remove head-y syntax in favor of linker scripts for placing
   particular sections in the head of vmlinux.

 - Bump the minimal GNU Make version to 3.82.

 - Clean up misc Makefiles and scripts.

* tag 'kbuild-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (41 commits)
  docs: bump minimal GNU Make version to 3.82
  ia64: simplify esi object addition in Makefile
  Revert "kbuild: Check if linker supports the -X option"
  kbuild: rebuild .vmlinux.export.o when its prerequisite is updated
  kbuild: move modules.builtin(.modinfo) rules to Makefile.vmlinux_o
  zstd: Fixing mixed module-builtin objects
  kallsyms: ignore __kstrtab_* and __kstrtabns_* symbols
  kallsyms: take the input file instead of reading stdin
  kallsyms: drop duplicated ignore patterns from kallsyms.c
  kbuild: reuse mksysmap output for kallsyms
  mksysmap: update comment about __crc_*
  kbuild: remove head-y syntax
  kbuild: use obj-y instead extra-y for objects placed at the head
  kbuild: hide error checker logs for V=1 builds
  kbuild: re-run modpost when it is updated
  kbuild: unify two modpost invocations
  kbuild: move vmlinux.o rule to the top Makefile
  kbuild: move .vmlinux.objs rule to Makefile.modpost
  kbuild: list sub-directories in ./Kbuild
  Makefile.compiler: replace cc-ifversion with compiler-specific macros
  ...

23 files changed:
1  2 
Documentation/kbuild/makefiles.rst
Documentation/process/changes.rst
Kbuild
Makefile
arch/alpha/kernel/Makefile
arch/arm/Makefile
arch/arm/kernel/Makefile
arch/arm64/Makefile
arch/arm64/kernel/Makefile
arch/loongarch/Makefile
arch/powerpc/Makefile
arch/powerpc/kernel/Makefile
arch/riscv/Makefile
arch/s390/kernel/Makefile
arch/sparc/kernel/Makefile
arch/x86/Makefile
arch/x86/kernel/Makefile
scripts/Makefile.build
scripts/Makefile.extrawarn
scripts/Makefile.lib
scripts/Makefile.modfinal
scripts/head-object-list.txt
scripts/kallsyms.c

Simple merge
@@@ -31,9 -31,7 +31,9 @@@ you probably needn't concern yourself w
  ====================== ===============  ========================================
  GNU C                  5.1              gcc --version
  Clang/LLVM (optional)  11.0.0           clang --version
- GNU make               3.81             make --version
 +Rust (optional)        1.62.0           rustc --version
 +bindgen (optional)     0.56.0           bindgen --version
+ GNU make               3.82             make --version
  bash                   4.2              bash --version
  binutils               2.23             ld -v
  flex                   2.5.35           flex --version
diff --cc Kbuild
--- 1/Kbuild
--- 2/Kbuild
+++ b/Kbuild
@@@ -42,18 -39,60 +39,61 @@@ $(offsets-file): arch/$(SRCARCH)/kernel
  quiet_cmd_syscalls = CALL    $<
        cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
  
- missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
+ PHONY += missing-syscalls
+ missing-syscalls: scripts/checksyscalls.sh $(offsets-file)
        $(call cmd,syscalls)
  
- #####
- # Check atomic headers are up-to-date
- always-y += old-atomics
- quiet_cmd_atomics = CALL    $<
-       cmd_atomics = $(CONFIG_SHELL) $<
- old-atomics: scripts/atomic/check-atomics.sh FORCE
-       $(call cmd,atomics)
+ # Check the manual modification of atomic headers
+ quiet_cmd_check_sha1 = CHKSHA1 $<
+       cmd_check_sha1 = \
+       if ! command -v sha1sum >/dev/null; then \
+               echo "warning: cannot check the header due to sha1sum missing"; \
+               exit 0; \
+       fi; \
+       if [ "$$(sed -n '$$s:// ::p' $<)" != \
+            "$$(sed '$$d' $< | sha1sum | sed 's/ .*//')" ]; then \
+               echo "error: $< has been modified." >&2; \
+               exit 1; \
+       fi; \
+       touch $@
+ atomic-checks += $(addprefix $(obj)/.checked-, \
+         atomic-arch-fallback.h \
+         atomic-instrumented.h \
+         atomic-long.h)
+ targets += $(atomic-checks)
+ $(atomic-checks): $(obj)/.checked-%: include/linux/atomic/%  FORCE
+       $(call if_changed,check_sha1)
+ # A phony target that depends on all the preparation targets
+ PHONY += prepare
+ prepare: $(offsets-file) missing-syscalls $(atomic-checks)
+       @:
+ # Ordinary directory descending
+ # ---------------------------------------------------------------------------
+ obj-y                 += init/
+ obj-y                 += usr/
+ obj-y                 += arch/$(SRCARCH)/
+ obj-y                 += $(ARCH_CORE)
+ obj-y                 += kernel/
+ obj-y                 += certs/
+ obj-y                 += mm/
+ obj-y                 += fs/
+ obj-y                 += ipc/
+ obj-y                 += security/
+ obj-y                 += crypto/
+ obj-$(CONFIG_BLOCK)   += block/
+ obj-$(CONFIG_IO_URING)        += io_uring/
++obj-$(CONFIG_RUST)    += rust/
+ obj-y                 += $(ARCH_LIB)
+ obj-y                 += drivers/
+ obj-y                 += sound/
+ obj-$(CONFIG_SAMPLES) += samples/
+ obj-$(CONFIG_NET)     += net/
+ obj-y                 += virt/
+ obj-y                 += $(ARCH_DRIVERS)
diff --cc Makefile
+++ b/Makefile
@@@ -536,9 -501,8 +536,9 @@@ RUSTFLAGS_MODULE 
  AFLAGS_MODULE   =
  LDFLAGS_MODULE  =
  CFLAGS_KERNEL =
 +RUSTFLAGS_KERNEL =
  AFLAGS_KERNEL =
- LDFLAGS_vmlinux =
export LDFLAGS_vmlinux =
  
  # Use USERINCLUDE when you must reference the UAPI directories only.
  USERINCLUDE    := \
@@@ -862,11 -789,7 +861,10 @@@ KBUILD_CFLAGS += $(stackp-flags-y
  
  KBUILD_CFLAGS-$(CONFIG_WERROR) += -Werror
  KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds
- KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH)
  
 +KBUILD_RUSTFLAGS-$(CONFIG_WERROR) += -Dwarnings
 +KBUILD_RUSTFLAGS += $(KBUILD_RUSTFLAGS-y)
 +
  ifdef CONFIG_CC_IS_CLANG
  KBUILD_CPPFLAGS += -Qunused-arguments
  # The kernel builds with '-std=gnu11' so use of GNU extensions is acceptable.
@@@ -1574,7 -1493,7 +1567,8 @@@ endif # CONFIG_MODULE
  # Directories & files removed with 'make clean'
  CLEAN_FILES += include/ksym vmlinux.symvers modules-only.symvers \
               modules.builtin modules.builtin.modinfo modules.nsdeps \
-              compile_commands.json .thinlto-cache rust/test rust/doc
 -             compile_commands.json .thinlto-cache .vmlinux.objs .vmlinux.export.c
++             compile_commands.json .thinlto-cache rust/test rust/doc \
++             .vmlinux.objs .vmlinux.export.c
  
  # Directories & files removed with 'make mrproper'
  MRPROPER_FILES += include/config include/generated          \
@@@ -7,9 -7,9 +7,9 @@@ extra-y          := vmlinux.ld
  asflags-y     := $(KBUILD_CFLAGS)
  ccflags-y     := -Wno-sign-compare
  
- obj-y    := entry.o traps.o process.o osf_sys.o irq.o \
+ obj-y    := head.o entry.o traps.o process.o osf_sys.o irq.o \
            irq_alpha.o signal.o setup.o ptrace.o time.o \
 -          systbls.o err_common.o io.o bugs.o
 +          systbls.o err_common.o io.o bugs.o termios.o
  
  obj-$(CONFIG_VGA_HOSE)        += console.o
  obj-$(CONFIG_SMP)     += smp.o
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -79,10 -72,7 +79,8 @@@ CHECKFLAGS += $(shell $(CC) $(KBUILD_CF
        sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g')
  endif
  
- head-y := arch/loongarch/kernel/head.o
  libs-y += arch/loongarch/lib/
 +libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
  
  ifeq ($(KBUILD_EXTMOD),)
  prepare: vdso_prepare
Simple merge
@@@ -116,12 -118,12 +116,12 @@@ obj-$(CONFIG_PPC_E500)          += cpu_setup_e5
  obj-$(CONFIG_PPC_DOORBELL)    += dbell.o
  obj-$(CONFIG_JUMP_LABEL)      += jump_label.o
  
- extra-$(CONFIG_PPC64)         := head_64.o
- extra-$(CONFIG_PPC_BOOK3S_32) := head_book3s_32.o
- extra-$(CONFIG_40x)           := head_40x.o
- extra-$(CONFIG_44x)           := head_44x.o
- extra-$(CONFIG_PPC_85xx)      := head_85xx.o
- extra-$(CONFIG_PPC_8xx)               := head_8xx.o
+ obj-$(CONFIG_PPC64)           += head_64.o
+ obj-$(CONFIG_PPC_BOOK3S_32)   += head_book3s_32.o
+ obj-$(CONFIG_40x)             += head_40x.o
+ obj-$(CONFIG_44x)             += head_44x.o
 -obj-$(CONFIG_FSL_BOOKE)               += head_fsl_booke.o
+ obj-$(CONFIG_PPC_8xx)         += head_8xx.o
++obj-$(CONFIG_FSL_BOOKE)               += head_85xx.o
  extra-y                               += vmlinux.lds
  
  obj-$(CONFIG_RELOCATABLE)     += reloc_$(BITS).o
Simple merge
@@@ -40,9 -40,9 +40,9 @@@ obj-y += sysinfo.o lgr.o os_info.o mach
  obj-y += runtime_instr.o cache.o fpu.o dumpstack.o guarded_storage.o sthyi.o
  obj-y += entry.o reipl.o relocate_kernel.o kdebugfs.o alternative.o
  obj-y += nospec-branch.o ipl_vmparm.o machine_kexec_reloc.o unwind_bc.o
 -obj-y += smp.o text_amode31.o stacktrace.o
 +obj-y += smp.o text_amode31.o stacktrace.o abs_lowcore.o
  
- extra-y                               += head64.o vmlinux.lds
+ extra-y                               += vmlinux.lds
  
  obj-$(CONFIG_SYSFS)           += nospec-sysfs.o
  CFLAGS_REMOVE_nospec-branch.o += $(CC_FLAGS_EXPOLINE)
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 0000000,dd2ba2e..b16326a
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,53 +1,53 @@@
 -arch/powerpc/kernel/head_fsl_booke.o
+ # Head objects
+ #
+ # The objects listed here are placed at the head of vmlinux. A typical use-case
+ # is an object that contains the entry point. This is kept for compatibility
+ # with head-y, which Kbuild used to support.
+ #
+ # A counter approach is to control the section placement by the linker script.
+ # The code marked as __HEAD goes into the ".head.text" section, which is placed
+ # before the normal ".text" section.
+ #
+ # If you can achieve the correct code ordering by linker script, please delete
+ # the entry from this file.
+ #
+ arch/alpha/kernel/head.o
+ arch/arc/kernel/head.o
+ arch/arm/kernel/head-nommu.o
+ arch/arm/kernel/head.o
+ arch/arm64/kernel/head.o
+ arch/csky/kernel/head.o
+ arch/hexagon/kernel/head.o
+ arch/ia64/kernel/head.o
+ arch/loongarch/kernel/head.o
+ arch/m68k/68000/head.o
+ arch/m68k/coldfire/head.o
+ arch/m68k/kernel/head.o
+ arch/m68k/kernel/sun3-head.o
+ arch/microblaze/kernel/head.o
+ arch/mips/kernel/head.o
+ arch/nios2/kernel/head.o
+ arch/openrisc/kernel/head.o
+ arch/parisc/kernel/head.o
+ arch/powerpc/kernel/head_40x.o
+ arch/powerpc/kernel/head_44x.o
+ arch/powerpc/kernel/head_64.o
+ arch/powerpc/kernel/head_8xx.o
++arch/powerpc/kernel/head_85xx.o
+ arch/powerpc/kernel/head_book3s_32.o
+ arch/powerpc/kernel/entry_64.o
+ arch/powerpc/kernel/fpu.o
+ arch/powerpc/kernel/vector.o
+ arch/powerpc/kernel/prom_init.o
+ arch/riscv/kernel/head.o
+ arch/s390/kernel/head64.o
+ arch/sh/kernel/head_32.o
+ arch/sparc/kernel/head_32.o
+ arch/sparc/kernel/head_64.o
+ arch/x86/kernel/head_32.o
+ arch/x86/kernel/head_64.o
+ arch/x86/kernel/head32.o
+ arch/x86/kernel/head64.o
+ arch/x86/kernel/ebda.o
+ arch/x86/kernel/platform-quirks.o
+ arch/xtensa/kernel/head.o
Simple merge