Merge tag 'kbuild-v6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 19 Jan 2024 01:57:07 +0000 (17:57 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 19 Jan 2024 01:57:07 +0000 (17:57 -0800)
Pull Kbuild updates from Masahiro Yamada:

 - Make Kconfig parse the input .config more precisely

 - Support W=c and W=e options for Kconfig

 - Set Kconfig int/hex symbols to zero if the 'default' property is
   missing

 - Add .editorconfig

 - Add scripts/git.orderFile

 - Add a script to detect backward-incompatible changes in UAPI headers

 - Resolve the symlink passed to O= option properly

 - Use the user-supplied mtime for all files in the builtin initramfs,
   which provides better reproducible builds

 - Fix the direct execution of debian/rules for Debian package builds

 - Use build ID instead of the .gnu_debuglink section for the Debian dbg
   package

* tag 'kbuild-v6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (53 commits)
  kbuild: deb-pkg: use debian/<package> for tmpdir
  kbuild: deb-pkg: move 'make headers' to build-arch
  kbuild: deb-pkg: do not search for 'scripts' directory under arch/
  kbuild: deb-pkg: use build ID instead of debug link for dbg package
  kbuild: deb-pkg: use more debhelper commands in builddeb
  kbuild: deb-pkg: remove unneeded '-f $srctree/Makefile' in debian/rules
  kbuild: deb-pkg: allow to run debian/rules from output directory
  kbuild: deb-pkg: set DEB_* variables if debian/rules is directly executed
  kbuild: deb-pkg: squash scripts/package/deb-build-option to debian/rules
  kbuild: deb-pkg: factor out common Make options in debian/rules
  kbuild: deb-pkg: hard-code Build-Depends
  kbuild: deb-pkg: split debian/copyright from the mkdebian script
  gen_init_cpio: Apply mtime supplied by user to all file types
  kbuild: resolve symlinks for O= properly
  docs: dev-tools: Add UAPI checker documentation
  check-uapi: Introduce check-uapi.sh
  scripts: Introduce a default git.orderFile
  kconfig: WERROR unmet symbol dependency
  Add .editorconfig file for basic formatting
  kconfig: Use KCONFIG_CONFIG instead of .config
  ...

1  2 
Documentation/dev-tools/index.rst
Makefile
scripts/Makefile.extrawarn
scripts/gdb/linux/tasks.py

@@@ -10,8 -10,11 +10,8 @@@ whole; patches welcome
  A brief overview of testing-specific tools can be found in
  Documentation/dev-tools/testing-overview.rst
  
 -.. class:: toc-title
 -
 -         Table of contents
 -
  .. toctree::
 +   :caption: Table of contents
     :maxdepth: 2
  
     testing-overview
@@@ -31,6 -34,7 +31,7 @@@
     kselftest
     kunit/index
     ktap
+    checkuapi
  
  
  .. only::  subproject and html
diff --combined Makefile
+++ b/Makefile
@@@ -2,7 -2,7 +2,7 @@@
  VERSION = 6
  PATCHLEVEL = 7
  SUBLEVEL = 0
 -EXTRAVERSION = -rc3
 +EXTRAVERSION =
  NAME = Hurr durr I'ma ninja sloth
  
  # *DOCUMENTATION*
@@@ -155,6 -155,15 +155,15 @@@ endi
  
  export KBUILD_EXTMOD
  
+ # backward compatibility
+ KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)
+ ifeq ("$(origin W)", "command line")
+   KBUILD_EXTRA_WARN := $(W)
+ endif
+ export KBUILD_EXTRA_WARN
  # Kbuild will save output files in the current working directory.
  # This does not need to match to the root of the kernel source tree.
  #
@@@ -181,14 -190,11 +190,11 @@@ ifeq ("$(origin O)", "command line"
  endif
  
  ifneq ($(KBUILD_OUTPUT),)
- # Make's built-in functions such as $(abspath ...), $(realpath ...) cannot
- # expand a shell special character '~'. We use a somewhat tedious way here.
- abs_objtree := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) && pwd)
- $(if $(abs_objtree),, \
-      $(error failed to create output directory "$(KBUILD_OUTPUT)"))
+ # $(realpath ...) gets empty if the path does not exist. Run 'mkdir -p' first.
+ $(shell mkdir -p "$(KBUILD_OUTPUT)")
  # $(realpath ...) resolves symlinks
- abs_objtree := $(realpath $(abs_objtree))
+ abs_objtree := $(realpath $(KBUILD_OUTPUT))
+ $(if $(abs_objtree),,$(error failed to create output directory "$(KBUILD_OUTPUT)"))
  endif # ifneq ($(KBUILD_OUTPUT),)
  
  ifneq ($(words $(subst :, ,$(abs_srctree))), 1)
@@@ -609,8 -615,6 +615,6 @@@ export KBUILD_AFLAGS_KERNEL KBUILD_CFLA
  export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o    \
                          -name CVS -o -name .pc -o -name .hg -o -name .git \) \
                          -prune -o
- export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \
-                        --exclude CVS --exclude .pc --exclude .hg --exclude .git
  
  # ===========================================================================
  # Rules shared between *config targets and build targets
