projects/linux·commit 5d0d3623

Merge tag 'kbuild-7.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux

5d0d3623 · Linus Torvalds <[email protected]> · 2026-04-14 09:18:40 -07:00

Pull Kbuild/Kconfig updates from Nicolas Schier:
 "Kbuild:
   - reject unexpected values for LLVM=
   - uapi: remove usage of toolchain headers
   - switch from '-fms-extensions' to '-fms-anonymous-structs' when
     available (currently: clang >= 23.0.0)
   - reduce the number of compiler-generated suffixes for clang thin-lto
     build
   - reduce output spam ("GEN Makefile") when building out of tree
   - improve portability for testing headers
   - also test UAPI headers against C++ compilers
   - drop build ID architecture allow-list in vdso_install
   - only run checksyscalls when necessary
   - update the debug information notes in reproducible-builds.rst
   - expand inlining hints with -fdiagnostics-show-inlining-chain

  Kconfig:
   - forbid multiple entries with the same symbol in a choice
   - error out on duplicated kconfig inclusion"

* tag 'kbuild-7.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux: (35 commits)
  kbuild: expand inlining hints with -fdiagnostics-show-inlining-chain
  kconfig: forbid multiple entries with the same symbol in a choice
  Documentation: kbuild: Update the debug information notes in reproducible-builds.rst
  checksyscalls: move instance functionality into generic code
  checksyscalls: only run when necessary
  checksyscalls: fail on all intermediate errors
  checksyscalls: move path to reference table to a variable
  kbuild: vdso_install: drop build ID architecture allow-list
  kbuild: vdso_install: gracefully handle images without build ID
  kbuild: vdso_install: hide readelf warnings
  kbuild: vdso_install: split out the readelf invocation
  kbuild: uapi: also test UAPI headers against C++ compilers
  kbuild: uapi: provide a C++ compatible dummy definition of NULL
  kbuild: uapi: handle UML in architecture-specific exclusion lists
  kbuild: uapi: move all include path flags together
  kbuild: uapi: move some compiler arguments out of the command definition
  check-uapi: use dummy libc includes
  check-uapi: honor ${CROSS_COMPILE} setting
  check-uapi: link into shared objects
  kbuild: reduce output spam when building out of tree
  ...
Commit
5d0d3623303775d750e122a2542d1a26c8573d38
Parents
a970ed18 · 40492775

Merge commit. Changes below are compared with the first parent: a970ed18.

Changes

47 files changed · +251 −117

FileStatusAddDelContent
Documentation/kbuild/llvm.rstmodified+0−4View file
Documentation/kbuild/reproducible-builds.rstmodified+5−2View file
Kbuildmodified+10−4View file
Makefilemodified+26−9View file
arch/arm64/kernel/vdso32/Makefilemodified+1−2View file
arch/hexagon/include/uapi/asm/sigcontext.hmodified+1−1View file
arch/loongarch/vdso/Makefilemodified+1−1View file
arch/mips/Makefilemodified+2−4View file
arch/parisc/boot/compressed/Makefilemodified+1−1View file
arch/powerpc/boot/Makefilemodified+1−2View file
arch/s390/Makefilemodified+1−2View file
arch/s390/purgatory/Makefilemodified+1−2View file
arch/x86/Makefilemodified+1−5View file
arch/x86/boot/compressed/Makefilemodified+1−5View file
drivers/firmware/efi/libstub/Makefilemodified+1−2View file
init/Kconfigmodified+5−0View file
scripts/Makefile.vdsoinstmodified+4−3View file
scripts/Makefile.warnmodified+0−5View file
scripts/check-uapi.shmodified+12−7View file
scripts/checksyscalls.shmodified+10−1View file
scripts/kconfig/lexer.lmodified+2−2View file
scripts/kconfig/lkc.hmodified+2−1View file
scripts/kconfig/parser.ymodified+4−11View file
scripts/kconfig/tests/err_repeated_inc/Kconfigadded+3−0View file
scripts/kconfig/tests/err_repeated_inc/Kconfig.inc1added+4−0View file
scripts/kconfig/tests/err_repeated_inc/Kconfig.inc2added+3−0View file
scripts/kconfig/tests/err_repeated_inc/Kconfig.inc3added+1−0View file
scripts/kconfig/tests/err_repeated_inc/__init__.pyadded+10−0View file
scripts/kconfig/tests/err_repeated_inc/expected_stderradded+2−0View file
scripts/kconfig/util.cmodified+28−3View file
tools/scripts/Makefile.includemodified+2−0View file
usr/dummy-include/endian.hadded+0−0View file
usr/dummy-include/limits.hadded+8−0View file
usr/dummy-include/netinet/if_ether.hadded+0−0View file
usr/dummy-include/netinet/in.hadded+0−0View file
usr/dummy-include/stdbool.hdeleted+0−7View before deletion
usr/dummy-include/stddef.hadded+13−0View file
usr/dummy-include/stdint.hadded+17−0View file
usr/dummy-include/stdlib.hdeleted+0−7View before deletion
usr/dummy-include/string.hadded+12−0View file
usr/dummy-include/sys/ioctl.hadded+0−0View file
usr/dummy-include/sys/socket.hadded+12−0View file
usr/dummy-include/sys/time.hadded+3−0View file
usr/dummy-include/sys/types.hadded+0−0View file
usr/dummy-include/time.hadded+0−0View file
usr/dummy-include/unistd.hadded+0−0View file
usr/include/Makefilemodified+41−24View file

