Commit 5b67fbfc authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'kbuild-v5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild updates from Masahiro Yamada:
 "Build system:

   - add CONFIG_UNUSED_KSYMS_WHITELIST, which will be useful to define a
     fixed set of export symbols for Generic Kernel Image (GKI)

   - allow to run 'make dt_binding_check' without .config

   - use full schema for checking DT examples in *.yaml files

   - make modpost fail for missing MODULE_IMPORT_NS(), which makes more
     sense because we know the produced modules are never loadable

   - Remove unused 'AS' variable

  Kconfig:

   - sanitize DEFCONFIG_LIST, and remove ARCH_DEFCONFIG from Kconfig
     files

   - relax the 'imply' behavior so that symbols implied by 'y' can
     become 'm'

   - make 'imply' obey 'depends on' in order to make 'imply' really weak

  Misc:

   - add documentation on building the kernel with Clang/LLVM

   - revive __HAVE_ARCH_STRLEN for 32bit sparc to use optimized strlen()

   - fix warning from deb-pkg builds when CONFIG_DEBUG_INFO=n

   - various script and Makefile cleanups"

* tag 'kbuild-v5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (34 commits)
  Makefile: Update kselftest help information
  kbuild: deb-pkg: fix warning when CONFIG_DEBUG_INFO is unset
  kbuild: add outputmakefile to no-dot-config-targets
  kbuild: remove AS variable
  net: wan: wanxl: refactor the firmware rebuild rule
  net: wan: wanxl: use $(M68KCC) instead of $(M68KAS) for rebuilding firmware
  net: wan: wanxl: use allow to pass CROSS_COMPILE_M68k for rebuilding firmware
  kbuild: add comment about grouped target
  kbuild: add -Wall to KBUILD_HOSTCXXFLAGS
  kconfig: remove unused variable in qconf.cc
  sparc: revive __HAVE_ARCH_STRLEN for 32bit sparc
  kbuild: refactor Makefile.dtbinst more
  kbuild: compute the dtbs_install destination more simply
  Makefile: disallow data races on gcc-10 as well
  kconfig: make 'imply' obey the direct dependency
  kconfig: allow symbols implied by y to become m
  net: drop_monitor: use IS_REACHABLE() to guard net_dm_hw_report()
  modpost: return error if module is missing ns imports and MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS=n
  modpost: rework and consolidate logging interface
  kbuild: allow to run dt_binding_check without kernel configuration
  ...