@@@ -1576,8 -1580,7 +1580,8 @@@ help
         echo  '                    (default: $(INSTALL_HDR_PATH))'; \
         echo  ''
        @echo  'Static analysers:'
 -      @echo  '  checkstack      - Generate a list of stack hogs'
 +      @echo  '  checkstack      - Generate a list of stack hogs and consider all functions'
 +      @echo  '                    with a stack size larger than MINSTACKSIZE (default: 100)'
        @echo  '  versioncheck    - Sanity check on version.h usage'
        @echo  '  includecheck    - Check for duplicate included header files'
        @echo  '  export_report   - List the usages of all exported symbols'
        @echo  '                1: warnings which may be relevant and do not occur too often'
        @echo  '                2: warnings which occur quite often but may still be relevant'
        @echo  '                3: more obscure warnings, can most likely be ignored'
+       @echo  '                c: extra checks in the configuration stage (Kconfig)'
        @echo  '                e: warnings are being treated as errors'
        @echo  '                Multiple levels can be combined with W=12 or W=123'
        @$(if $(dtstree), \
@@@ -2017,10 -2021,9 +2022,10 @@@ CHECKSTACK_ARCH := $(SUBARCH
  else
  CHECKSTACK_ARCH := $(ARCH)
  endif
 +MINSTACKSIZE  ?= 100
  checkstack:
        $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
 -      $(PERL) $(srctree)/scripts/checkstack.pl $(CHECKSTACK_ARCH)
 +      $(PERL) $(srctree)/scripts/checkstack.pl $(CHECKSTACK_ARCH) $(MINSTACKSIZE)
  
  kernelrelease:
        @$(filechk_kernel.release)
@@@ -17,8 -17,6 +17,8 @@@ KBUILD_CFLAGS += -Wno-format-securit
  KBUILD_CFLAGS += -Wno-trigraphs
  KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
  KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
 +KBUILD_CFLAGS += -Wmissing-declarations
 +KBUILD_CFLAGS += -Wmissing-prototypes
  
  ifneq ($(CONFIG_FRAME_WARN),0)
  KBUILD_CFLAGS += -Wframe-larger-than=$(CONFIG_FRAME_WARN)
@@@ -82,23 -80,16 +82,14 @@@ KBUILD_CFLAGS += $(call cc-option,-Werr
  # Warn if there is an enum types mismatch
  KBUILD_CFLAGS += $(call cc-option,-Wenum-conversion)
  
- # backward compatibility
- KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)
- ifeq ("$(origin W)", "command line")
-   KBUILD_EXTRA_WARN := $(W)
- endif
- export KBUILD_EXTRA_WARN
  #
  # W=1 - warnings which may be relevant and do not occur too often
  #
  ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),)
  
  KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter
 -KBUILD_CFLAGS += -Wmissing-declarations
  KBUILD_CFLAGS += $(call cc-option, -Wrestrict)
  KBUILD_CFLAGS += -Wmissing-format-attribute
 -KBUILD_CFLAGS += -Wmissing-prototypes
  KBUILD_CFLAGS += -Wold-style-definition
  KBUILD_CFLAGS += -Wmissing-include-dirs
  KBUILD_CFLAGS += $(call cc-option, -Wunused-but-set-variable)
@@@ -13,7 -13,7 +13,7 @@@
  
  import gdb
  
 -from linux import utils
 +from linux import utils, lists
  
  
  task_type = utils.CachedType("struct task_struct")
  def task_lists():
      task_ptr_type = task_type.get_type().pointer()
      init_task = gdb.parse_and_eval("init_task").address
 -    t = g = init_task
 +    t = init_task
  
      while True:
 -        while True:
 -            yield t
 +        thread_head = t['signal']['thread_head']
 +        for thread in lists.list_for_each_entry(thread_head, task_ptr_type, 'thread_node'):
 +            yield thread
  
 -            t = utils.container_of(t['thread_group']['next'],
 -                                   task_ptr_type, "thread_group")
 -            if t == g:
 -                break
 -
 -        t = g = utils.container_of(g['tasks']['next'],
 -                                   task_ptr_type, "tasks")
 +        t = utils.container_of(t['tasks']['next'],
 +                               task_ptr_type, "tasks")
          if t == init_task:
              return
  
@@@ -82,21 -86,12 +82,12 @@@ LxPs(
  
  thread_info_type = utils.CachedType("struct thread_info")
  
- ia64_task_size = None
  
  def get_thread_info(task):
      thread_info_ptr_type = thread_info_type.get_type().pointer()
-     if utils.is_target_arch("ia64"):
-         global ia64_task_size
-         if ia64_task_size is None:
-             ia64_task_size = gdb.parse_and_eval("sizeof(struct task_struct)")
-         thread_info_addr = task.address + ia64_task_size
-         thread_info = thread_info_addr.cast(thread_info_ptr_type)
-     else:
-         if task.type.fields()[0].type == thread_info_type.get_type():
-             return task['thread_info']
-         thread_info = task['stack'].cast(thread_info_ptr_type)
+     if task.type.fields()[0].type == thread_info_type.get_type():
+         return task['thread_info']
+     thread_info = task['stack'].cast(thread_info_ptr_type)
      return thread_info.dereference()