Only the first 600 diff lines are shown. Download the complete patch.

Documentation/kbuild/llvm.rst

View file
diff --git a/Documentation/kbuild/llvm.rst b/Documentation/kbuild/llvm.rst
index bc8a283..441d878 100644
--- a/Documentation/kbuild/llvm.rst
+++ b/Documentation/kbuild/llvm.rst
@@ -71,10 +71,6 @@ recommend::
PATH=/path/to/llvm/:$PATH make LLVM=-14
-``LLVM=0`` is not the same as omitting ``LLVM`` altogether, it will behave like
-``LLVM=1``. If you only wish to use certain LLVM utilities, use their
-respective make variables.
-
The same value used for ``LLVM=`` should be set for each invocation of ``make``
if configuring and building via distinct commands. ``LLVM=`` should also be set
as an environment variable when running scripts that will eventually run

Documentation/kbuild/reproducible-builds.rst

View file
diff --git a/Documentation/kbuild/reproducible-builds.rst b/Documentation/kbuild/reproducible-builds.rst
index 96d208e..bc1eb82 100644
--- a/Documentation/kbuild/reproducible-builds.rst
+++ b/Documentation/kbuild/reproducible-builds.rst
@@ -50,8 +50,10 @@ Absolute filenames
------------------
When the kernel is built out-of-tree, debug information may include
-absolute filenames for the source files. This must be overridden by
-including the ``-fdebug-prefix-map`` option in the `KCFLAGS`_ variable.
+absolute filenames for the source files and build directory. These must
+be overridden by including a ``-fdebug-prefix-map`` option for each in
+the `KCFLAGS`_ and `KAFLAGS`_ variables to cover both ``.c`` and ``.S``
+files.
Depending on the compiler used, the ``__FILE__`` macro may also expand
to an absolute filename in an out-of-tree build. Kbuild automatically
@@ -135,6 +137,7 @@ See ``scripts/setlocalversion`` for details.
.. _KBUILD_BUILD_TIMESTAMP: kbuild.html#kbuild-build-timestamp
.. _KBUILD_BUILD_USER and KBUILD_BUILD_HOST: kbuild.html#kbuild-build-user-kbuild-build-host
.. _KCFLAGS: kbuild.html#kcflags
+.. _KAFLAGS: kbuild.html#kaflags
.. _prefix-map options: https://reproducible-builds.org/docs/build-path/
.. _Reproducible Builds project: https://reproducible-builds.org/
.. _SOURCE_DATE_EPOCH: https://reproducible-builds.org/docs/source-date-epoch/

Kbuild

View file
diff --git a/Kbuild b/Kbuild
index 13324b4..a6a0192 100644
--- a/Kbuild
+++ b/Kbuild
@@ -47,12 +47,18 @@ $(rq-offsets-file): kernel/sched/rq-offsets.s FORCE
# Check for missing system calls
-quiet_cmd_syscalls = CALL $<
- cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
+missing-syscalls-file := .tmp_missing-syscalls$(missing_syscalls_instance)
+
+targets += $(missing-syscalls-file)
+
+quiet_cmd_syscalls = CALL $< $(addprefix for ,$(missing_syscalls_instance))
+ cmd_syscalls = DEPFILE=$(depfile) $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags); touch $@
+
+$(missing-syscalls-file): scripts/checksyscalls.sh $(rq-offsets-file) FORCE
+ $(call if_changed_dep,syscalls)
PHONY += missing-syscalls
-missing-syscalls: scripts/checksyscalls.sh $(rq-offsets-file)
- $(call cmd,syscalls)
+missing-syscalls: $(missing-syscalls-file)
# Check the manual modification of atomic headers

