Commit fc80c51f authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull Kbuild updates from Masahiro Yamada:

 - run the checker (e.g. sparse) after the compiler

 - remove unneeded cc-option tests for old compiler flags

 - fix tar-pkg to install dtbs

 - introduce ccflags-remove-y and asflags-remove-y syntax

 - allow to trace functions in sub-directories of lib/

 - introduce hostprogs-always-y and userprogs-always-y syntax

 - various Makefile cleanups

* tag 'kbuild-v5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kbuild: stop filtering out $(GCC_PLUGINS_CFLAGS) from cc-option base
  kbuild: include scripts/Makefile.* only when relevant CONFIG is enabled
  kbuild: introduce hostprogs-always-y and userprogs-always-y
  kbuild: sort hostprogs before passing it to ifneq
  kbuild: move host .so build rules to scripts/gcc-plugins/Makefile
  kbuild: Replace HTTP links with HTTPS ones
  kbuild: trace functions in subdirectories of lib/
  kbuild: introduce ccflags-remove-y and asflags-remove-y
  kbuild: do not export LDFLAGS_vmlinux
  kbuild: always create directories of targets
  powerpc/boot: add DTB to 'targets'
  kbuild: buildtar: add dtbs support
  kbuild: remove cc-option test of -ffreestanding
  kbuild: remove cc-option test of -fno-stack-protector
  Revert "kbuild: Create directory for target DTB"
  kbuild: run the checker after the compiler
parents 7a6b6044 132305b3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@
# "select FW_LOADER" [0], in the end the simple alternative solution to this
# problem consisted on matching semantics with newly introduced features.
#
# [0] http://lkml.kernel.org/r/1432241149-8762-1-git-send-email-mcgrof@do-not-panic.com
# [0] https://lkml.kernel.org/r/1432241149-8762-1-git-send-email-mcgrof@do-not-panic.com

mainmenu "Simple example to demo cumulative kconfig recursive dependency implication"

+9 −9
Original line number Diff line number Diff line
@@ -540,8 +540,8 @@ followed by a test macro::
If you need to expose a compiler capability to makefiles and/or C source files,
`CC_HAS_` is the recommended prefix for the config option::

  config CC_HAS_STACKPROTECTOR_NONE
	def_bool $(cc-option,-fno-stack-protector)
  config CC_HAS_ASM_GOTO
	def_bool $(success,$(srctree)/scripts/gcc-goto.sh $(CC))

Build as module only
~~~~~~~~~~~~~~~~~~~~
@@ -688,10 +688,10 @@ and real world requirements were not well understood. As it stands though
only reverse engineering techniques have been used to deduce semantics from
variability modeling languages such as Kconfig [3]_.

.. [0] http://www.eng.uwaterloo.ca/~shshe/kconfig_semantics.pdf
.. [1] http://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf
.. [2] http://gsd.uwaterloo.ca/sites/default/files/ase241-berger_0.pdf
.. [3] http://gsd.uwaterloo.ca/sites/default/files/icse2011.pdf
.. [0] https://www.eng.uwaterloo.ca/~shshe/kconfig_semantics.pdf
.. [1] https://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf
.. [2] https://gsd.uwaterloo.ca/sites/default/files/ase241-berger_0.pdf
.. [3] https://gsd.uwaterloo.ca/sites/default/files/icse2011.pdf

Full SAT solver for Kconfig
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -710,10 +710,10 @@ such efforts somehow on Kconfig. There is enough interest from mentors of
existing projects to not only help advise how to integrate this work upstream
but also help maintain it long term. Interested developers should visit:

http://kernelnewbies.org/KernelProjects/kconfig-sat
https://kernelnewbies.org/KernelProjects/kconfig-sat

.. [4] http://www.cs.cornell.edu/~sabhar/chapters/SATSolvers-KR-Handbook.pdf
.. [5] http://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf
.. [4] https://www.cs.cornell.edu/~sabhar/chapters/SATSolvers-KR-Handbook.pdf
.. [5] https://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf
.. [6] https://cados.cs.fau.de
.. [7] https://vamos.cs.fau.de
.. [8] https://undertaker.cs.fau.de
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ Getting Help
Getting LLVM
-------------

- http://releases.llvm.org/download.html
- https://releases.llvm.org/download.html
- https://github.com/llvm/llvm-project
- https://llvm.org/docs/GettingStarted.html
- https://llvm.org/docs/CMake.html
+44 −1
Original line number Diff line number Diff line
@@ -368,6 +368,14 @@ more details, with real examples.

		subdir-ccflags-y := -Werror

    ccflags-remove-y, asflags-remove-y
	These flags are used to remove particular flags for the compiler,
	assembler invocations.

	Example::

		ccflags-remove-$(CONFIG_MCOUNT) += -pg

    CFLAGS_$@, AFLAGS_$@
	CFLAGS_$@ and AFLAGS_$@ only apply to commands in current
	kbuild makefile.
@@ -375,6 +383,9 @@ more details, with real examples.
	$(CFLAGS_$@) specifies per-file options for $(CC).  The $@
	part has a literal value which specifies the file that it is for.

	CFLAGS_$@ has the higher priority than ccflags-remove-y; CFLAGS_$@
	can re-add compiler flags that were removed by ccflags-remove-y.

	Example::

		# drivers/scsi/Makefile
@@ -387,6 +398,9 @@ more details, with real examples.
	$(AFLAGS_$@) is a similar feature for source files in assembly
	languages.

	AFLAGS_$@ has the higher priority than asflags-remove-y; AFLAGS_$@
	can re-add assembler flags that were removed by asflags-remove-y.

	Example::

		# arch/arm/kernel/Makefile
@@ -735,6 +749,10 @@ Both possibilities are described in the following.
		hostprogs     := lxdialog
		always-y      := $(hostprogs)

	Kbuild provides the following shorthand for this:

		hostprogs-always-y := lxdialog

	This will tell kbuild to build lxdialog even if not referenced in
	any rule.

@@ -817,7 +835,32 @@ The syntax is quite similar. The difference is to use "userprogs" instead of
5.4 When userspace programs are actually built
----------------------------------------------

	Same as "When host programs are actually built".
	Kbuild builds userspace programs only when told to do so.
	There are two ways to do this.

	(1) Add it as the prerequisite of another file

	Example::

		#net/bpfilter/Makefile
		userprogs := bpfilter_umh
		$(obj)/bpfilter_umh_blob.o: $(obj)/bpfilter_umh

	$(obj)/bpfilter_umh is built before $(obj)/bpfilter_umh_blob.o

	(2) Use always-y

	Example::

		userprogs := binderfs_example
		always-y := $(userprogs)

	Kbuild provides the following shorthand for this:

		userprogs-always-y := binderfs_example

	This will tell Kbuild to build binderfs_example when it visits this
	Makefile.

6 Kbuild clean infrastructure
=============================
+15 −11
Original line number Diff line number Diff line
@@ -508,7 +508,6 @@ KBUILD_CFLAGS_MODULE := -DMODULE
KBUILD_LDFLAGS_MODULE :=
export KBUILD_LDS_MODULE := $(srctree)/scripts/module-common.lds
KBUILD_LDFLAGS :=
GCC_PLUGINS_CFLAGS :=
CLANG_FLAGS :=

export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC
@@ -747,9 +746,6 @@ endif
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.gcc-plugins

ifdef CONFIG_READABLE_ASM
# Disable optimizations that make assembler listings hard to read.
# reorder blocks reorders the control in the function
@@ -764,7 +760,7 @@ ifneq ($(CONFIG_FRAME_WARN),0)
KBUILD_CFLAGS += -Wframe-larger-than=$(CONFIG_FRAME_WARN)
endif

stackp-flags-$(CONFIG_CC_HAS_STACKPROTECTOR_NONE) := -fno-stack-protector
stackp-flags-y                                    := -fno-stack-protector
stackp-flags-$(CONFIG_STACKPROTECTOR)             := -fstack-protector
stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG)      := -fstack-protector-strong

@@ -959,10 +955,19 @@ ifdef CONFIG_RETPOLINE
KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
endif

include scripts/Makefile.kasan
include scripts/Makefile.extrawarn
include scripts/Makefile.ubsan
include scripts/Makefile.kcsan
# include additional Makefiles when needed
include-y			:= scripts/Makefile.extrawarn
include-$(CONFIG_KASAN)		+= scripts/Makefile.kasan
include-$(CONFIG_KCSAN)		+= scripts/Makefile.kcsan
include-$(CONFIG_UBSAN)		+= scripts/Makefile.ubsan
include-$(CONFIG_KCOV)		+= scripts/Makefile.kcov
include-$(CONFIG_GCC_PLUGINS)	+= scripts/Makefile.gcc-plugins

include $(addprefix $(srctree)/, $(include-y))

# scripts/Makefile.gcc-plugins is intentionally included last.
# Do not add $(call cc-option,...) below this line. When you build the kernel
# from the clean source tree, the GCC plugins do not exist at this point.

# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
KBUILD_CPPFLAGS += $(KCPPFLAGS)
@@ -1120,7 +1125,6 @@ KBUILD_VMLINUX_OBJS += $(patsubst %/,%/built-in.a, $(drivers-y))

export KBUILD_VMLINUX_OBJS KBUILD_VMLINUX_LIBS
export KBUILD_LDS          := arch/$(SRCARCH)/kernel/vmlinux.lds
export LDFLAGS_vmlinux
# used by scripts/Makefile.package
export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) LICENSES arch include scripts tools)

@@ -1152,7 +1156,7 @@ ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)

# Final link of vmlinux with optional arch pass after final link
cmd_link-vmlinux =                                                 \
	$(CONFIG_SHELL) $< $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_vmlinux) ;    \
	$(CONFIG_SHELL) $< "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)";    \
	$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)

vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE
Loading