mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
Merge tag 'kbuild-7.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux
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
...
This commit is contained in:
@@ -71,10 +71,6 @@ recommend::
|
|||||||
|
|
||||||
PATH=/path/to/llvm/:$PATH make LLVM=-14
|
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``
|
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
|
if configuring and building via distinct commands. ``LLVM=`` should also be set
|
||||||
as an environment variable when running scripts that will eventually run
|
as an environment variable when running scripts that will eventually run
|
||||||
|
|||||||
@@ -50,8 +50,10 @@ Absolute filenames
|
|||||||
------------------
|
------------------
|
||||||
|
|
||||||
When the kernel is built out-of-tree, debug information may include
|
When the kernel is built out-of-tree, debug information may include
|
||||||
absolute filenames for the source files. This must be overridden by
|
absolute filenames for the source files and build directory. These must
|
||||||
including the ``-fdebug-prefix-map`` option in the `KCFLAGS`_ variable.
|
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
|
Depending on the compiler used, the ``__FILE__`` macro may also expand
|
||||||
to an absolute filename in an out-of-tree build. Kbuild automatically
|
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_TIMESTAMP: kbuild.html#kbuild-build-timestamp
|
||||||
.. _KBUILD_BUILD_USER and KBUILD_BUILD_HOST: kbuild.html#kbuild-build-user-kbuild-build-host
|
.. _KBUILD_BUILD_USER and KBUILD_BUILD_HOST: kbuild.html#kbuild-build-user-kbuild-build-host
|
||||||
.. _KCFLAGS: kbuild.html#kcflags
|
.. _KCFLAGS: kbuild.html#kcflags
|
||||||
|
.. _KAFLAGS: kbuild.html#kaflags
|
||||||
.. _prefix-map options: https://reproducible-builds.org/docs/build-path/
|
.. _prefix-map options: https://reproducible-builds.org/docs/build-path/
|
||||||
.. _Reproducible Builds project: https://reproducible-builds.org/
|
.. _Reproducible Builds project: https://reproducible-builds.org/
|
||||||
.. _SOURCE_DATE_EPOCH: https://reproducible-builds.org/docs/source-date-epoch/
|
.. _SOURCE_DATE_EPOCH: https://reproducible-builds.org/docs/source-date-epoch/
|
||||||
|
|||||||
14
Kbuild
14
Kbuild
@@ -47,12 +47,18 @@ $(rq-offsets-file): kernel/sched/rq-offsets.s FORCE
|
|||||||
|
|
||||||
# Check for missing system calls
|
# Check for missing system calls
|
||||||
|
|
||||||
quiet_cmd_syscalls = CALL $<
|
missing-syscalls-file := .tmp_missing-syscalls$(missing_syscalls_instance)
|
||||||
cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
|
|
||||||
|
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
|
PHONY += missing-syscalls
|
||||||
missing-syscalls: scripts/checksyscalls.sh $(rq-offsets-file)
|
missing-syscalls: $(missing-syscalls-file)
|
||||||
$(call cmd,syscalls)
|
|
||||||
|
|
||||||
# Check the manual modification of atomic headers
|
# Check the manual modification of atomic headers
|
||||||
|
|
||||||
|
|||||||
35
Makefile
35
Makefile
@@ -591,7 +591,6 @@ LINUXINCLUDE := \
|
|||||||
KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE
|
KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE
|
||||||
|
|
||||||
KBUILD_CFLAGS :=
|
KBUILD_CFLAGS :=
|
||||||
KBUILD_CFLAGS += -std=gnu11
|
|
||||||
KBUILD_CFLAGS += -fshort-wchar
|
KBUILD_CFLAGS += -fshort-wchar
|
||||||
KBUILD_CFLAGS += -funsigned-char
|
KBUILD_CFLAGS += -funsigned-char
|
||||||
KBUILD_CFLAGS += -fno-common
|
KBUILD_CFLAGS += -fno-common
|
||||||
@@ -680,14 +679,19 @@ print_env_for_makefile = \
|
|||||||
echo "export KBUILD_OUTPUT = $(CURDIR)"
|
echo "export KBUILD_OUTPUT = $(CURDIR)"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
quiet_cmd_makefile = GEN Makefile
|
filechk_makefile = { \
|
||||||
cmd_makefile = { \
|
|
||||||
echo "\# Automatically generated by $(abs_srctree)/Makefile: don't edit"; \
|
echo "\# Automatically generated by $(abs_srctree)/Makefile: don't edit"; \
|
||||||
$(print_env_for_makefile); \
|
$(print_env_for_makefile); \
|
||||||
echo "include $(abs_srctree)/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),)
|
ifeq ($(KBUILD_EXTMOD),)
|
||||||
@if [ -f $(srctree)/.config -o \
|
@if [ -f $(srctree)/.config -o \
|
||||||
-d $(srctree)/include/config -o \
|
-d $(srctree)/include/config -o \
|
||||||
@@ -708,7 +712,6 @@ else
|
|||||||
fi
|
fi
|
||||||
endif
|
endif
|
||||||
$(Q)ln -fsn $(srcroot) source
|
$(Q)ln -fsn $(srcroot) source
|
||||||
$(call cmd,makefile)
|
|
||||||
$(Q)test -e .gitignore || \
|
$(Q)test -e .gitignore || \
|
||||||
{ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
|
{ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
|
||||||
endif
|
endif
|
||||||
@@ -794,6 +797,18 @@ ifdef need-config
|
|||||||
include $(objtree)/include/config/auto.conf
|
include $(objtree)/include/config/auto.conf
|
||||||
endif
|
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),)
|
ifeq ($(KBUILD_EXTMOD),)
|
||||||
# Objects we will link into vmlinux / subdirs we need to visit
|
# Objects we will link into vmlinux / subdirs we need to visit
|
||||||
core-y :=
|
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.
|
# Get details on warnings generated due to GCC value tracking.
|
||||||
KBUILD_CFLAGS += $(call cc-option, -fdiagnostics-show-context=2)
|
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).
|
# Clear used registers at func exit (to reduce data lifetime and ROP gadgets).
|
||||||
ifdef CONFIG_ZERO_CALL_USED_REGS
|
ifdef CONFIG_ZERO_CALL_USED_REGS
|
||||||
KBUILD_CFLAGS += -fzero-call-used-regs=used-gpr
|
KBUILD_CFLAGS += -fzero-call-used-regs=used-gpr
|
||||||
@@ -1052,6 +1071,7 @@ endif
|
|||||||
ifdef CONFIG_LTO_CLANG
|
ifdef CONFIG_LTO_CLANG
|
||||||
ifdef CONFIG_LTO_CLANG_THIN
|
ifdef CONFIG_LTO_CLANG_THIN
|
||||||
CC_FLAGS_LTO := -flto=thin -fsplit-lto-unit
|
CC_FLAGS_LTO := -flto=thin -fsplit-lto-unit
|
||||||
|
KBUILD_LDFLAGS += $(call ld-option,--lto-whole-program-visibility -mllvm -always-rename-promoted-locals=false)
|
||||||
else
|
else
|
||||||
CC_FLAGS_LTO := -flto
|
CC_FLAGS_LTO := -flto
|
||||||
endif
|
endif
|
||||||
@@ -1111,9 +1131,6 @@ NOSTDINC_FLAGS += -nostdinc
|
|||||||
# perform bounds checking.
|
# perform bounds checking.
|
||||||
KBUILD_CFLAGS += $(call cc-option, -fstrict-flex-arrays=3)
|
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
|
# disable invalid "can't wrap" optimizations for signed / pointers
|
||||||
KBUILD_CFLAGS += -fno-strict-overflow
|
KBUILD_CFLAGS += -fno-strict-overflow
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ VDSO_CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
|
|||||||
$(filter -Werror,$(KBUILD_CPPFLAGS)) \
|
$(filter -Werror,$(KBUILD_CPPFLAGS)) \
|
||||||
-Werror-implicit-function-declaration \
|
-Werror-implicit-function-declaration \
|
||||||
-Wno-format-security \
|
-Wno-format-security \
|
||||||
-std=gnu11 -fms-extensions
|
$(CC_FLAGS_DIALECT)
|
||||||
VDSO_CFLAGS += -O2
|
VDSO_CFLAGS += -O2
|
||||||
# Some useful compiler-dependent flags from top-level Makefile
|
# Some useful compiler-dependent flags from top-level Makefile
|
||||||
VDSO_CFLAGS += $(call cc32-option,-Wno-pointer-sign)
|
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 += $(call cc32-option,-Werror=strict-prototypes)
|
||||||
VDSO_CFLAGS += -Werror=date-time
|
VDSO_CFLAGS += -Werror=date-time
|
||||||
VDSO_CFLAGS += $(call cc32-option,-Werror=incompatible-pointer-types)
|
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
|
# Compile as THUMB2 or ARM. Unwinding via frame-pointers in THUMB2 is
|
||||||
# unreliable.
|
# unreliable.
|
||||||
|
|||||||
@@ -29,6 +29,6 @@
|
|||||||
*/
|
*/
|
||||||
struct sigcontext {
|
struct sigcontext {
|
||||||
struct user_regs_struct sc_regs;
|
struct user_regs_struct sc_regs;
|
||||||
} __aligned(8);
|
} __attribute__((aligned(8)));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ endif
|
|||||||
cflags-vdso := $(ccflags-vdso) \
|
cflags-vdso := $(ccflags-vdso) \
|
||||||
-isystem $(shell $(CC) -print-file-name=include) \
|
-isystem $(shell $(CC) -print-file-name=include) \
|
||||||
$(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \
|
$(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 \
|
-fno-stack-protector -fno-jump-tables -DDISABLE_BRANCH_PROFILING \
|
||||||
$(call cc-option, -fasynchronous-unwind-tables) \
|
$(call cc-option, -fasynchronous-unwind-tables) \
|
||||||
$(call cc-option, -fno-stack-protector)
|
$(call cc-option, -fno-stack-protector)
|
||||||
|
|||||||
@@ -421,12 +421,10 @@ CLEAN_FILES += vmlinux.32 vmlinux.64
|
|||||||
|
|
||||||
archprepare:
|
archprepare:
|
||||||
ifdef CONFIG_MIPS32_N32
|
ifdef CONFIG_MIPS32_N32
|
||||||
@$(kecho) ' Checking missing-syscalls for N32'
|
$(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_instance="N32" missing_syscalls_flags="-mabi=n32"
|
||||||
$(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_flags="-mabi=n32"
|
|
||||||
endif
|
endif
|
||||||
ifdef CONFIG_MIPS32_O32
|
ifdef CONFIG_MIPS32_O32
|
||||||
@$(kecho) ' Checking missing-syscalls for O32'
|
$(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_instance="O32" missing_syscalls_flags="-mabi=32"
|
||||||
$(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_flags="-mabi=32"
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ KBUILD_CFLAGS += -fno-PIE -mno-space-regs -mdisable-fpregs -Os
|
|||||||
ifndef CONFIG_64BIT
|
ifndef CONFIG_64BIT
|
||||||
KBUILD_CFLAGS += -mfast-indirect-calls
|
KBUILD_CFLAGS += -mfast-indirect-calls
|
||||||
endif
|
endif
|
||||||
KBUILD_CFLAGS += -std=gnu11 -fms-extensions
|
KBUILD_CFLAGS += $(CC_FLAGS_DIALECT)
|
||||||
|
|
||||||
LDFLAGS_vmlinux := -X -e startup --as-needed -T
|
LDFLAGS_vmlinux := -X -e startup --as-needed -T
|
||||||
$(obj)/vmlinux: $(obj)/vmlinux.lds $(addprefix $(obj)/, $(OBJECTS)) $(LIBGCC) FORCE
|
$(obj)/vmlinux: $(obj)/vmlinux.lds $(addprefix $(obj)/, $(OBJECTS)) $(LIBGCC) FORCE
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ BOOTCPPFLAGS := -nostdinc $(LINUXINCLUDE)
|
|||||||
BOOTCPPFLAGS += -isystem $(shell $(BOOTCC) -print-file-name=include)
|
BOOTCPPFLAGS += -isystem $(shell $(BOOTCC) -print-file-name=include)
|
||||||
|
|
||||||
BOOTCFLAGS := $(BOOTTARGETFLAGS) \
|
BOOTCFLAGS := $(BOOTTARGETFLAGS) \
|
||||||
-std=gnu11 -fms-extensions \
|
$(CC_FLAGS_DIALECT) \
|
||||||
-Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
|
-Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
|
||||||
-fno-strict-aliasing -O2 \
|
-fno-strict-aliasing -O2 \
|
||||||
-msoft-float -mno-altivec -mno-vsx \
|
-msoft-float -mno-altivec -mno-vsx \
|
||||||
@@ -86,7 +86,6 @@ BOOTARFLAGS := -crD
|
|||||||
|
|
||||||
ifdef CONFIG_CC_IS_CLANG
|
ifdef CONFIG_CC_IS_CLANG
|
||||||
BOOTCFLAGS += $(CLANG_FLAGS)
|
BOOTCFLAGS += $(CLANG_FLAGS)
|
||||||
BOOTCFLAGS += -Wno-microsoft-anon-tag
|
|
||||||
BOOTAFLAGS += $(CLANG_FLAGS)
|
BOOTAFLAGS += $(CLANG_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__
|
|||||||
ifndef CONFIG_AS_IS_LLVM
|
ifndef CONFIG_AS_IS_LLVM
|
||||||
KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf))
|
KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf))
|
||||||
endif
|
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 += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
|
||||||
KBUILD_CFLAGS_DECOMPRESSOR += -D__DECOMPRESSOR
|
KBUILD_CFLAGS_DECOMPRESSOR += -D__DECOMPRESSOR
|
||||||
KBUILD_CFLAGS_DECOMPRESSOR += -Wno-pointer-sign
|
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),-g)
|
||||||
KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,))
|
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_NO_ARRAY_BOUNDS),-Wno-array-bounds)
|
||||||
KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_CC_IS_CLANG),-Wno-microsoft-anon-tag)
|
|
||||||
|
|
||||||
UTS_MACHINE := s390x
|
UTS_MACHINE := s390x
|
||||||
STACK_SIZE := $(if $(CONFIG_KASAN),65536,$(if $(CONFIG_KMSAN),65536,16384))
|
STACK_SIZE := $(if $(CONFIG_KASAN),65536,$(if $(CONFIG_KMSAN),65536,16384))
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ CFLAGS_sha256.o := -D__NO_FORTIFY
|
|||||||
$(obj)/mem.o: $(srctree)/arch/s390/lib/mem.S FORCE
|
$(obj)/mem.o: $(srctree)/arch/s390/lib/mem.S FORCE
|
||||||
$(call if_changed_rule,as_o_S)
|
$(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 += -Wno-pointer-sign -Wno-sign-compare
|
||||||
KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding
|
KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding
|
||||||
KBUILD_CFLAGS += -Os -m64 -msoft-float -fno-common
|
KBUILD_CFLAGS += -Os -m64 -msoft-float -fno-common
|
||||||
@@ -21,7 +21,6 @@ KBUILD_CFLAGS += -fno-stack-protector
|
|||||||
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
|
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
|
||||||
KBUILD_CFLAGS += -D__DISABLE_EXPORTS
|
KBUILD_CFLAGS += -D__DISABLE_EXPORTS
|
||||||
KBUILD_CFLAGS += $(CLANG_FLAGS)
|
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,-fno-PIE)
|
||||||
KBUILD_CFLAGS += $(call cc-option, -Wno-default-const-init-unsafe)
|
KBUILD_CFLAGS += $(call cc-option, -Wno-default-const-init-unsafe)
|
||||||
KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS))
|
KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS))
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ endif
|
|||||||
|
|
||||||
# How to compile the 16-bit code. Note we always compile for -march=i386;
|
# 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.
|
# 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 \
|
-DDISABLE_BRANCH_PROFILING -D__DISABLE_EXPORTS \
|
||||||
-Wall -Wstrict-prototypes -march=i386 -mregparm=3 \
|
-Wall -Wstrict-prototypes -march=i386 -mregparm=3 \
|
||||||
-fno-strict-aliasing -fomit-frame-pointer -fno-pic \
|
-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 += -Wno-address-of-packed-member
|
||||||
REALMODE_CFLAGS += $(cc_stack_align4)
|
REALMODE_CFLAGS += $(cc_stack_align4)
|
||||||
REALMODE_CFLAGS += $(CLANG_FLAGS)
|
REALMODE_CFLAGS += $(CLANG_FLAGS)
|
||||||
ifdef CONFIG_CC_IS_CLANG
|
|
||||||
REALMODE_CFLAGS += -Wno-gnu
|
|
||||||
REALMODE_CFLAGS += -Wno-microsoft-anon-tag
|
|
||||||
endif
|
|
||||||
export REALMODE_CFLAGS
|
export REALMODE_CFLAGS
|
||||||
|
|
||||||
# BITS is used as extension for files which are available in a 32 bit
|
# BITS is used as extension for files which are available in a 32 bit
|
||||||
|
|||||||
@@ -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
|
# avoid errors with '-march=i386', and future flags may depend on the target to
|
||||||
# be valid.
|
# be valid.
|
||||||
KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS)
|
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 += -fno-strict-aliasing -fPIE
|
||||||
KBUILD_CFLAGS += -Wundef
|
KBUILD_CFLAGS += -Wundef
|
||||||
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
|
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
|
||||||
@@ -36,10 +36,6 @@ KBUILD_CFLAGS += -mno-mmx -mno-sse
|
|||||||
KBUILD_CFLAGS += -ffreestanding -fshort-wchar
|
KBUILD_CFLAGS += -ffreestanding -fshort-wchar
|
||||||
KBUILD_CFLAGS += -fno-stack-protector
|
KBUILD_CFLAGS += -fno-stack-protector
|
||||||
KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
|
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 += -Wno-pointer-sign
|
||||||
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
|
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
|
||||||
KBUILD_CFLAGS += -D__DISABLE_EXPORTS
|
KBUILD_CFLAGS += -D__DISABLE_EXPORTS
|
||||||
|
|||||||
@@ -11,12 +11,11 @@ cflags-y := $(KBUILD_CFLAGS)
|
|||||||
|
|
||||||
cflags-$(CONFIG_X86_32) := -march=i386
|
cflags-$(CONFIG_X86_32) := -march=i386
|
||||||
cflags-$(CONFIG_X86_64) := -mcmodel=small
|
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 \
|
-fPIC -fno-strict-aliasing -mno-red-zone \
|
||||||
-mno-mmx -mno-sse -fshort-wchar \
|
-mno-mmx -mno-sse -fshort-wchar \
|
||||||
-Wno-pointer-sign \
|
-Wno-pointer-sign \
|
||||||
$(call cc-disable-warning, address-of-packed-member) \
|
$(call cc-disable-warning, address-of-packed-member) \
|
||||||
$(if $(CONFIG_CC_IS_CLANG),-Wno-gnu -Wno-microsoft-anon-tag) \
|
|
||||||
-fno-asynchronous-unwind-tables \
|
-fno-asynchronous-unwind-tables \
|
||||||
$(CLANG_FLAGS)
|
$(CLANG_FLAGS)
|
||||||
|
|
||||||
|
|||||||
@@ -969,6 +969,11 @@ config CC_IMPLICIT_FALLTHROUGH
|
|||||||
default "-Wimplicit-fallthrough=5" if CC_IS_GCC && $(cc-option,-Wimplicit-fallthrough=5)
|
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)
|
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.
|
# Currently, disable gcc-10+ array-bounds globally.
|
||||||
# It's still broken in gcc-13, so no upper bound yet.
|
# It's still broken in gcc-13, so no upper bound yet.
|
||||||
config GCC10_NO_ARRAY_BOUNDS
|
config GCC10_NO_ARRAY_BOUNDS
|
||||||
|
|||||||
@@ -19,9 +19,10 @@ __default: $$(dest)
|
|||||||
$$(dest): $(1) FORCE
|
$$(dest): $(1) FORCE
|
||||||
$$(call cmd,install)
|
$$(call cmd,install)
|
||||||
|
|
||||||
# Some architectures create .build-id symlinks
|
build-id-file := $$(shell $(READELF) -n $(1) 2>/dev/null | sed -n 's@^.*Build ID: \(..\)\(.*\)@\1/\2@p')
|
||||||
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
|
ifneq ($$(build-id-file),)
|
||||||
|
link := $(install-dir)/.build-id/$$(build-id-file).debug
|
||||||
|
|
||||||
__default: $$(link)
|
__default: $$(link)
|
||||||
$$(link): $$(dest) FORCE
|
$$(link): $$(dest) FORCE
|
||||||
|
|||||||
@@ -28,11 +28,6 @@ endif
|
|||||||
KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds
|
KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds
|
||||||
|
|
||||||
ifdef CONFIG_CC_IS_CLANG
|
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:
|
# Clang checks for overflow/truncation with '%p', while GCC does not:
|
||||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111219
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111219
|
||||||
KBUILD_CFLAGS += $(call cc-option, -Wno-format-overflow-non-kprintf)
|
KBUILD_CFLAGS += $(call cc-option, -Wno-format-overflow-non-kprintf)
|
||||||
|
|||||||
@@ -33,9 +33,10 @@ Options:
|
|||||||
-v Verbose operation (print more information about each header being checked).
|
-v Verbose operation (print more information about each header being checked).
|
||||||
|
|
||||||
Environmental args:
|
Environmental args:
|
||||||
ABIDIFF Custom path to abidiff binary
|
ABIDIFF Custom path to abidiff binary
|
||||||
CC C compiler (default is "gcc")
|
CROSS_COMPILE Toolchain prefix for compiler
|
||||||
ARCH Target architecture for the UAPI check (default is host arch)
|
CC C compiler (default is "\${CROSS_COMPILE}gcc")
|
||||||
|
ARCH Target architecture for the UAPI check (default is host arch)
|
||||||
|
|
||||||
Exit codes:
|
Exit codes:
|
||||||
$SUCCESS) Success
|
$SUCCESS) Success
|
||||||
@@ -178,8 +179,11 @@ do_compile() {
|
|||||||
local -r inc_dir="$1"
|
local -r inc_dir="$1"
|
||||||
local -r header="$2"
|
local -r header="$2"
|
||||||
local -r out="$3"
|
local -r out="$3"
|
||||||
printf "int main(void) { return 0; }\n" | \
|
printf "int f(void) { return 0; }\n" | \
|
||||||
"$CC" -c \
|
"$CC" \
|
||||||
|
-shared \
|
||||||
|
-nostdlib \
|
||||||
|
-fPIC \
|
||||||
-o "$out" \
|
-o "$out" \
|
||||||
-x c \
|
-x c \
|
||||||
-O0 \
|
-O0 \
|
||||||
@@ -187,6 +191,7 @@ do_compile() {
|
|||||||
-fno-eliminate-unused-debug-types \
|
-fno-eliminate-unused-debug-types \
|
||||||
-g \
|
-g \
|
||||||
"-I${inc_dir}" \
|
"-I${inc_dir}" \
|
||||||
|
"-Iusr/dummy-include" \
|
||||||
-include "$header" \
|
-include "$header" \
|
||||||
-
|
-
|
||||||
}
|
}
|
||||||
@@ -195,7 +200,7 @@ do_compile() {
|
|||||||
run_make_headers_install() {
|
run_make_headers_install() {
|
||||||
local -r ref="$1"
|
local -r ref="$1"
|
||||||
local -r install_dir="$(get_header_tree "$ref")"
|
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
|
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
|
# Make sure we have the tools we need and the arguments make sense
|
||||||
check_deps() {
|
check_deps() {
|
||||||
ABIDIFF="${ABIDIFF:-abidiff}"
|
ABIDIFF="${ABIDIFF:-abidiff}"
|
||||||
CC="${CC:-gcc}"
|
CC="${CC:-${CROSS_COMPILE}gcc}"
|
||||||
ARCH="${ARCH:-$(uname -m)}"
|
ARCH="${ARCH:-$(uname -m)}"
|
||||||
if [ "$ARCH" = "x86_64" ]; then
|
if [ "$ARCH" = "x86_64" ]; then
|
||||||
ARCH="x86"
|
ARCH="x86"
|
||||||
|
|||||||
@@ -10,6 +10,10 @@
|
|||||||
# checksyscalls.sh gcc gcc-options
|
# checksyscalls.sh gcc gcc-options
|
||||||
#
|
#
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
reference_table="$(dirname $0)/../arch/x86/entry/syscalls/syscall_32.tbl"
|
||||||
|
|
||||||
ignore_list() {
|
ignore_list() {
|
||||||
cat << EOF
|
cat << EOF
|
||||||
#include <asm/types.h>
|
#include <asm/types.h>
|
||||||
@@ -269,5 +273,10 @@ syscall_list() {
|
|||||||
done
|
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
|
$* -Wno-error -Wno-unused-macros -E -x c - > /dev/null
|
||||||
|
|
||||||
|
# For fixdep
|
||||||
|
if [ -n "${DEPFILE}" ]; then
|
||||||
|
echo "${0}: ${0} ${reference_table}" >> "${DEPFILE}"
|
||||||
|
fi
|
||||||
|
|||||||
@@ -402,7 +402,7 @@ void zconf_initscan(const char *name)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_filename = file_lookup(name);
|
cur_filename = file_lookup(name, NULL, 0);
|
||||||
yylineno = 1;
|
yylineno = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -443,7 +443,7 @@ void zconf_nextfile(const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
yylineno = 1;
|
yylineno = 1;
|
||||||
cur_filename = file_lookup(name);
|
cur_filename = file_lookup(name, cur_filename, cur_lineno);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void zconf_endfile(void)
|
static void zconf_endfile(void)
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* util.c */
|
/* 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 */
|
/* lexer.l */
|
||||||
int yylex(void);
|
int yylex(void);
|
||||||
|
|||||||
@@ -159,14 +159,8 @@ config_stmt: config_entry_start config_option_list
|
|||||||
yynerrs++;
|
yynerrs++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
list_add_tail(¤t_entry->sym->choice_link,
|
||||||
* If the same symbol appears twice in a choice block, the list
|
¤t_choice->choice_members);
|
||||||
* node would be added twice, leading to a broken linked list.
|
|
||||||
* list_empty() ensures that this symbol has not yet added.
|
|
||||||
*/
|
|
||||||
if (list_empty(¤t_entry->sym->choice_link))
|
|
||||||
list_add_tail(¤t_entry->sym->choice_link,
|
|
||||||
¤t_choice->choice_members);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printd(DEBUG_PARSE, "%s:%d:endconfig\n", cur_filename, cur_lineno);
|
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;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prop->menu != menu && prop->type == P_PROMPT &&
|
if (prop->menu != menu && prop->type == P_PROMPT) {
|
||||||
prop->menu->parent != menu->parent) {
|
|
||||||
fprintf(stderr, "%s:%d: error: %s",
|
fprintf(stderr, "%s:%d: error: %s",
|
||||||
prop->filename, prop->lineno,
|
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;
|
ret = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
3
scripts/kconfig/tests/err_repeated_inc/Kconfig
Normal file
3
scripts/kconfig/tests/err_repeated_inc/Kconfig
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
|
||||||
|
source "Kconfig.inc1"
|
||||||
4
scripts/kconfig/tests/err_repeated_inc/Kconfig.inc1
Normal file
4
scripts/kconfig/tests/err_repeated_inc/Kconfig.inc1
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
|
||||||
|
source "Kconfig.inc2"
|
||||||
|
source "Kconfig.inc3"
|
||||||
3
scripts/kconfig/tests/err_repeated_inc/Kconfig.inc2
Normal file
3
scripts/kconfig/tests/err_repeated_inc/Kconfig.inc2
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
|
||||||
|
source "Kconfig.inc3"
|
||||||
1
scripts/kconfig/tests/err_repeated_inc/Kconfig.inc3
Normal file
1
scripts/kconfig/tests/err_repeated_inc/Kconfig.inc3
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
10
scripts/kconfig/tests/err_repeated_inc/__init__.py
Normal file
10
scripts/kconfig/tests/err_repeated_inc/__init__.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
"""
|
||||||
|
Detect repeated inclusion error.
|
||||||
|
|
||||||
|
If repeated inclusion is detected, it should fail with error message.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def test(conf):
|
||||||
|
assert conf.oldaskconfig() != 0
|
||||||
|
assert conf.stderr_contains('expected_stderr')
|
||||||
2
scripts/kconfig/tests/err_repeated_inc/expected_stderr
Normal file
2
scripts/kconfig/tests/err_repeated_inc/expected_stderr
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
Kconfig.inc1:4: error: Repeated inclusion of Kconfig.inc3
|
||||||
|
Kconfig.inc2:3: note: Location of first inclusion of Kconfig.inc3
|
||||||
@@ -18,25 +18,50 @@ static HASHTABLE_DEFINE(file_hashtable, 1U << 11);
|
|||||||
|
|
||||||
struct file {
|
struct file {
|
||||||
struct hlist_node node;
|
struct hlist_node node;
|
||||||
|
struct {
|
||||||
|
const char *name;
|
||||||
|
int lineno;
|
||||||
|
} parent;
|
||||||
char name[];
|
char name[];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* file already present in list? If not add it */
|
static void die_duplicated_include(struct file *file,
|
||||||
const char *file_lookup(const char *name)
|
const char *parent, int lineno)
|
||||||
{
|
{
|
||||||
|
fprintf(stderr,
|
||||||
|
"%s:%d: error: repeated inclusion of %s\n"
|
||||||
|
"%s:%d: note: location of first inclusion of %s\n",
|
||||||
|
parent, lineno, file->name,
|
||||||
|
file->parent.name, file->parent.lineno, file->name);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* file already present in list? If not add it */
|
||||||
|
const char *file_lookup(const char *name,
|
||||||
|
const char *parent_name, int parent_lineno)
|
||||||
|
{
|
||||||
|
const char *parent = NULL;
|
||||||
struct file *file;
|
struct file *file;
|
||||||
size_t len;
|
size_t len;
|
||||||
int hash = hash_str(name);
|
int hash = hash_str(name);
|
||||||
|
|
||||||
|
if (parent_name)
|
||||||
|
parent = file_lookup(parent_name, NULL, 0);
|
||||||
|
|
||||||
hash_for_each_possible(file_hashtable, file, node, hash)
|
hash_for_each_possible(file_hashtable, file, node, hash)
|
||||||
if (!strcmp(name, file->name))
|
if (!strcmp(name, file->name)) {
|
||||||
return file->name;
|
if (!parent_name)
|
||||||
|
return file->name;
|
||||||
|
die_duplicated_include(file, parent, parent_lineno);
|
||||||
|
}
|
||||||
|
|
||||||
len = strlen(name);
|
len = strlen(name);
|
||||||
file = xmalloc(sizeof(*file) + len + 1);
|
file = xmalloc(sizeof(*file) + len + 1);
|
||||||
memset(file, 0, sizeof(*file));
|
memset(file, 0, sizeof(*file));
|
||||||
memcpy(file->name, name, len);
|
memcpy(file->name, name, len);
|
||||||
file->name[len] = '\0';
|
file->name[len] = '\0';
|
||||||
|
file->parent.name = parent;
|
||||||
|
file->parent.lineno = parent_lineno;
|
||||||
|
|
||||||
hash_add(file_hashtable, &file->node, hash);
|
hash_add(file_hashtable, &file->node, hash);
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ ifneq ($(filter %/,$(LLVM)),)
|
|||||||
LLVM_PREFIX := $(LLVM)
|
LLVM_PREFIX := $(LLVM)
|
||||||
else ifneq ($(filter -%,$(LLVM)),)
|
else ifneq ($(filter -%,$(LLVM)),)
|
||||||
LLVM_SUFFIX := $(LLVM)
|
LLVM_SUFFIX := $(LLVM)
|
||||||
|
else ifneq ($(LLVM),1)
|
||||||
|
$(error Invalid value for LLVM, see Documentation/kbuild/llvm.rst)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(call allow-override,CC,$(LLVM_PREFIX)clang$(LLVM_SUFFIX))
|
$(call allow-override,CC,$(LLVM_PREFIX)clang$(LLVM_SUFFIX))
|
||||||
|
|||||||
0
usr/dummy-include/endian.h
Normal file
0
usr/dummy-include/endian.h
Normal file
8
usr/dummy-include/limits.h
Normal file
8
usr/dummy-include/limits.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
#ifndef _DUMMY_LIMITS_H
|
||||||
|
#define _DUMMY_LIMITS_H
|
||||||
|
|
||||||
|
#define INT_MAX ((int)(~0U >> 1))
|
||||||
|
#define INT_MIN (-INT_MAX - 1)
|
||||||
|
|
||||||
|
#endif /* _DUMMY_LIMITS_H */
|
||||||
0
usr/dummy-include/netinet/if_ether.h
Normal file
0
usr/dummy-include/netinet/if_ether.h
Normal file
0
usr/dummy-include/netinet/in.h
Normal file
0
usr/dummy-include/netinet/in.h
Normal file
@@ -1,7 +0,0 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
||||||
#ifndef _STDBOOL_H
|
|
||||||
#define _STDBOOL_H
|
|
||||||
|
|
||||||
#error "Please do not include <stdbool.h> from exported headers"
|
|
||||||
|
|
||||||
#endif /* _STDBOOL_H */
|
|
||||||
13
usr/dummy-include/stddef.h
Normal file
13
usr/dummy-include/stddef.h
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
#ifndef _DUMMY_STDDEF_H
|
||||||
|
#define _DUMMY_STDDEF_H
|
||||||
|
|
||||||
|
#define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define NULL 0
|
||||||
|
#else
|
||||||
|
#define NULL ((void *)0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _DUMMY_STDDEF_H */
|
||||||
17
usr/dummy-include/stdint.h
Normal file
17
usr/dummy-include/stdint.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
#ifndef _DUMMY_STDINT_H
|
||||||
|
#define _DUMMY_STDINT_H
|
||||||
|
|
||||||
|
#include <linux/types.h>
|
||||||
|
|
||||||
|
typedef __u64 uint64_t;
|
||||||
|
typedef __u32 uint32_t;
|
||||||
|
typedef __u16 uint16_t;
|
||||||
|
typedef __u8 uint8_t;
|
||||||
|
|
||||||
|
typedef __s64 int64_t;
|
||||||
|
typedef __s32 int32_t;
|
||||||
|
typedef __s16 int16_t;
|
||||||
|
typedef __s8 int8_t;
|
||||||
|
|
||||||
|
#endif /* _DUMMY_STDINT_H */
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
||||||
#ifndef _STDLIB_H
|
|
||||||
#define _STDLIB_H
|
|
||||||
|
|
||||||
#error "Please do not include <stdlib.h> from exported headers"
|
|
||||||
|
|
||||||
#endif /* _STDLIB_H */
|
|
||||||
12
usr/dummy-include/string.h
Normal file
12
usr/dummy-include/string.h
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
#ifndef _DUMMY_STRING_H
|
||||||
|
#define _DUMMY_STRING_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#define memset(_s, _c, _n) __builtin_memset(_s, _c, _n)
|
||||||
|
#define memcpy(_dest, _src, _n) __builtin_memcpy(_dest, _src, _n)
|
||||||
|
|
||||||
|
#define strlen(_s) __builtin_strlen(_s)
|
||||||
|
|
||||||
|
#endif /* _DUMMY_STRING_H */
|
||||||
0
usr/dummy-include/sys/ioctl.h
Normal file
0
usr/dummy-include/sys/ioctl.h
Normal file
12
usr/dummy-include/sys/socket.h
Normal file
12
usr/dummy-include/sys/socket.h
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
#ifndef _DUMMY_SYS_SOCKET_H
|
||||||
|
#define _DUMMY_SYS_SOCKET_H
|
||||||
|
|
||||||
|
#include <linux/socket.h>
|
||||||
|
|
||||||
|
struct sockaddr {
|
||||||
|
__kernel_sa_family_t sa_family; /* address family, AF_xxx */
|
||||||
|
char sa_data[14]; /* 14 bytes of protocol address */
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* _DUMMY_SYS_SOCKET_H */
|
||||||
3
usr/dummy-include/sys/time.h
Normal file
3
usr/dummy-include/sys/time.h
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
|
||||||
|
#include <linux/time.h>
|
||||||
0
usr/dummy-include/sys/types.h
Normal file
0
usr/dummy-include/sys/types.h
Normal file
0
usr/dummy-include/time.h
Normal file
0
usr/dummy-include/time.h
Normal file
0
usr/dummy-include/unistd.h
Normal file
0
usr/dummy-include/unistd.h
Normal file
@@ -7,8 +7,10 @@
|
|||||||
# -std=c90 (equivalent to -ansi) catches the violation of those.
|
# -std=c90 (equivalent to -ansi) catches the violation of those.
|
||||||
# We cannot go as far as adding -Wpedantic since it emits too many warnings.
|
# We cannot go as far as adding -Wpedantic since it emits too many warnings.
|
||||||
UAPI_CFLAGS := -std=c90 -Werror=implicit-function-declaration
|
UAPI_CFLAGS := -std=c90 -Werror=implicit-function-declaration
|
||||||
|
UAPI_ARCH := $(or $(HEADER_ARCH),$(SRCARCH))
|
||||||
|
|
||||||
override c_flags = $(KBUILD_USERCFLAGS) $(UAPI_CFLAGS) -Wp,-MMD,$(depfile) -I $(obj) -I $(srctree)/usr/dummy-include
|
override c_flags = $(KBUILD_USERCFLAGS) $(UAPI_CFLAGS) -Wp,-MMD,$(depfile)
|
||||||
|
cxx_flags = $(filter-out -Wmissing-prototypes -Wstrict-prototypes -std=%, $(KBUILD_USERCFLAGS)) -std=c++98
|
||||||
|
|
||||||
# The following are excluded for now because they fail to build.
|
# The following are excluded for now because they fail to build.
|
||||||
#
|
#
|
||||||
@@ -48,30 +50,39 @@ no-header-test += xen/privcmd.h
|
|||||||
|
|
||||||
# More headers are broken in some architectures
|
# More headers are broken in some architectures
|
||||||
|
|
||||||
ifeq ($(SRCARCH),arc)
|
ifneq ($(filter arc openrisc xtensa nios2, $(UAPI_ARCH)),)
|
||||||
no-header-test += linux/bpf_perf_event.h
|
no-header-test += linux/bpf_perf_event.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(SRCARCH),openrisc)
|
ifeq ($(UAPI_ARCH),sparc)
|
||||||
no-header-test += linux/bpf_perf_event.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(SRCARCH),powerpc)
|
|
||||||
no-header-test += linux/bpf_perf_event.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(SRCARCH),sparc)
|
|
||||||
no-header-test += asm/uctx.h
|
no-header-test += asm/uctx.h
|
||||||
no-header-test += asm/fbio.h
|
no-header-test += asm/fbio.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(SRCARCH),xtensa)
|
|
||||||
no-header-test += linux/bpf_perf_event.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
# asm-generic/*.h is used by asm/*.h, and should not be included directly
|
# asm-generic/*.h is used by asm/*.h, and should not be included directly
|
||||||
no-header-test += asm-generic/%
|
no-header-test += asm-generic/%
|
||||||
|
|
||||||
|
# The following are not compatible with C++.
|
||||||
|
#
|
||||||
|
# Do not add a new header to the list without legitimate reason.
|
||||||
|
# Please consider to fix the header first.
|
||||||
|
#
|
||||||
|
# Sorted alphabetically.
|
||||||
|
no-header-test-cxx += linux/auto_dev-ioctl.h
|
||||||
|
no-header-test-cxx += linux/map_to_14segment.h
|
||||||
|
no-header-test-cxx += linux/map_to_7segment.h
|
||||||
|
no-header-test-cxx += linux/netfilter/xt_sctp.h
|
||||||
|
no-header-test-cxx += linux/target_core_user.h
|
||||||
|
no-header-test-cxx += linux/vhost.h
|
||||||
|
no-header-test-cxx += linux/vhost_types.h
|
||||||
|
no-header-test-cxx += linux/virtio_net.h
|
||||||
|
no-header-test-cxx += linux/virtio_ring.h
|
||||||
|
no-header-test-cxx += scsi/fc/fc_els.h
|
||||||
|
|
||||||
|
ifeq ($(UAPI_ARCH),x86)
|
||||||
|
no-header-test-cxx += asm/elf.h
|
||||||
|
endif
|
||||||
|
|
||||||
# The following are using libc header and types.
|
# The following are using libc header and types.
|
||||||
#
|
#
|
||||||
# Do not add a new header to the list without legitimate reason.
|
# Do not add a new header to the list without legitimate reason.
|
||||||
@@ -134,32 +145,38 @@ uses-libc += linux/wireless.h
|
|||||||
uses-libc += regulator/regulator.h
|
uses-libc += regulator/regulator.h
|
||||||
uses-libc += scsi/fc/fc_els.h
|
uses-libc += scsi/fc/fc_els.h
|
||||||
|
|
||||||
ifeq ($(SRCARCH),hexagon)
|
ifeq ($(UAPI_ARCH),hexagon)
|
||||||
uses-libc += asm/sigcontext.h
|
uses-libc += asm/sigcontext.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(SRCARCH),nios2)
|
ifeq ($(UAPI_ARCH),nios2)
|
||||||
uses-libc += asm/ptrace.h
|
uses-libc += asm/ptrace.h
|
||||||
uses-libc += linux/bpf_perf_event.h
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(SRCARCH),s390)
|
ifeq ($(UAPI_ARCH),s390)
|
||||||
uses-libc += asm/chpid.h
|
uses-libc += asm/chpid.h
|
||||||
uses-libc += asm/chsc.h
|
uses-libc += asm/chsc.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
always-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h' 2>/dev/null))
|
always-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h' 2>/dev/null))
|
||||||
|
|
||||||
target-no-libc = $(filter-out $(uses-libc), $*.h)
|
# $(cc-option) forces '-x c' which breaks '-x c++' detection.
|
||||||
target-can-compile = $(and $(filter-out $(no-header-test), $*.h), \
|
cc-can-compile-cxx := $(call try-run,$(CC) $(CLANG_FLAGS) -c -x c++ /dev/null -o "$$TMP", 1)
|
||||||
$(or $(CONFIG_CC_CAN_LINK), $(target-no-libc)))
|
|
||||||
|
target-libc = $(filter $(uses-libc), $*.h)
|
||||||
|
target-can-compile = $(filter-out $(no-header-test), $*.h)
|
||||||
|
target-can-compile-cxx = $(and $(cc-can-compile-cxx), $(target-can-compile), $(filter-out $(no-header-test-cxx), $*.h))
|
||||||
|
|
||||||
|
hdrtest-flags = -fsyntax-only -Werror \
|
||||||
|
-nostdinc -I $(obj) $(if $(target-libc), -I $(srctree)/usr/dummy-include)
|
||||||
|
|
||||||
# Include the header twice to detect missing include guard.
|
# Include the header twice to detect missing include guard.
|
||||||
quiet_cmd_hdrtest = HDRTEST $<
|
quiet_cmd_hdrtest = HDRTEST $<
|
||||||
cmd_hdrtest = \
|
cmd_hdrtest = \
|
||||||
$(CC) $(c_flags) -fsyntax-only -Werror -x c /dev/null \
|
$(CC) $(c_flags) $(hdrtest-flags) -x c /dev/null \
|
||||||
$(if $(target-no-libc), -nostdinc) \
|
|
||||||
$(if $(target-can-compile), -include $< -include $<); \
|
$(if $(target-can-compile), -include $< -include $<); \
|
||||||
|
$(if $(target-can-compile-cxx), \
|
||||||
|
$(CC) $(cxx_flags) $(hdrtest-flags) -x c++ /dev/null -include $<;) \
|
||||||
$(PERL) $(src)/headers_check.pl $(obj) $<; \
|
$(PERL) $(src)/headers_check.pl $(obj) $<; \
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user