Makefile

View file
diff --git a/Makefile b/Makefile
index 2345552..54e1ae6 100644
--- a/Makefile
+++ b/Makefile
@@ -591,7 +591,6 @@ LINUXINCLUDE := \
KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE
KBUILD_CFLAGS :=
-KBUILD_CFLAGS += -std=gnu11
KBUILD_CFLAGS += -fshort-wchar
KBUILD_CFLAGS += -funsigned-char
KBUILD_CFLAGS += -fno-common
@@ -680,14 +679,19 @@ print_env_for_makefile = \
echo "export KBUILD_OUTPUT = $(CURDIR)"
endif
-quiet_cmd_makefile = GEN Makefile
- cmd_makefile = { \
+filechk_makefile = { \
echo "\# Automatically generated by $(abs_srctree)/Makefile: don't edit"; \
$(print_env_for_makefile); \
echo "include $(abs_srctree)/Makefile"; \
- } > Makefile
+ }
-outputmakefile:
+$(objtree)/Makefile: FORCE
+ $(call filechk,makefile)
+
+# Prevent $(srcroot)/Makefile from inhibiting the rule to run.
+PHONY += $(objtree)/Makefile
+
+outputmakefile: $(objtree)/Makefile
ifeq ($(KBUILD_EXTMOD),)
@if [ -f $(srctree)/.config -o \
-d $(srctree)/include/config -o \
@@ -708,7 +712,6 @@ else
fi
endif
$(Q)ln -fsn $(srcroot) source
- $(call cmd,makefile)
$(Q)test -e .gitignore || \
{ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
endif
@@ -794,6 +797,18 @@ ifdef need-config
include $(objtree)/include/config/auto.conf
endif
+CC_FLAGS_DIALECT := -std=gnu11
+# Allow including a tagged struct or union anonymously in another struct/union.
+CC_FLAGS_DIALECT += $(CONFIG_CC_MS_EXTENSIONS)
+# Clang enables warnings about GNU and Microsoft extensions by default, disable
+# them because this is expected with the above options.
+ifdef CONFIG_CC_IS_CLANG
+CC_FLAGS_DIALECT += -Wno-gnu
+CC_FLAGS_DIALECT += -Wno-microsoft-anon-tag
+endif
+export CC_FLAGS_DIALECT
+KBUILD_CFLAGS += $(CC_FLAGS_DIALECT)
+
ifeq ($(KBUILD_EXTMOD),)
# Objects we will link into vmlinux / subdirs we need to visit
core-y :=
@@ -990,6 +1005,10 @@ KBUILD_CFLAGS += $(call cc-option, -fno-stack-clash-protection)
# Get details on warnings generated due to GCC value tracking.
KBUILD_CFLAGS += $(call cc-option, -fdiagnostics-show-context=2)
+# Show inlining notes for __attribute__((warning/error)) call chains.
+# GCC supports this unconditionally while Clang 23+ provides a flag.
+KBUILD_CFLAGS += $(call cc-option, -fdiagnostics-show-inlining-chain)
+
# Clear used registers at func exit (to reduce data lifetime and ROP gadgets).
ifdef CONFIG_ZERO_CALL_USED_REGS
KBUILD_CFLAGS += -fzero-call-used-regs=used-gpr
@@ -1052,6 +1071,7 @@ endif
ifdef CONFIG_LTO_CLANG
ifdef CONFIG_LTO_CLANG_THIN
CC_FLAGS_LTO := -flto=thin -fsplit-lto-unit
+KBUILD_LDFLAGS += $(call ld-option,--lto-whole-program-visibility -mllvm -always-rename-promoted-locals=false)
else
CC_FLAGS_LTO := -flto
endif
@@ -1111,9 +1131,6 @@ NOSTDINC_FLAGS += -nostdinc
# perform bounds checking.
KBUILD_CFLAGS += $(call cc-option, -fstrict-flex-arrays=3)
-# Allow including a tagged struct or union anonymously in another struct/union.
-KBUILD_CFLAGS += -fms-extensions
-
# disable invalid "can't wrap" optimizations for signed / pointers
KBUILD_CFLAGS += -fno-strict-overflow

arch/arm64/kernel/vdso32/Makefile

View file
diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
index 9d0efed..bea3675 100644
--- a/arch/arm64/kernel/vdso32/Makefile
+++ b/arch/arm64/kernel/vdso32/Makefile
@@ -63,7 +63,7 @@ VDSO_CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
$(filter -Werror,$(KBUILD_CPPFLAGS)) \
-Werror-implicit-function-declaration \
-Wno-format-security \
- -std=gnu11 -fms-extensions
+ $(CC_FLAGS_DIALECT)
VDSO_CFLAGS += -O2
# Some useful compiler-dependent flags from top-level Makefile
VDSO_CFLAGS += $(call cc32-option,-Wno-pointer-sign)
@@ -71,7 +71,6 @@ VDSO_CFLAGS += -fno-strict-overflow
VDSO_CFLAGS += $(call cc32-option,-Werror=strict-prototypes)
VDSO_CFLAGS += -Werror=date-time
VDSO_CFLAGS += $(call cc32-option,-Werror=incompatible-pointer-types)
-VDSO_CFLAGS += $(if $(CONFIG_CC_IS_CLANG),-Wno-microsoft-anon-tag)
# Compile as THUMB2 or ARM. Unwinding via frame-pointers in THUMB2 is
# unreliable.

arch/hexagon/include/uapi/asm/sigcontext.h

View file
diff --git a/arch/hexagon/include/uapi/asm/sigcontext.h b/arch/hexagon/include/uapi/asm/sigcontext.h
index 7171edb..179a970 100644
--- a/arch/hexagon/include/uapi/asm/sigcontext.h
+++ b/arch/hexagon/include/uapi/asm/sigcontext.h
@@ -29,6 +29,6 @@
*/
struct sigcontext {
struct user_regs_struct sc_regs;
-} __aligned(8);
+} __attribute__((aligned(8)));
#endif

arch/loongarch/vdso/Makefile

View file
diff --git a/arch/loongarch/vdso/Makefile b/arch/loongarch/vdso/Makefile
index 294c16b..42aa962 100644
--- a/arch/loongarch/vdso/Makefile
+++ b/arch/loongarch/vdso/Makefile
@@ -24,7 +24,7 @@ endif
cflags-vdso := $(ccflags-vdso) \
-isystem $(shell $(CC) -print-file-name=include) \
$(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \
- -std=gnu11 -fms-extensions -O2 -g -fno-strict-aliasing -fno-common -fno-builtin \
+ $(CC_FLAGS_DIALECT) -O2 -g -fno-strict-aliasing -fno-common -fno-builtin \
-fno-stack-protector -fno-jump-tables -DDISABLE_BRANCH_PROFILING \
$(call cc-option, -fasynchronous-unwind-tables) \
$(call cc-option, -fno-stack-protector)

arch/mips/Makefile

View file
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index d9057e2..6705fa5 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -421,12 +421,10 @@ CLEAN_FILES += vmlinux.32 vmlinux.64
archprepare:
ifdef CONFIG_MIPS32_N32
- @$(kecho) ' Checking missing-syscalls for N32'
- $(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_flags="-mabi=n32"
+ $(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_instance="N32" missing_syscalls_flags="-mabi=n32"
endif
ifdef CONFIG_MIPS32_O32
- @$(kecho) ' Checking missing-syscalls for O32'
- $(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_flags="-mabi=32"
+ $(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_instance="O32" missing_syscalls_flags="-mabi=32"
endif
install:

arch/parisc/boot/compressed/Makefile

View file
diff --git a/arch/parisc/boot/compressed/Makefile b/arch/parisc/boot/compressed/Makefile
index f8481e4..14eefb5 100644
--- a/arch/parisc/boot/compressed/Makefile
+++ b/arch/parisc/boot/compressed/Makefile
@@ -18,7 +18,7 @@ KBUILD_CFLAGS += -fno-PIE -mno-space-regs -mdisable-fpregs -Os
ifndef CONFIG_64BIT
KBUILD_CFLAGS += -mfast-indirect-calls
endif
-KBUILD_CFLAGS += -std=gnu11 -fms-extensions
+KBUILD_CFLAGS += $(CC_FLAGS_DIALECT)
LDFLAGS_vmlinux := -X -e startup --as-needed -T
$(obj)/vmlinux: $(obj)/vmlinux.lds $(addprefix $(obj)/, $(OBJECTS)) $(LIBGCC) FORCE

arch/powerpc/boot/Makefile

View file
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index f1a4761..7ee0fa2 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -70,7 +70,7 @@ BOOTCPPFLAGS := -nostdinc $(LINUXINCLUDE)
BOOTCPPFLAGS += -isystem $(shell $(BOOTCC) -print-file-name=include)
BOOTCFLAGS := $(BOOTTARGETFLAGS) \
- -std=gnu11 -fms-extensions \
+ $(CC_FLAGS_DIALECT) \
-Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -O2 \
-msoft-float -mno-altivec -mno-vsx \
@@ -86,7 +86,6 @@ BOOTARFLAGS := -crD
ifdef CONFIG_CC_IS_CLANG
BOOTCFLAGS += $(CLANG_FLAGS)
-BOOTCFLAGS += -Wno-microsoft-anon-tag
BOOTAFLAGS += $(CLANG_FLAGS)
endif

arch/s390/Makefile

View file
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index d78ad68..c8d16ac 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -22,7 +22,7 @@ KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__
ifndef CONFIG_AS_IS_LLVM
KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf))
endif
-KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack -std=gnu11 -fms-extensions
+KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack $(CC_FLAGS_DIALECT)
KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
KBUILD_CFLAGS_DECOMPRESSOR += -D__DECOMPRESSOR
KBUILD_CFLAGS_DECOMPRESSOR += -Wno-pointer-sign
@@ -35,7 +35,6 @@ KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning, address-of-packed-membe
KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g)
KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,))
KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_CC_NO_ARRAY_BOUNDS),-Wno-array-bounds)
-KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_CC_IS_CLANG),-Wno-microsoft-anon-tag)
UTS_MACHINE := s390x
STACK_SIZE := $(if $(CONFIG_KASAN),65536,$(if $(CONFIG_KMSAN),65536,16384))

arch/s390/purgatory/Makefile

View file
diff --git a/arch/s390/purgatory/Makefile b/arch/s390/purgatory/Makefile
index 61d240a..95a8ac4 100644
--- a/arch/s390/purgatory/Makefile
+++ b/arch/s390/purgatory/Makefile
@@ -13,7 +13,7 @@ CFLAGS_sha256.o := -D__NO_FORTIFY
$(obj)/mem.o: $(srctree)/arch/s390/lib/mem.S FORCE
$(call if_changed_rule,as_o_S)
-KBUILD_CFLAGS := -std=gnu11 -fms-extensions -fno-strict-aliasing -Wall -Wstrict-prototypes
+KBUILD_CFLAGS := $(CC_FLAGS_DIALECT) -fno-strict-aliasing -Wall -Wstrict-prototypes
KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare
KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding
KBUILD_CFLAGS += -Os -m64 -msoft-float -fno-common
@@ -21,7 +21,6 @@ KBUILD_CFLAGS += -fno-stack-protector
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
KBUILD_CFLAGS += -D__DISABLE_EXPORTS
KBUILD_CFLAGS += $(CLANG_FLAGS)
-KBUILD_CFLAGS += $(if $(CONFIG_CC_IS_CLANG),-Wno-microsoft-anon-tag)
KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
KBUILD_CFLAGS += $(call cc-option, -Wno-default-const-init-unsafe)
KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS))

arch/x86/Makefile

View file
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 5f88146..46fec0b 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -48,7 +48,7 @@ endif
# How to compile the 16-bit code. Note we always compile for -march=i386;
# that way we can complain to the user if the CPU is insufficient.
-REALMODE_CFLAGS := -std=gnu11 -fms-extensions -m16 -g -Os \
+REALMODE_CFLAGS := $(CC_FLAGS_DIALECT) -m16 -g -Os \
-DDISABLE_BRANCH_PROFILING -D__DISABLE_EXPORTS \
-Wall -Wstrict-prototypes -march=i386 -mregparm=3 \
-fno-strict-aliasing -fomit-frame-pointer -fno-pic \
@@ -59,10 +59,6 @@ REALMODE_CFLAGS += -fno-stack-protector
REALMODE_CFLAGS += -Wno-address-of-packed-member
REALMODE_CFLAGS += $(cc_stack_align4)
REALMODE_CFLAGS += $(CLANG_FLAGS)
-ifdef CONFIG_CC_IS_CLANG
-REALMODE_CFLAGS += -Wno-gnu
-REALMODE_CFLAGS += -Wno-microsoft-anon-tag
-endif
export REALMODE_CFLAGS
# BITS is used as extension for files which are available in a 32 bit

arch/x86/boot/compressed/Makefile

View file
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index b8b2b7b..07e0e64 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -25,7 +25,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
# avoid errors with '-march=i386', and future flags may depend on the target to
# be valid.
KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS)
-KBUILD_CFLAGS += -std=gnu11 -fms-extensions
+KBUILD_CFLAGS += $(CC_FLAGS_DIALECT)
KBUILD_CFLAGS += -fno-strict-aliasing -fPIE
KBUILD_CFLAGS += -Wundef
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
@@ -36,10 +36,6 @@ KBUILD_CFLAGS += -mno-mmx -mno-sse
KBUILD_CFLAGS += -ffreestanding -fshort-wchar
KBUILD_CFLAGS += -fno-stack-protector
KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
-ifdef CONFIG_CC_IS_CLANG
-KBUILD_CFLAGS += -Wno-gnu
-KBUILD_CFLAGS += -Wno-microsoft-anon-tag
-endif
KBUILD_CFLAGS += -Wno-pointer-sign
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
KBUILD_CFLAGS += -D__DISABLE_EXPORTS

drivers/firmware/efi/libstub/Makefile

View file
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
index e386ffd..fbb8d4e 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -11,12 +11,11 @@ cflags-y := $(KBUILD_CFLAGS)
cflags-$(CONFIG_X86_32) := -march=i386
cflags-$(CONFIG_X86_64) := -mcmodel=small
-cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -std=gnu11 -fms-extensions \
+cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ $(CC_FLAGS_DIALECT) \
-fPIC -fno-strict-aliasing -mno-red-zone \
-mno-mmx -mno-sse -fshort-wchar \
-Wno-pointer-sign \
$(call cc-disable-warning, address-of-packed-member) \
- $(if $(CONFIG_CC_IS_CLANG),-Wno-gnu -Wno-microsoft-anon-tag) \
-fno-asynchronous-unwind-tables \
$(CLANG_FLAGS)

init/Kconfig

View file
diff --git a/init/Kconfig b/init/Kconfig
index e18fa24..87af5d7 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -969,6 +969,11 @@ config CC_IMPLICIT_FALLTHROUGH
default "-Wimplicit-fallthrough=5" if CC_IS_GCC && $(cc-option,-Wimplicit-fallthrough=5)
default "-Wimplicit-fallthrough" if CC_IS_CLANG && $(cc-option,-Wunreachable-code-fallthrough)
+config CC_MS_EXTENSIONS
+ string
+ default "-fms-anonymous-structs" if $(cc-option,-fms-anonymous-structs)
+ default "-fms-extensions"
+
# Currently, disable gcc-10+ array-bounds globally.
# It's still broken in gcc-13, so no upper bound yet.
config GCC10_NO_ARRAY_BOUNDS

scripts/Makefile.vdsoinst

View file
diff --git a/scripts/Makefile.vdsoinst b/scripts/Makefile.vdsoinst
index ac85f9a..d9f7243 100644
--- a/scripts/Makefile.vdsoinst
+++ b/scripts/Makefile.vdsoinst
@@ -19,9 +19,10 @@ __default: $$(dest)
$$(dest): $(1) FORCE
$$(call cmd,install)
-# Some architectures create .build-id symlinks
-ifneq ($(filter arm s390 sparc x86, $(SRCARCH)),)
-link := $(install-dir)/.build-id/$$(shell $(READELF) -n $(1) | sed -n 's@^.*Build ID: \(..\)\(.*\)@\1/\2@p').debug
+build-id-file := $$(shell $(READELF) -n $(1) 2>/dev/null | sed -n 's@^.*Build ID: \(..\)\(.*\)@\1/\2@p')
+
+ifneq ($$(build-id-file),)
+link := $(install-dir)/.build-id/$$(build-id-file).debug
__default: $$(link)
$$(link): $$(dest) FORCE

scripts/Makefile.warn

View file
diff --git a/scripts/Makefile.warn b/scripts/Makefile.warn
index 5567da6..e77ca87 100644
--- a/scripts/Makefile.warn
+++ b/scripts/Makefile.warn
@@ -28,11 +28,6 @@ endif
KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds
ifdef CONFIG_CC_IS_CLANG
-# The kernel builds with '-std=gnu11' and '-fms-extensions' so use of GNU and
-# Microsoft extensions is acceptable.
-KBUILD_CFLAGS += -Wno-gnu
-KBUILD_CFLAGS += -Wno-microsoft-anon-tag
-
# Clang checks for overflow/truncation with '%p', while GCC does not:
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111219
KBUILD_CFLAGS += $(call cc-option, -Wno-format-overflow-non-kprintf)

scripts/check-uapi.sh

View file
diff --git a/scripts/check-uapi.sh b/scripts/check-uapi.sh
index 9555817..c8beec5 100755
--- a/scripts/check-uapi.sh
+++ b/scripts/check-uapi.sh
@@ -33,9 +33,10 @@ Options:
-v Verbose operation (print more information about each header being checked).
Environmental args:
- ABIDIFF Custom path to abidiff binary
- CC C compiler (default is "gcc")
- ARCH Target architecture for the UAPI check (default is host arch)
+ ABIDIFF Custom path to abidiff binary
+ CROSS_COMPILE Toolchain prefix for compiler
+ CC C compiler (default is "\${CROSS_COMPILE}gcc")
+ ARCH Target architecture for the UAPI check (default is host arch)
Exit codes:
$SUCCESS) Success
@@ -178,8 +179,11 @@ do_compile() {
local -r inc_dir="$1"
local -r header="$2"
local -r out="$3"
- printf "int main(void) { return 0; }\n" | \
- "$CC" -c \
+ printf "int f(void) { return 0; }\n" | \
+ "$CC" \
+ -shared \
+ -nostdlib \
+ -fPIC \
-o "$out" \
-x c \
-O0 \
@@ -187,6 +191,7 @@ do_compile() {
-fno-eliminate-unused-debug-types \
-g \
"-I${inc_dir}" \
+ "-Iusr/dummy-include" \
-include "$header" \
-
}
@@ -195,7 +200,7 @@ do_compile() {
run_make_headers_install() {
local -r ref="$1"
local -r install_dir="$(get_header_tree "$ref")"
- make -j "$MAX_THREADS" ARCH="$ARCH" INSTALL_HDR_PATH="$install_dir" \
+ make -j "$MAX_THREADS" CROSS_COMPILE="${CROSS_COMPILE}" ARCH="$ARCH" INSTALL_HDR_PATH="$install_dir" \
headers_install > /dev/null
}
@@ -404,7 +409,7 @@ min_version_is_satisfied() {
# Make sure we have the tools we need and the arguments make sense
check_deps() {
ABIDIFF="${ABIDIFF:-abidiff}"
- CC="${CC:-gcc}"
+ CC="${CC:-${CROSS_COMPILE}gcc}"
ARCH="${ARCH:-$(uname -m)}"
if [ "$ARCH" = "x86_64" ]; then
ARCH="x86"

scripts/checksyscalls.sh

View file
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
index 1e5d2ee..e297042 100755
--- a/scripts/checksyscalls.sh
+++ b/scripts/checksyscalls.sh
@@ -10,6 +10,10 @@
# checksyscalls.sh gcc gcc-options
#
+set -e
+
+reference_table="$(dirname $0)/../arch/x86/entry/syscalls/syscall_32.tbl"
+
ignore_list() {
cat << EOF
#include <asm/types.h>
@@ -269,5 +273,10 @@ syscall_list() {
done
}
-(ignore_list && syscall_list $(dirname $0)/../arch/x86/entry/syscalls/syscall_32.tbl) | \
+(ignore_list && syscall_list ${reference_table}) | \
$* -Wno-error -Wno-unused-macros -E -x c - > /dev/null
+
+# For fixdep
+if [ -n "${DEPFILE}" ]; then
+ echo "${0}: ${0} ${reference_table}" >> "${DEPFILE}"
+fi

scripts/kconfig/lexer.l

View file
diff --git a/scripts/kconfig/lexer.l b/scripts/kconfig/lexer.l
index 6d2c92c..a615542 100644
--- a/scripts/kconfig/lexer.l
+++ b/scripts/kconfig/lexer.l
@@ -402,7 +402,7 @@ void zconf_initscan(const char *name)
exit(1);
}
- cur_filename = file_lookup(name);
+ cur_filename = file_lookup(name, NULL, 0);
yylineno = 1;
}
@@ -443,7 +443,7 @@ void zconf_nextfile(const char *name)
}
yylineno = 1;
- cur_filename = file_lookup(name);
+ cur_filename = file_lookup(name, cur_filename, cur_lineno);
}
static void zconf_endfile(void)

scripts/kconfig/lkc.h

View file
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 7989859..7e6f6ca 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -51,7 +51,8 @@ static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out)
}
/* util.c */
-const char *file_lookup(const char *name);
+const char *file_lookup(const char *name,
+ const char *parent_name, int parent_lineno);
/* lexer.l */
int yylex(void);

scripts/kconfig/parser.y

View file
diff --git a/scripts/kconfig/parser.y b/scripts/kconfig/parser.y
index 6d1bbee..5fb6f07 100644
--- a/scripts/kconfig/parser.y
+++ b/scripts/kconfig/parser.y
@@ -159,14 +159,8 @@ config_stmt: config_entry_start config_option_list
yynerrs++;
}
- /*
- * If the same symbol appears twice in a choice block, the list
- * node would be added twice, leading to a broken linked list.
- * list_empty() ensures that this symbol has not yet added.
- */
- if (list_empty(&current_entry->sym->choice_link))
- list_add_tail(&current_entry->sym->choice_link,
- &current_choice->choice_members);
+ list_add_tail(&current_entry->sym->choice_link,
+ &current_choice->choice_members);
}
printd(DEBUG_PARSE, "%s:%d:endconfig\n", cur_filename, cur_lineno);
@@ -546,11 +540,10 @@ static int choice_check_sanity(const struct menu *menu)
ret = -1;
}
- if (prop->menu != menu && prop->type == P_PROMPT &&
- prop->menu->parent != menu->parent) {
+ if (prop->menu != menu && prop->type == P_PROMPT) {
fprintf(stderr, "%s:%d: error: %s",
prop->filename, prop->lineno,
- "choice value has a prompt outside its choice group\n");
+ "choice value must not have a prompt in another entry\n");
ret = -1;
}
}

scripts/kconfig/tests/err_repeated_inc/Kconfig

View file
diff --git a/scripts/kconfig/tests/err_repeated_inc/Kconfig b/scripts/kconfig/tests/err_repeated_inc/Kconfig
new file mode 100644
index 0000000..09a88fd
--- /dev/null
+++ b/scripts/kconfig/tests/err_repeated_inc/Kconfig
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+source "Kconfig.inc1"

scripts/kconfig/tests/err_repeated_inc/Kconfig.inc1

View file
diff --git a/scripts/kconfig/tests/err_repeated_inc/Kconfig.inc1 b/scripts/kconfig/tests/err_repeated_inc/Kconfig.inc1
new file mode 100644
index 0000000..495dc38
--- /dev/null
+++ b/scripts/kconfig/tests/err_repeated_inc/Kconfig.inc1
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+source "Kconfig.inc2"
+source "Kconfig.inc3"

scripts/kconfig/tests/err_repeated_inc/Kconfig.inc2

View file
diff --git a/scripts/kconfig/tests/err_repeated_inc/Kconfig.inc2 b/scripts/kconfig/tests/err_repeated_inc/Kconfig.inc2
new file mode 100644
index 0000000..2b630ee
--- /dev/null
+++ b/scripts/kconfig/tests/err_repeated_inc/Kconfig.inc2
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+source "Kconfig.inc3"

scripts/kconfig/tests/err_repeated_inc/Kconfig.inc3

View file

This diff is incomplete. Download the complete patch.

scripts/kconfig/tests/err_repeated_inc/__init__.py

View file

This diff is incomplete. Download the complete patch.

scripts/kconfig/tests/err_repeated_inc/expected_stderr

View file

This diff is incomplete. Download the complete patch.

scripts/kconfig/util.c

View file

This diff is incomplete. Download the complete patch.

tools/scripts/Makefile.include

View file

This diff is incomplete. Download the complete patch.

usr/dummy-include/endian.h

View file

This diff is incomplete. Download the complete patch.

usr/dummy-include/limits.h

View file

This diff is incomplete. Download the complete patch.

usr/dummy-include/netinet/if_ether.h

View file

This diff is incomplete. Download the complete patch.

usr/dummy-include/netinet/in.h

View file

This diff is incomplete. Download the complete patch.

usr/dummy-include/stdbool.h

View before deletion

This diff is incomplete. Download the complete patch.

usr/dummy-include/stddef.h

View file

This diff is incomplete. Download the complete patch.

usr/dummy-include/stdint.h

View file

This diff is incomplete. Download the complete patch.

usr/dummy-include/stdlib.h

View before deletion

This diff is incomplete. Download the complete patch.

usr/dummy-include/string.h

View file

This diff is incomplete. Download the complete patch.

usr/dummy-include/sys/ioctl.h

View file

This diff is incomplete. Download the complete patch.

usr/dummy-include/sys/socket.h

View file

This diff is incomplete. Download the complete patch.

usr/dummy-include/sys/time.h

View file

This diff is incomplete. Download the complete patch.

usr/dummy-include/sys/types.h

View file

This diff is incomplete. Download the complete patch.

usr/dummy-include/time.h

View file

This diff is incomplete. Download the complete patch.

usr/dummy-include/unistd.h

View file

This diff is incomplete. Download the complete patch.

usr/include/Makefile

View file

This diff is incomplete. Download the complete patch.