parents a1629843 e51d8dac
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
# Makefile for Sphinx documentation # Makefile for Sphinx documentation
# #
subdir-y := devicetree/bindings/ # for cleaning
subdir- := devicetree/bindings
# Check for broken documentation file references # Check for broken documentation file references
ifeq ($(CONFIG_WARN_MISSING_DOCUMENTS),y) ifeq ($(CONFIG_WARN_MISSING_DOCUMENTS),y)
......
*.example.dts *.example.dts
processed-schema.yaml processed-schema*.yaml
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
DT_DOC_CHECKER ?= dt-doc-validate DT_DOC_CHECKER ?= dt-doc-validate
DT_EXTRACT_EX ?= dt-extract-example DT_EXTRACT_EX ?= dt-extract-example
DT_MK_SCHEMA ?= dt-mk-schema DT_MK_SCHEMA ?= dt-mk-schema
DT_MK_SCHEMA_FLAGS := $(if $(DT_SCHEMA_FILES), -u)
quiet_cmd_chk_binding = CHKDT $(patsubst $(srctree)/%,%,$<) quiet_cmd_chk_binding = CHKDT $(patsubst $(srctree)/%,%,$<)
cmd_chk_binding = $(DT_DOC_CHECKER) -u $(srctree)/$(src) $< ; \ cmd_chk_binding = $(DT_DOC_CHECKER) -u $(srctree)/$(src) $< ; \
...@@ -11,26 +10,35 @@ quiet_cmd_chk_binding = CHKDT $(patsubst $(srctree)/%,%,$<) ...@@ -11,26 +10,35 @@ quiet_cmd_chk_binding = CHKDT $(patsubst $(srctree)/%,%,$<)
$(obj)/%.example.dts: $(src)/%.yaml FORCE $(obj)/%.example.dts: $(src)/%.yaml FORCE
$(call if_changed,chk_binding) $(call if_changed,chk_binding)
DT_TMP_SCHEMA := processed-schema.yaml # Use full schemas when checking %.example.dts
DT_TMP_SCHEMA := $(obj)/processed-schema-examples.yaml
quiet_cmd_mk_schema = SCHEMA $@ quiet_cmd_mk_schema = SCHEMA $@
cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(real-prereqs) cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(real-prereqs)
DT_DOCS = $(shell \ DT_DOCS = $(addprefix $(src)/, \
$(shell \
cd $(srctree)/$(src) && \ cd $(srctree)/$(src) && \
find * \( -name '*.yaml' ! \ find * \( -name '*.yaml' ! \
-name $(DT_TMP_SCHEMA) ! \ -name 'processed-schema*' ! \
-name '*.example.dt.yaml' \) \ -name '*.example.dt.yaml' \) \
) ))
DT_SCHEMA_FILES ?= $(addprefix $(src)/,$(DT_DOCS)) DT_SCHEMA_FILES ?= $(DT_DOCS)
ifeq ($(CHECK_DTBS),) extra-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES))
extra-y += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES)) extra-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dt.yaml, $(DT_SCHEMA_FILES))
extra-y += $(patsubst $(src)/%.yaml,%.example.dt.yaml, $(DT_SCHEMA_FILES)) extra-$(CHECK_DT_BINDING) += processed-schema-examples.yaml
endif
$(obj)/$(DT_TMP_SCHEMA): $(DT_SCHEMA_FILES) FORCE override DTC_FLAGS := \
-Wno-avoid_unnecessary_addr_size \
-Wno-graph_child_address
$(obj)/processed-schema-examples.yaml: $(DT_DOCS) FORCE
$(call if_changed,mk_schema)
$(obj)/processed-schema.yaml: DT_MK_SCHEMA_FLAGS := -u
$(obj)/processed-schema.yaml: $(DT_SCHEMA_FILES) FORCE
$(call if_changed,mk_schema) $(call if_changed,mk_schema)
extra-y += $(DT_TMP_SCHEMA) extra-y += processed-schema.yaml
...@@ -147,6 +147,10 @@ Note that ``dtbs_check`` will skip any binding schema files with errors. It is ...@@ -147,6 +147,10 @@ Note that ``dtbs_check`` will skip any binding schema files with errors. It is
necessary to use ``dt_binding_check`` to get all the validation errors in the necessary to use ``dt_binding_check`` to get all the validation errors in the
binding schema files. binding schema files.
It is possible to run both in a single command::
make dt_binding_check dtbs_check
It is also possible to run checks with a single schema file by setting the It is also possible to run checks with a single schema file by setting the
``DT_SCHEMA_FILES`` variable to a specific schema file. ``DT_SCHEMA_FILES`` variable to a specific schema file.
......
...@@ -20,6 +20,7 @@ Kernel Build System ...@@ -20,6 +20,7 @@ Kernel Build System
issues issues
reproducible-builds reproducible-builds
gcc-plugins gcc-plugins
llvm
.. only:: subproject and html .. only:: subproject and html
......
...@@ -159,11 +159,11 @@ applicable everywhere (see syntax). ...@@ -159,11 +159,11 @@ applicable everywhere (see syntax).
Given the following example:: Given the following example::
config FOO config FOO
tristate tristate "foo"
imply BAZ imply BAZ
config BAZ config BAZ
tristate tristate "baz"
depends on BAR depends on BAR
The following values are possible: The following values are possible:
...@@ -173,7 +173,10 @@ applicable everywhere (see syntax). ...@@ -173,7 +173,10 @@ applicable everywhere (see syntax).
=== === ============= ============== === === ============= ==============
n y n N/m/y n y n N/m/y
m y m M/y/n m y m M/y/n
y y y Y/n y y y Y/m/n
n m n N/m
m m m M/n
y m n M/n
y n * N y n * N
=== === ============= ============== === === ============= ==============
...@@ -181,6 +184,24 @@ applicable everywhere (see syntax). ...@@ -181,6 +184,24 @@ applicable everywhere (see syntax).
ability to hook into a secondary subsystem while allowing the user to ability to hook into a secondary subsystem while allowing the user to
configure that subsystem out without also having to unset these drivers. configure that subsystem out without also having to unset these drivers.
Note: If the combination of FOO=y and BAR=m causes a link error,
you can guard the function call with IS_REACHABLE()::
foo_init()
{
if (IS_REACHABLE(CONFIG_BAZ))
baz_register(&foo);
...
}
Note: If the feature provided by BAZ is highly desirable for FOO,
FOO should imply not only BAZ, but also its dependency BAR::
config FOO
tristate "foo"
imply BAR
imply BAZ
- limiting menu display: "visible if" <expr> - limiting menu display: "visible if" <expr>
This attribute is only applicable to menu blocks, if the condition is This attribute is only applicable to menu blocks, if the condition is
......
==============================
Building Linux with Clang/LLVM
==============================
This document covers how to build the Linux kernel with Clang and LLVM
utilities.
About
-----
The Linux kernel has always traditionally been compiled with GNU toolchains
such as GCC and binutils. Ongoing work has allowed for `Clang
<https://clang.llvm.org/>`_ and `LLVM <https://llvm.org/>`_ utilities to be
used as viable substitutes. Distributions such as `Android
<https://www.android.com/>`_, `ChromeOS
<https://www.chromium.org/chromium-os>`_, and `OpenMandriva
<https://www.openmandriva.org/>`_ use Clang built kernels. `LLVM is a
collection of toolchain components implemented in terms of C++ objects
<https://www.aosabook.org/en/llvm.html>`_. Clang is a front-end to LLVM that
supports C and the GNU C extensions required by the kernel, and is pronounced
"klang," not "see-lang."
Clang
-----
The compiler used can be swapped out via `CC=` command line argument to `make`.
`CC=` should be set when selecting a config and during a build.
make CC=clang defconfig
make CC=clang
Cross Compiling
---------------
A single Clang compiler binary will typically contain all supported backends,
which can help simplify cross compiling.
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang
`CROSS_COMPILE` is not used to prefix the Clang compiler binary, instead
`CROSS_COMPILE` is used to set a command line flag: `--target <triple>`. For
example:
clang --target aarch64-linux-gnu foo.c
LLVM Utilities
--------------
LLVM has substitutes for GNU binutils utilities. These can be invoked as
additional parameters to `make`.
make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \\
OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-objsize \\
READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \\
HOSTLD=ld.lld
Getting Help
------------
- `Website <https://clangbuiltlinux.github.io/>`_
- `Mailing List <https://groups.google.com/forum/#!forum/clang-built-linux>`_: <clang-built-linux@googlegroups.com>
- `Issue Tracker <https://github.com/ClangBuiltLinux/linux/issues>`_
- IRC: #clangbuiltlinux on chat.freenode.net
- `Telegram <https://t.me/ClangBuiltLinux>`_: @ClangBuiltLinux
- `Wiki <https://github.com/ClangBuiltLinux/linux/wiki>`_
- `Beginner Bugs <https://github.com/ClangBuiltLinux/linux/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22>`_
Getting LLVM
-------------
- http://releases.llvm.org/download.html
- https://github.com/llvm/llvm-project
- https://llvm.org/docs/GettingStarted.html
- https://llvm.org/docs/CMake.html
- https://apt.llvm.org/
- https://www.archlinux.org/packages/extra/x86_64/llvm/
- https://github.com/ClangBuiltLinux/tc-build
- https://github.com/ClangBuiltLinux/linux/wiki/Building-Clang-from-source
- https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/
...@@ -4139,6 +4139,7 @@ B: https://github.com/ClangBuiltLinux/linux/issues ...@@ -4139,6 +4139,7 @@ B: https://github.com/ClangBuiltLinux/linux/issues
C: irc://chat.freenode.net/clangbuiltlinux C: irc://chat.freenode.net/clangbuiltlinux
S: Supported S: Supported
K: \b(?i:clang|llvm)\b K: \b(?i:clang|llvm)\b
F: Documentation/kbuild/llvm.rst
CLEANCACHE API CLEANCACHE API
M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
......
...@@ -255,7 +255,8 @@ clean-targets := %clean mrproper cleandocs ...@@ -255,7 +255,8 @@ clean-targets := %clean mrproper cleandocs
no-dot-config-targets := $(clean-targets) \ no-dot-config-targets := $(clean-targets) \
cscope gtags TAGS tags help% %docs check% coccicheck \ cscope gtags TAGS tags help% %docs check% coccicheck \
$(version_h) headers headers_% archheaders archscripts \ $(version_h) headers headers_% archheaders archscripts \
%asm-generic kernelversion %src-pkg %asm-generic kernelversion %src-pkg dt_binding_check \
outputmakefile
no-sync-config-targets := $(no-dot-config-targets) install %install \ no-sync-config-targets := $(no-dot-config-targets) install %install \
kernelrelease kernelrelease
single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/ single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
...@@ -388,6 +389,9 @@ endif ...@@ -388,6 +389,9 @@ endif
KCONFIG_CONFIG ?= .config KCONFIG_CONFIG ?= .config
export KCONFIG_CONFIG export KCONFIG_CONFIG
# Default file for 'make defconfig'. This may be overridden by arch-Makefile.
export KBUILD_DEFCONFIG := defconfig
# SHELL used by kbuild # SHELL used by kbuild
CONFIG_SHELL := sh CONFIG_SHELL := sh
...@@ -400,12 +404,11 @@ HOSTCXX = g++ ...@@ -400,12 +404,11 @@ HOSTCXX = g++
KBUILD_HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \ KBUILD_HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \
-fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS) \ -fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS) \
$(HOSTCFLAGS) $(HOSTCFLAGS)
KBUILD_HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS) KBUILD_HOSTCXXFLAGS := -Wall -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS)
KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS) KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS)
KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS) KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
# Make variables (CC, etc...) # Make variables (CC, etc...)
AS = $(CROSS_COMPILE)as
LD = $(CROSS_COMPILE)ld LD = $(CROSS_COMPILE)ld
CC = $(CROSS_COMPILE)gcc CC = $(CROSS_COMPILE)gcc
CPP = $(CC) -E CPP = $(CC) -E
...@@ -472,7 +475,7 @@ KBUILD_LDFLAGS := ...@@ -472,7 +475,7 @@ KBUILD_LDFLAGS :=
GCC_PLUGINS_CFLAGS := GCC_PLUGINS_CFLAGS :=
CLANG_FLAGS := CLANG_FLAGS :=
export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC
export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE READELF PAHOLE LEX YACC AWK INSTALLKERNEL export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE READELF PAHOLE LEX YACC AWK INSTALLKERNEL
export PERL PYTHON PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX export PERL PYTHON PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX
export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE
...@@ -535,7 +538,7 @@ endif ...@@ -535,7 +538,7 @@ endif
ifneq ($(GCC_TOOLCHAIN),) ifneq ($(GCC_TOOLCHAIN),)
CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN) CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN)
endif endif
ifeq ($(shell $(AS) --version 2>&1 | head -n 1 | grep clang),) ifeq ($(if $(AS),$(shell $(AS) --version 2>&1 | head -n 1 | grep clang)),)
CLANG_FLAGS += -no-integrated-as CLANG_FLAGS += -no-integrated-as
endif endif
CLANG_FLAGS += -Werror=unknown-warning-option CLANG_FLAGS += -Werror=unknown-warning-option
...@@ -674,6 +677,7 @@ $(KCONFIG_CONFIG): ...@@ -674,6 +677,7 @@ $(KCONFIG_CONFIG):
# #
# This exploits the 'multi-target pattern rule' trick. # This exploits the 'multi-target pattern rule' trick.
# The syncconfig should be executed only once to make all the targets. # The syncconfig should be executed only once to make all the targets.
# (Note: use the grouped target '&:' when we bump to GNU Make 4.3)
%/auto.conf %/auto.conf.cmd: $(KCONFIG_CONFIG) %/auto.conf %/auto.conf.cmd: $(KCONFIG_CONFIG)
$(Q)$(MAKE) -f $(srctree)/Makefile syncconfig $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
else # !may-sync-config else # !may-sync-config
...@@ -714,6 +718,7 @@ endif ...@@ -714,6 +718,7 @@ endif
# Tell gcc to never replace conditional load with a non-conditional one # Tell gcc to never replace conditional load with a non-conditional one
KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races)
include scripts/Makefile.kcov include scripts/Makefile.kcov
include scripts/Makefile.gcc-plugins include scripts/Makefile.gcc-plugins
...@@ -729,7 +734,7 @@ KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \ ...@@ -729,7 +734,7 @@ KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
endif endif
ifneq ($(CONFIG_FRAME_WARN),0) ifneq ($(CONFIG_FRAME_WARN),0)
KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) KBUILD_CFLAGS += -Wframe-larger-than=$(CONFIG_FRAME_WARN)
endif endif
stackp-flags-$(CONFIG_CC_HAS_STACKPROTECTOR_NONE) := -fno-stack-protector stackp-flags-$(CONFIG_CC_HAS_STACKPROTECTOR_NONE) := -fno-stack-protector
...@@ -1063,9 +1068,12 @@ endif ...@@ -1063,9 +1068,12 @@ endif
autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h) autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h)
quiet_cmd_autoksyms_h = GEN $@
cmd_autoksyms_h = mkdir -p $(dir $@); \
$(CONFIG_SHELL) $(srctree)/scripts/gen_autoksyms.sh $@
$(autoksyms_h): $(autoksyms_h):
$(Q)mkdir -p $(dir $@) $(call cmd,autoksyms_h)
$(Q)touch $@
ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
...@@ -1240,14 +1248,18 @@ ifneq ($(dtstree),) ...@@ -1240,14 +1248,18 @@ ifneq ($(dtstree),)
$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
PHONY += dtbs dtbs_install dtbs_check PHONY += dtbs dtbs_install dtbs_check
dtbs dtbs_check: include/config/kernel.release scripts_dtc dtbs: include/config/kernel.release scripts_dtc
$(Q)$(MAKE) $(build)=$(dtstree) $(Q)$(MAKE) $(build)=$(dtstree)
dtbs_check: export CHECK_DTBS=1 ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),)
dtbs_check: dt_binding_check export CHECK_DTBS=y
dtbs: dt_binding_check
endif
dtbs_check: dtbs
dtbs_install: dtbs_install:
$(Q)$(MAKE) $(dtbinst)=$(dtstree) $(Q)$(MAKE) $(dtbinst)=$(dtstree) dst=$(INSTALL_DTBS_PATH)
ifdef CONFIG_OF_EARLY_FLATTREE ifdef CONFIG_OF_EARLY_FLATTREE
all: dtbs all: dtbs
...@@ -1259,6 +1271,10 @@ PHONY += scripts_dtc ...@@ -1259,6 +1271,10 @@ PHONY += scripts_dtc
scripts_dtc: scripts_basic scripts_dtc: scripts_basic
$(Q)$(MAKE) $(build)=scripts/dtc $(Q)$(MAKE) $(build)=scripts/dtc
ifneq ($(filter dt_binding_check, $(MAKECMDGOALS)),)
export CHECK_DT_BINDING=y
endif
PHONY += dt_binding_check PHONY += dt_binding_check
dt_binding_check: scripts_dtc dt_binding_check: scripts_dtc
$(Q)$(MAKE) $(build)=Documentation/devicetree/bindings $(Q)$(MAKE) $(build)=Documentation/devicetree/bindings
...@@ -1470,12 +1486,15 @@ help: ...@@ -1470,12 +1486,15 @@ help:
@echo ' nsdeps - Generate missing symbol namespace dependencies' @echo ' nsdeps - Generate missing symbol namespace dependencies'
@echo '' @echo ''
@echo 'Kernel selftest:' @echo 'Kernel selftest:'
@echo ' kselftest - Build and run kernel selftest (run as root)' @echo ' kselftest - Build and run kernel selftest'
@echo ' Build, install, and boot kernel before' @echo ' Build, install, and boot kernel before'
@echo ' running kselftest on it' @echo ' running kselftest on it'
@echo ' Run as root for full coverage'
@echo ' kselftest-all - Build kernel selftest'
@echo ' kselftest-install - Build and install kernel selftest'
@echo ' kselftest-clean - Remove all generated kselftest files' @echo ' kselftest-clean - Remove all generated kselftest files'
@echo ' kselftest-merge - Merge all the config dependencies of kselftest to existing' @echo ' kselftest-merge - Merge all the config dependencies of'
@echo ' .config.' @echo ' kselftest to existing .config.'
@echo '' @echo ''
@$(if $(dtstree), \ @$(if $(dtstree), \
echo 'Devicetree:'; \ echo 'Devicetree:'; \
......
...@@ -87,11 +87,6 @@ config SUPERH64 ...@@ -87,11 +87,6 @@ config SUPERH64
select HAVE_EXIT_THREAD select HAVE_EXIT_THREAD
select KALLSYMS select KALLSYMS
config ARCH_DEFCONFIG
string
default "arch/sh/configs/shx3_defconfig" if SUPERH32
default "arch/sh/configs/cayman_defconfig" if SUPERH64
config GENERIC_BUG config GENERIC_BUG
def_bool y def_bool y
depends on BUG && SUPERH32 depends on BUG && SUPERH32
......
...@@ -96,11 +96,6 @@ config SPARC64 ...@@ -96,11 +96,6 @@ config SPARC64
select PCI_DOMAINS if PCI select PCI_DOMAINS if PCI
select ARCH_HAS_GIGANTIC_PAGE select ARCH_HAS_GIGANTIC_PAGE
config ARCH_DEFCONFIG
string
default "arch/sparc/configs/sparc32_defconfig" if SPARC32
default "arch/sparc/configs/sparc64_defconfig" if SPARC64
config ARCH_PROC_KCORE_TEXT config ARCH_PROC_KCORE_TEXT
def_bool y def_bool y
......
...@@ -37,6 +37,10 @@ void *memmove(void *, const void *, __kernel_size_t); ...@@ -37,6 +37,10 @@ void *memmove(void *, const void *, __kernel_size_t);
#define __HAVE_ARCH_MEMCMP #define __HAVE_ARCH_MEMCMP
int memcmp(const void *,const void *,__kernel_size_t); int memcmp(const void *,const void *,__kernel_size_t);
/* Now the str*() stuff... */
#define __HAVE_ARCH_STRLEN
__kernel_size_t strlen(const char *);
#define __HAVE_ARCH_STRNCMP #define __HAVE_ARCH_STRNCMP
int strncmp(const char *, const char *, __kernel_size_t); int strncmp(const char *, const char *, __kernel_size_t);
......
...@@ -12,8 +12,4 @@ ...@@ -12,8 +12,4 @@
#include <asm/asi.h> #include <asm/asi.h>
/* Now the str*() stuff... */
#define __HAVE_ARCH_STRLEN
__kernel_size_t strlen(const char *);
#endif /* !(__SPARC64_STRING_H__) */ #endif /* !(__SPARC64_STRING_H__) */
...@@ -240,11 +240,6 @@ config OUTPUT_FORMAT ...@@ -240,11 +240,6 @@ config OUTPUT_FORMAT
default "elf32-i386" if X86_32 default "elf32-i386" if X86_32
default "elf64-x86-64" if X86_64 default "elf64-x86-64" if X86_64
config ARCH_DEFCONFIG
string
default "arch/x86/configs/i386_defconfig" if X86_32
default "arch/x86/configs/x86_64_defconfig" if X86_64
config LOCKDEP_SUPPORT config LOCKDEP_SUPPORT
def_bool y def_bool y
......
...@@ -27,11 +27,6 @@ config X86_64 ...@@ -27,11 +27,6 @@ config X86_64
def_bool 64BIT def_bool 64BIT
select MODULES_USE_ELF_RELA select MODULES_USE_ELF_RELA
config ARCH_DEFCONFIG
string
default "arch/um/configs/i386_defconfig" if X86_32
default "arch/um/configs/x86_64_defconfig" if X86_64
config 3_LEVEL_PGTABLES config 3_LEVEL_PGTABLES
bool "Three-level pagetables" if !64BIT bool "Three-level pagetables" if !64BIT
default 64BIT default 64BIT
......
...@@ -200,7 +200,7 @@ config WANXL_BUILD_FIRMWARE ...@@ -200,7 +200,7 @@ config WANXL_BUILD_FIRMWARE
depends on WANXL && !PREVENT_FIRMWARE_BUILD depends on WANXL && !PREVENT_FIRMWARE_BUILD
help help
Allows you to rebuild firmware run by the QUICC processor. Allows you to rebuild firmware run by the QUICC processor.
It requires as68k, ld68k and hexdump programs. It requires m68k toolchains and hexdump programs.
You should never need this option, say N. You should never need this option, say N.
......
...@@ -40,21 +40,30 @@ $(obj)/wanxl.o: $(obj)/wanxlfw.inc ...@@ -40,21 +40,30 @@ $(obj)/wanxl.o: $(obj)/wanxlfw.inc
ifeq ($(CONFIG_WANXL_BUILD_FIRMWARE),y) ifeq ($(CONFIG_WANXL_BUILD_FIRMWARE),y)
ifeq ($(ARCH),m68k) ifeq ($(ARCH),m68k)
AS68K = $(AS) M68KCC = $(CC)
LD68K = $(LD) M68KLD = $(LD)
else else
AS68K = as68k M68KCC = $(CROSS_COMPILE_M68K)gcc
LD68K = ld68k M68KLD = $(CROSS_COMPILE_M68K)ld
endif endif
quiet_cmd_build_wanxlfw = BLD FW $@ quiet_cmd_build_wanxlfw = BLDFW $@
cmd_build_wanxlfw = \ cmd_build_wanxlfw = hexdump -ve '"\n" 16/1 "0x%02X,"' $< | \
$(CPP) -D__ASSEMBLY__ -Wp,-MD,$(depfile) -I$(srctree)/include/uapi $< | $(AS68K) -m68360 -o $(obj)/wanxlfw.o; \ sed 's/0x ,//g;1s/^/static const u8 firmware[]={/;$$s/,$$/\n};\n/' > $@
$(LD68K) --oformat binary -Ttext 0x1000 $(obj)/wanxlfw.o -o $(obj)/wanxlfw.bin; \
hexdump -ve '"\n" 16/1 "0x%02X,"' $(obj)/wanxlfw.bin | sed 's/0x ,//g;1s/^/static const u8 firmware[]={/;$$s/,$$/\n};\n/' >$(obj)/wanxlfw.inc; \
rm -f $(obj)/wanxlfw.bin $(obj)/wanxlfw.o
$(obj)/wanxlfw.inc: $(src)/wanxlfw.S $(obj)/wanxlfw.inc: $(obj)/wanxlfw.bin FORCE
$(call if_changed_dep,build_wanxlfw) $(call if_changed,build_wanxlfw)
targets += wanxlfw.inc
quiet_cmd_m68kld_bin_o = M68KLD $@
cmd_m68kld_bin_o = $(M68KLD) --oformat binary -Ttext 0x1000 $< -o $@
$(obj)/wanxlfw.bin: $(obj)/wanxlfw.o FORCE
$(call if_changed,m68kld_bin_o)
quiet_cmd_m68kas_o_S = M68KAS $@
cmd_m68kas_o_S = $(M68KCC) -D__ASSEMBLY__ -Wp,-MD,$(depfile) -I$(srctree)/include/uapi -c -o $@ $<
$(obj)/wanxlfw.o: $(src)/wanxlfw.S FORCE
$(call if_changed_dep,m68kas_o_S)
endif endif
targets += wanxlfw.inc wanxlfw.bin wanxlfw.o
...@@ -19,7 +19,7 @@ struct net_dm_hw_metadata { ...@@ -19,7 +19,7 @@ struct net_dm_hw_metadata {
struct net_device *input_dev; struct net_device *input_dev;
}; };
#if IS_ENABLED(CONFIG_NET_DROP_MONITOR) #if IS_REACHABLE(CONFIG_NET_DROP_MONITOR)
void net_dm_hw_report(struct sk_buff *skb, void net_dm_hw_report(struct sk_buff *skb,
const struct net_dm_hw_metadata *hw_metadata); const struct net_dm_hw_metadata *hw_metadata);
#else #else
......
...@@ -6,8 +6,7 @@ config DEFCONFIG_LIST ...@@ -6,8 +6,7 @@ config DEFCONFIG_LIST
default "/lib/modules/$(shell,uname -r)/.config" default "/lib/modules/$(shell,uname -r)/.config"
default "/etc/kernel-config" default "/etc/kernel-config"
default "/boot/config-$(shell,uname -r)" default "/boot/config-$(shell,uname -r)"
default ARCH_DEFCONFIG default "arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)"
default "arch/$(ARCH)/defconfig"
config CC_IS_GCC config CC_IS_GCC
def_bool $(success,$(CC) --version | head -n 1 | grep -q gcc) def_bool $(success,$(CC) --version | head -n 1 | grep -q gcc)
...@@ -2211,6 +2210,19 @@ config TRIM_UNUSED_KSYMS ...@@ -2211,6 +2210,19 @@ config TRIM_UNUSED_KSYMS
If unsure, or if you need to build out-of-tree modules, say N. If unsure, or if you need to build out-of-tree modules, say N.
config UNUSED_KSYMS_WHITELIST
string "Whitelist of symbols to keep in ksymtab"
depends on TRIM_UNUSED_KSYMS
help
By default, all unused exported symbols will be un-exported from the
build when TRIM_UNUSED_KSYMS is selected.
UNUSED_KSYMS_WHITELIST allows to whitelist symbols that must be kept
exported at all times, even in absence of in-tree users. The value to
set here is the path to a text file containing the list of symbols,
one per line. The path can be absolute, or relative to the kernel
source tree.
endif # MODULES endif # MODULES
config MODULES_TREE_LOOKUP config MODULES_TREE_LOOKUP
......
...@@ -266,7 +266,7 @@ config ENABLE_MUST_CHECK ...@@ -266,7 +266,7 @@ config ENABLE_MUST_CHECK
attribute warn_unused_result" messages. attribute warn_unused_result" messages.
config FRAME_WARN config FRAME_WARN
int "Warn for stack frames larger than (needs gcc 4.4)" int "Warn for stack frames larger than"
range 0 8192 range 0 8192
default 2048 if GCC_PLUGIN_LATENT_ENTROPY default 2048 if GCC_PLUGIN_LATENT_ENTROPY
default 1280 if (!64BIT && PARISC) default 1280 if (!64BIT && PARISC)
...@@ -276,7 +276,6 @@ config FRAME_WARN ...@@ -276,7 +276,6 @@ config FRAME_WARN
Tell gcc to warn at build time for stack frames larger than this. Tell gcc to warn at build time for stack frames larger than this.
Setting this too low will cause a lot of warnings. Setting this too low will cause a lot of warnings.
Setting it to 0 disables the warning. Setting it to 0 disables the warning.
Requires gcc 4.4
config STRIP_ASM_SYMS config STRIP_ASM_SYMS
bool "Strip assembler-generated symbols during link" bool "Strip assembler-generated symbols during link"
......
...@@ -13,28 +13,24 @@ src := $(obj) ...@@ -13,28 +13,24 @@ src := $(obj)
PHONY := __dtbs_install PHONY := __dtbs_install
__dtbs_install: __dtbs_install:
export dtbinst_root ?= $(obj)
include include/config/auto.conf include include/config/auto.conf
include scripts/Kbuild.include include scripts/Kbuild.include
include $(src)/Makefile include $(src)/Makefile
dtbinst-files := $(sort $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS), $(dtb-))) dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-)))
dtbinst-dirs := $(subdir-y) $(subdir-m) subdirs := $(addprefix $(obj)/, $(subdir-y) $(subdir-m))
# Helper targets for Installing DTBs into the boot directory
quiet_cmd_dtb_install = INSTALL $<
cmd_dtb_install = mkdir -p $(2); cp $< $(2)
install-dir = $(patsubst $(dtbinst_root)%,$(INSTALL_DTBS_PATH)%,$(obj)) __dtbs_install: $(dtbs) $(subdirs)
@:
$(dtbinst-files): %.dtb: $(obj)/%.dtb quiet_cmd_dtb_install = INSTALL $@
$(call cmd,dtb_install,$(install-dir)) cmd_dtb_install = install -D $< $@
$(dtbinst-dirs): $(dst)/%.dtb: $(obj)/%.dtb
$(Q)$(MAKE) $(dtbinst)=$(obj)/$@ $(call cmd,dtb_install)
PHONY += $(dtbinst-files) $(dtbinst-dirs) PHONY += $(subdirs)
__dtbs_install: $(dtbinst-files) $(dtbinst-dirs) $(subdirs):
$(Q)$(MAKE) $(dtbinst)=$@ dst=$(patsubst $(obj)/%,$(dst)/%,$@)
.PHONY: $(PHONY) .PHONY: $(PHONY)
...@@ -297,7 +297,8 @@ $(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE ...@@ -297,7 +297,8 @@ $(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE
DT_CHECKER ?= dt-validate DT_CHECKER ?= dt-validate
DT_BINDING_DIR := Documentation/devicetree/bindings DT_BINDING_DIR := Documentation/devicetree/bindings
DT_TMP_SCHEMA := $(objtree)/$(DT_BINDING_DIR)/processed-schema.yaml # DT_TMP_SCHEMA may be overridden from Documentation/devicetree/bindings/Makefile
DT_TMP_SCHEMA ?= $(objtree)/$(DT_BINDING_DIR)/processed-schema.yaml
quiet_cmd_dtb_check = CHECK $@ quiet_cmd_dtb_check = CHECK $@
cmd_dtb_check = $(DT_CHECKER) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ cmd_dtb_check = $(DT_CHECKER) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@
......
...@@ -53,6 +53,7 @@ MODPOST = scripts/mod/modpost \ ...@@ -53,6 +53,7 @@ MODPOST = scripts/mod/modpost \
$(if $(KBUILD_EXTMOD),$(addprefix -e ,$(KBUILD_EXTRA_SYMBOLS))) \ $(if $(KBUILD_EXTMOD),$(addprefix -e ,$(KBUILD_EXTRA_SYMBOLS))) \
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
$(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \ $(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \
$(if $(CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS)$(KBUILD_NSDEPS),-N) \
$(if $(KBUILD_MODPOST_WARN),-w) $(if $(KBUILD_MODPOST_WARN),-w)
ifdef MODPOST_VMLINUX ifdef MODPOST_VMLINUX
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
# Script to create/update include/generated/autoksyms.h and dependency files # Script to update include/generated/autoksyms.h and dependency files
# #
# Copyright: (C) 2016 Linaro Limited # Copyright: (C) 2016 Linaro Limited
# Created by: Nicolas Pitre, January 2016 # Created by: Nicolas Pitre, January 2016
# #
# Create/update the include/generated/autoksyms.h file from the list # Update the include/generated/autoksyms.h file.
# of all module's needed symbols as recorded on the second line of *.mod files.
# #
# For each symbol being added or removed, the corresponding dependency # For each symbol being added or removed, the corresponding dependency
# file's timestamp is updated to force a rebuild of the affected source # file's timestamp is updated to force a rebuild of the affected source
...@@ -38,23 +37,8 @@ esac ...@@ -38,23 +37,8 @@ esac
# We need access to CONFIG_ symbols # We need access to CONFIG_ symbols
. include/config/auto.conf . include/config/auto.conf
# Generate a new ksym list file with symbols needed by the current # Generate a new symbol list file
# set of modules. $CONFIG_SHELL $srctree/scripts/gen_autoksyms.sh "$new_ksyms_file"
cat > "$new_ksyms_file" << EOT
/*
* Automatically generated file; DO NOT EDIT.
*/
EOT
sed 's/ko$/mod/' modules.order |
xargs -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' -- |
sort -u |
sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$new_ksyms_file"
# Special case for modversions (see modpost.c)
if [ -n "$CONFIG_MODVERSIONS" ]; then
echo "#define __KSYM_module_layout 1" >> "$new_ksyms_file"
fi
# Extract changes between old and new list and touch corresponding # Extract changes between old and new list and touch corresponding
# dependency files. # dependency files.
......
...@@ -77,11 +77,6 @@ ...@@ -77,11 +77,6 @@
* dependencies on include/config/my/option.h for every * dependencies on include/config/my/option.h for every
* CONFIG_MY_OPTION encountered in any of the prerequisites. * CONFIG_MY_OPTION encountered in any of the prerequisites.
* *
* It will also filter out all the dependencies on *.ver. We need
* to make sure that the generated version checksum are globally up
* to date before even starting the recursive build, so it's too late
* at this point anyway.
*
* We don't even try to really parse the header files, but * We don't even try to really parse the header files, but
* merely grep, i.e. if CONFIG_FOO is mentioned in a comment, it will * merely grep, i.e. if CONFIG_FOO is mentioned in a comment, it will
* be picked up as well. It's not a problem with respect to * be picked up as well. It's not a problem with respect to
...@@ -251,7 +246,7 @@ static void parse_config_file(const char *p) ...@@ -251,7 +246,7 @@ static void parse_config_file(const char *p)
} }
p += 7; p += 7;
q = p; q = p;
while (*q && (isalnum(*q) || *q == '_')) while (isalnum(*q) || *q == '_')
q++; q++;
if (str_ends_with(p, q - p, "_MODULE")) if (str_ends_with(p, q - p, "_MODULE"))
r = q - 7; r = q - 7;
...@@ -299,8 +294,7 @@ static void *read_file(const char *filename) ...@@ -299,8 +294,7 @@ static void *read_file(const char *filename)
static int is_ignored_file(const char *s, int len) static int is_ignored_file(const char *s, int len)
{ {
return str_ends_with(s, len, "include/generated/autoconf.h") || return str_ends_with(s, len, "include/generated/autoconf.h") ||
str_ends_with(s, len, "include/generated/autoksyms.h") || str_ends_with(s, len, "include/generated/autoksyms.h");
str_ends_with(s, len, ".ver");
} }
/* /*
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
# scripts/dtc makefile # scripts/dtc makefile
hostprogs := dtc hostprogs := dtc
always-$(CONFIG_DTC) := $(hostprogs) always-$(CONFIG_DTC) += $(hostprogs)
always-$(CHECK_DT_BINDING) += $(hostprogs)
dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \ dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
srcpos.o checks.o util.o srcpos.o checks.o util.o
......
...@@ -10,7 +10,7 @@ else ...@@ -10,7 +10,7 @@ else
HOSTLIBS := hostcxxlibs HOSTLIBS := hostcxxlibs
HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti
HOST_EXTRACXXFLAGS += -fno-exceptions -fasynchronous-unwind-tables -ggdb HOST_EXTRACXXFLAGS += -fno-exceptions -fasynchronous-unwind-tables -ggdb
HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable -Wno-c++11-compat
export HOST_EXTRACXXFLAGS export HOST_EXTRACXXFLAGS
endif endif
......
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
# Create an autoksyms.h header file from the list of all module's needed symbols
# as recorded on the second line of *.mod files and the user-provided symbol
# whitelist.
set -e
output_file="$1"
# Use "make V=1" to debug this script.
case "$KBUILD_VERBOSE" in
*1*)
set -x
;;
esac
# We need access to CONFIG_ symbols
. include/config/auto.conf
ksym_wl=/dev/null
if [ -n "$CONFIG_UNUSED_KSYMS_WHITELIST" ]; then
# Use 'eval' to expand the whitelist path and check if it is relative
eval ksym_wl="$CONFIG_UNUSED_KSYMS_WHITELIST"
[ "${ksym_wl}" != "${ksym_wl#/}" ] || ksym_wl="$abs_srctree/$ksym_wl"
if [ ! -f "$ksym_wl" ] || [ ! -r "$ksym_wl" ]; then
echo "ERROR: '$ksym_wl' whitelist file not found" >&2
exit 1
fi
fi
# Generate a new ksym list file with symbols needed by the current
# set of modules.
cat > "$output_file" << EOT
/*
* Automatically generated file; DO NOT EDIT.
*/
EOT
[ -f modules.order ] && modlist=modules.order || modlist=/dev/null
sed 's/ko$/mod/' $modlist |
xargs -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' -- |
cat - "$ksym_wl" |
sort -u |
sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$output_file"
# Special case for modversions (see modpost.c)
if [ -n "$CONFIG_MODVERSIONS" ]; then
echo "#define __KSYM_module_layout 1" >> "$output_file"
fi
...@@ -12,10 +12,6 @@ else ...@@ -12,10 +12,6 @@ else
Kconfig := Kconfig Kconfig := Kconfig
endif endif
ifndef KBUILD_DEFCONFIG
KBUILD_DEFCONFIG := defconfig
endif
ifeq ($(quiet),silent_) ifeq ($(quiet),silent_)
silent := -s silent := -s
endif endif
......
...@@ -309,8 +309,6 @@ ConfigList::ConfigList(ConfigView* p, const char *name) ...@@ -309,8 +309,6 @@ ConfigList::ConfigList(ConfigView* p, const char *name)
showName(false), showRange(false), showData(false), mode(singleMode), optMode(normalOpt), showName(false), showRange(false), showData(false), mode(singleMode), optMode(normalOpt),
rootEntry(0), headerPopup(0) rootEntry(0), headerPopup(0)
{ {
int i;
setObjectName(name); setObjectName(name);
setSortingEnabled(false); setSortingEnabled(false);
setRootIsDecorated(true); setRootIsDecorated(true);
......
...@@ -221,7 +221,7 @@ static void sym_calc_visibility(struct symbol *sym) ...@@ -221,7 +221,7 @@ static void sym_calc_visibility(struct symbol *sym)
sym_set_changed(sym); sym_set_changed(sym);
} }
tri = no; tri = no;
if (sym->implied.expr && sym->dir_dep.tri != no) if (sym->implied.expr)
tri = expr_calc_value(sym->implied.expr); tri = expr_calc_value(sym->implied.expr);
if (tri == mod && sym_get_type(sym) == S_BOOLEAN) if (tri == mod && sym_get_type(sym) == S_BOOLEAN)
tri = yes; tri = yes;
...@@ -394,6 +394,8 @@ void sym_calc_value(struct symbol *sym) ...@@ -394,6 +394,8 @@ void sym_calc_value(struct symbol *sym)
if (sym->implied.tri != no) { if (sym->implied.tri != no) {
sym->flags |= SYMBOL_WRITE; sym->flags |= SYMBOL_WRITE;
newval.tri = EXPR_OR(newval.tri, sym->implied.tri); newval.tri = EXPR_OR(newval.tri, sym->implied.tri);
newval.tri = EXPR_AND(newval.tri,
sym->dir_dep.tri);
} }
} }
calc_newval: calc_newval:
...@@ -401,8 +403,7 @@ void sym_calc_value(struct symbol *sym) ...@@ -401,8 +403,7 @@ void sym_calc_value(struct symbol *sym)
sym_warn_unmet_dep(sym); sym_warn_unmet_dep(sym);
newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri); newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
} }
if (newval.tri == mod && if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN)
(sym_get_type(sym) == S_BOOLEAN || sym->implied.tri == yes))
newval.tri = yes; newval.tri = yes;
break; break;
case S_STRING: case S_STRING:
...@@ -484,8 +485,6 @@ bool sym_tristate_within_range(struct symbol *sym, tristate val) ...@@ -484,8 +485,6 @@ bool sym_tristate_within_range(struct symbol *sym, tristate val)
return false; return false;
if (sym->visible <= sym->rev_dep.tri) if (sym->visible <= sym->rev_dep.tri)
return false; return false;
if (sym->implied.tri == yes && val == mod)
return false;
if (sym_is_choice_value(sym) && sym->visible == yes) if (sym_is_choice_value(sym) && sym->visible == yes)
return val == yes; return val == yes;
return val >= sym->rev_dep.tri && val <= sym->visible; return val >= sym->rev_dep.tri && val <= sym->visible;
......
...@@ -10,17 +10,6 @@ CC=$6 ...@@ -10,17 +10,6 @@ CC=$6
vecho() { [ "${quiet}" = "silent_" ] || echo "$@" ; } vecho() { [ "${quiet}" = "silent_" ] || echo "$@" ; }
# If compile.h exists already and we don't own autoconf.h
# (i.e. we're not the same user who did make *config), don't
# modify compile.h
# So "sudo make install" won't change the "compiled by <user>"
# do "compiled by root"
if [ -r $TARGET -a ! -O include/generated/autoconf.h ]; then
vecho " SKIPPED $TARGET"
exit 0
fi
# Do not expand names # Do not expand names
set -f set -f
......
...@@ -39,6 +39,8 @@ static int sec_mismatch_count = 0; ...@@ -39,6 +39,8 @@ static int sec_mismatch_count = 0;
static int sec_mismatch_fatal = 0; static int sec_mismatch_fatal = 0;
/* ignore missing files */ /* ignore missing files */
static int ignore_missing_files; static int ignore_missing_files;
/* If set to 1, only warn (instead of error) about missing ns imports */
static int allow_missing_ns_imports;
enum export { enum export {
export_plain, export_unused, export_gpl, export_plain, export_unused, export_gpl,
...@@ -51,41 +53,33 @@ enum export { ...@@ -51,41 +53,33 @@ enum export {
#define MODULE_NAME_LEN (64 - sizeof(Elf_Addr)) #define MODULE_NAME_LEN (64 - sizeof(Elf_Addr))
#define PRINTF __attribute__ ((format (printf, 1, 2))) void __attribute__((format(printf, 2, 3)))
modpost_log(enum loglevel loglevel, const char *fmt, ...)
PRINTF void fatal(const char *fmt, ...)
{ {
va_list arglist; va_list arglist;
switch (loglevel) {
case LOG_WARN:
fprintf(stderr, "WARNING: ");
break;
case LOG_ERROR:
fprintf(stderr, "ERROR: ");
break;
case LOG_FATAL:
fprintf(stderr, "FATAL: "); fprintf(stderr, "FATAL: ");
break;
default: /* invalid loglevel, ignore */
break;
}
va_start(arglist, fmt); fprintf(stderr, "modpost: ");
vfprintf(stderr, fmt, arglist);
va_end(arglist);
exit(1);
}
PRINTF void warn(const char *fmt, ...)
{
va_list arglist;
fprintf(stderr, "WARNING: ");
va_start(arglist, fmt); va_start(arglist, fmt);
vfprintf(stderr, fmt, arglist); vfprintf(stderr, fmt, arglist);
va_end(arglist); va_end(arglist);
}
PRINTF void merror(const char *fmt, ...) if (loglevel == LOG_FATAL)
{ exit(1);
va_list arglist;
fprintf(stderr, "ERROR: ");
va_start(arglist, fmt);
vfprintf(stderr, fmt, arglist);
va_end(arglist);
} }
static inline bool strends(const char *str, const char *postfix) static inline bool strends(const char *str, const char *postfix)
...@@ -113,7 +107,7 @@ static int is_vmlinux(const char *modname) ...@@ -113,7 +107,7 @@ static int is_vmlinux(const char *modname)
void *do_nofail(void *ptr, const char *expr) void *do_nofail(void *ptr, const char *expr)
{ {
if (!ptr) if (!ptr)
fatal("modpost: Memory allocation failure: %s.\n", expr); fatal("Memory allocation failure: %s.\n", expr);
return ptr; return ptr;
} }
...@@ -2022,7 +2016,7 @@ static void read_symbols(const char *modname) ...@@ -2022,7 +2016,7 @@ static void read_symbols(const char *modname)
license = get_modinfo(&info, "license"); license = get_modinfo(&info, "license");
if (!license && !is_vmlinux(modname)) if (!license && !is_vmlinux(modname))
warn("modpost: missing MODULE_LICENSE() in %s\n" warn("missing MODULE_LICENSE() in %s\n"
"see include/linux/module.h for " "see include/linux/module.h for "
"more information\n", modname); "more information\n", modname);
while (license) { while (license) {
...@@ -2153,15 +2147,15 @@ static void check_for_gpl_usage(enum export exp, const char *m, const char *s) ...@@ -2153,15 +2147,15 @@ static void check_for_gpl_usage(enum export exp, const char *m, const char *s)
switch (exp) { switch (exp) {
case export_gpl: case export_gpl:
fatal("modpost: GPL-incompatible module %s%s " fatal("GPL-incompatible module %s%s "
"uses GPL-only symbol '%s'\n", m, e, s); "uses GPL-only symbol '%s'\n", m, e, s);
break; break;
case export_unused_gpl: case export_unused_gpl:
fatal("modpost: GPL-incompatible module %s%s " fatal("GPL-incompatible module %s%s "
"uses GPL-only symbol marked UNUSED '%s'\n", m, e, s); "uses GPL-only symbol marked UNUSED '%s'\n", m, e, s);
break; break;
case export_gpl_future: case export_gpl_future:
warn("modpost: GPL-incompatible module %s%s " warn("GPL-incompatible module %s%s "
"uses future GPL-only symbol '%s'\n", m, e, s); "uses future GPL-only symbol '%s'\n", m, e, s);
break; break;
case export_plain: case export_plain:
...@@ -2179,7 +2173,7 @@ static void check_for_unused(enum export exp, const char *m, const char *s) ...@@ -2179,7 +2173,7 @@ static void check_for_unused(enum export exp, const char *m, const char *s)
switch (exp) { switch (exp) {
case export_unused: case export_unused:
case export_unused_gpl: case export_unused_gpl:
warn("modpost: module %s%s " warn("module %s%s "
"uses symbol '%s' marked UNUSED\n", m, e, s); "uses symbol '%s' marked UNUSED\n", m, e, s);
break; break;
default: default:
...@@ -2198,15 +2192,12 @@ static int check_exports(struct module *mod) ...@@ -2198,15 +2192,12 @@ static int check_exports(struct module *mod)
exp = find_symbol(s->name); exp = find_symbol(s->name);
if (!exp || exp->module == mod) { if (!exp || exp->module == mod) {
if (have_vmlinux && !s->weak) { if (have_vmlinux && !s->weak) {
if (warn_unresolved) { modpost_log(warn_unresolved ? LOG_WARN : LOG_ERROR,
warn("\"%s\" [%s.ko] undefined!\n", "\"%s\" [%s.ko] undefined!\n",
s->name, mod->name);
} else {
merror("\"%s\" [%s.ko] undefined!\n",
s->name, mod->name); s->name, mod->name);
if (!warn_unresolved)
err = 1; err = 1;
} }
}
continue; continue;
} }
basename = strrchr(mod->name, '/'); basename = strrchr(mod->name, '/');
...@@ -2217,8 +2208,11 @@ static int check_exports(struct module *mod) ...@@ -2217,8 +2208,11 @@ static int check_exports(struct module *mod)
if (exp->namespace && if (exp->namespace &&
!module_imports_namespace(mod, exp->namespace)) { !module_imports_namespace(mod, exp->namespace)) {
warn("module %s uses symbol %s from namespace %s, but does not import it.\n", modpost_log(allow_missing_ns_imports ? LOG_WARN : LOG_ERROR,
"module %s uses symbol %s from namespace %s, but does not import it.\n",
basename, exp->name, exp->namespace); basename, exp->name, exp->namespace);
if (!allow_missing_ns_imports)
err = 1;
add_namespace(&mod->missing_namespaces, exp->namespace); add_namespace(&mod->missing_namespaces, exp->namespace);
} }
...@@ -2565,7 +2559,7 @@ int main(int argc, char **argv) ...@@ -2565,7 +2559,7 @@ int main(int argc, char **argv)
struct ext_sym_list *extsym_iter; struct ext_sym_list *extsym_iter;
struct ext_sym_list *extsym_start = NULL; struct ext_sym_list *extsym_start = NULL;
while ((opt = getopt(argc, argv, "i:e:mnsT:o:awEd:")) != -1) { while ((opt = getopt(argc, argv, "i:e:mnsT:o:awENd:")) != -1) {
switch (opt) { switch (opt) {
case 'i': case 'i':
kernel_read = optarg; kernel_read = optarg;
...@@ -2603,6 +2597,9 @@ int main(int argc, char **argv) ...@@ -2603,6 +2597,9 @@ int main(int argc, char **argv)
case 'E': case 'E':
sec_mismatch_fatal = 1; sec_mismatch_fatal = 1;
break; break;
case 'N':
allow_missing_ns_imports = 1;
break;
case 'd': case 'd':
missing_namespace_deps = optarg; missing_namespace_deps = optarg;
break; break;
...@@ -2658,7 +2655,7 @@ int main(int argc, char **argv) ...@@ -2658,7 +2655,7 @@ int main(int argc, char **argv)
if (dump_write) if (dump_write)
write_dump(dump_write); write_dump(dump_write);
if (sec_mismatch_count && sec_mismatch_fatal) if (sec_mismatch_count && sec_mismatch_fatal)
fatal("modpost: Section mismatches detected.\n" fatal("Section mismatches detected.\n"
"Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n"); "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n");
for (n = 0; n < SYMBOL_HASH_SIZE; n++) { for (n = 0; n < SYMBOL_HASH_SIZE; n++) {
struct symbol *s; struct symbol *s;
......
...@@ -198,6 +198,14 @@ void *grab_file(const char *filename, unsigned long *size); ...@@ -198,6 +198,14 @@ void *grab_file(const char *filename, unsigned long *size);
char* get_next_line(unsigned long *pos, void *file, unsigned long size); char* get_next_line(unsigned long *pos, void *file, unsigned long size);
void release_file(void *file, unsigned long size); void release_file(void *file, unsigned long size);
void fatal(const char *fmt, ...); enum loglevel {
void warn(const char *fmt, ...); LOG_WARN,
void merror(const char *fmt, ...); LOG_ERROR,
LOG_FATAL
};
void modpost_log(enum loglevel loglevel, const char *fmt, ...);
#define warn(fmt, args...) modpost_log(LOG_WARN, fmt, ##args)
#define merror(fmt, args...) modpost_log(LOG_ERROR, fmt, ##args)
#define fatal(fmt, args...) modpost_log(LOG_FATAL, fmt, ##args)
...@@ -198,6 +198,10 @@ Description: Linux support headers for userspace development ...@@ -198,6 +198,10 @@ Description: Linux support headers for userspace development
This package provides userspaces headers from the Linux kernel. These headers This package provides userspaces headers from the Linux kernel. These headers
are used by the installed headers for GNU glibc and other system libraries. are used by the installed headers for GNU glibc and other system libraries.
Multi-Arch: same Multi-Arch: same
EOF
if is_enabled CONFIG_DEBUG_INFO; then
cat <<EOF >> debian/control
Package: $dbg_packagename Package: $dbg_packagename
Section: debug Section: debug
...@@ -206,6 +210,7 @@ Description: Linux kernel debugging symbols for $version ...@@ -206,6 +210,7 @@ Description: Linux kernel debugging symbols for $version
This package will come in handy if you need to debug the kernel. It provides This package will come in handy if you need to debug the kernel. It provides
all the necessary debug symbols for the kernel and its modules. all the necessary debug symbols for the kernel and its modules.
EOF EOF
fi
cat <<EOF > debian/rules cat <<EOF > debian/rules
#!$(command -v $MAKE) -f #!$(command -v $MAKE) -f
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment