Commit 41bef91c authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'kbuild-fixes-v5.9-2' of...

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

Pull Kbuild fixes from Masahiro Yamada:

 - fix documents

 - fix warning in 'make localmodconfig'

* tag 'kbuild-fixes-v5.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kconfig: remove redundant assignment prompt = prompt
  kbuild: Documentation: clean up makefiles.rst
  kconfig: streamline_config.pl: check defined(ENV variable) before using it
  Documentation/llvm: Improve formatting of commands, variables, and arguments
parents f162626a 163e0c27
Loading
Loading
Loading
Loading
+13 −13
Original line number Original line Diff line number Diff line
@@ -23,8 +23,8 @@ supports C and the GNU C extensions required by the kernel, and is pronounced
Clang
Clang
-----
-----


The compiler used can be swapped out via `CC=` command line argument to `make`.
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.
``CC=`` should be set when selecting a config and during a build. ::


	make CC=clang defconfig
	make CC=clang defconfig


@@ -34,33 +34,33 @@ Cross Compiling
---------------
---------------


A single Clang compiler binary will typically contain all supported backends,
A single Clang compiler binary will typically contain all supported backends,
which can help simplify cross compiling.
which can help simplify cross compiling. ::


	ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang
	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 not used to prefix the Clang compiler binary, instead
`CROSS_COMPILE` is used to set a command line flag: `--target <triple>`. For
``CROSS_COMPILE`` is used to set a command line flag: ``--target <triple>``. For
example:
example: ::


	clang --target aarch64-linux-gnu foo.c
	clang --target aarch64-linux-gnu foo.c


LLVM Utilities
LLVM Utilities
--------------
--------------


LLVM has substitutes for GNU binutils utilities. Kbuild supports `LLVM=1`
LLVM has substitutes for GNU binutils utilities. Kbuild supports ``LLVM=1``
to enable them.
to enable them. ::


	make LLVM=1
	make LLVM=1


They can be enabled individually. The full list of the parameters:
They can be enabled individually. The full list of the parameters: ::


	make CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \\
	make CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \
	  OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-size \\
	  OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-size \
	  READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \\
	  READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \
	  HOSTLD=ld.lld
	  HOSTLD=ld.lld


Currently, the integrated assembler is disabled by default. You can pass
Currently, the integrated assembler is disabled by default. You can pass
`LLVM_IAS=1` to enable it.
``LLVM_IAS=1`` to enable it.


Getting Help
Getting Help
------------
------------
+9 −9
Original line number Original line Diff line number Diff line
@@ -16,7 +16,7 @@ This document describes the Linux kernel Makefiles.
	   --- 3.5 Library file goals - lib-y
	   --- 3.5 Library file goals - lib-y
	   --- 3.6 Descending down in directories
	   --- 3.6 Descending down in directories
	   --- 3.7 Compilation flags
	   --- 3.7 Compilation flags
	   --- 3.8 Command line dependency
	   --- 3.8 <deleted>
	   --- 3.9 Dependency tracking
	   --- 3.9 Dependency tracking
	   --- 3.10 Special Rules
	   --- 3.10 Special Rules
	   --- 3.11 $(CC) support functions
	   --- 3.11 $(CC) support functions
@@ -39,8 +39,8 @@ This document describes the Linux kernel Makefiles.


	=== 7 Architecture Makefiles
	=== 7 Architecture Makefiles
	   --- 7.1 Set variables to tweak the build to the architecture
	   --- 7.1 Set variables to tweak the build to the architecture
	   --- 7.2 Add prerequisites to archheaders:
	   --- 7.2 Add prerequisites to archheaders
	   --- 7.3 Add prerequisites to archprepare:
	   --- 7.3 Add prerequisites to archprepare
	   --- 7.4 List directories to visit when descending
	   --- 7.4 List directories to visit when descending
	   --- 7.5 Architecture-specific boot images
	   --- 7.5 Architecture-specific boot images
	   --- 7.6 Building non-kbuild targets
	   --- 7.6 Building non-kbuild targets
@@ -129,7 +129,7 @@ The preferred name for the kbuild files are 'Makefile' but 'Kbuild' can
be used and if both a 'Makefile' and a 'Kbuild' file exists, then the 'Kbuild'
be used and if both a 'Makefile' and a 'Kbuild' file exists, then the 'Kbuild'
file will be used.
file will be used.


Section 3.1 "Goal definitions" is a quick intro, further chapters provide
Section 3.1 "Goal definitions" is a quick intro; further chapters provide
more details, with real examples.
more details, with real examples.


3.1 Goal definitions
3.1 Goal definitions
@@ -965,7 +965,7 @@ When kbuild executes, the following steps are followed (roughly):
		KBUILD_LDFLAGS         := -m elf_s390
		KBUILD_LDFLAGS         := -m elf_s390


	Note: ldflags-y can be used to further customise
	Note: ldflags-y can be used to further customise
	the flags used. See chapter 3.7.
	the flags used. See section 3.7.


    LDFLAGS_vmlinux
    LDFLAGS_vmlinux
	Options for $(LD) when linking vmlinux
	Options for $(LD) when linking vmlinux
@@ -1121,7 +1121,7 @@ When kbuild executes, the following steps are followed (roughly):


	In this example, the file target maketools will be processed
	In this example, the file target maketools will be processed
	before descending down in the subdirectories.
	before descending down in the subdirectories.
	See also chapter XXX-TODO that describe how kbuild supports
	See also chapter XXX-TODO that describes how kbuild supports
	generating offset header files.
	generating offset header files.




@@ -1261,7 +1261,7 @@ When kbuild executes, the following steps are followed (roughly):
	always be built.
	always be built.
	Assignments to $(targets) are without $(obj)/ prefix.
	Assignments to $(targets) are without $(obj)/ prefix.
	if_changed may be used in conjunction with custom commands as
	if_changed may be used in conjunction with custom commands as
	defined in 6.8 "Custom kbuild commands".
	defined in 7.8 "Custom kbuild commands".


	Note: It is a typical mistake to forget the FORCE prerequisite.
	Note: It is a typical mistake to forget the FORCE prerequisite.
	Another common pitfall is that whitespace is sometimes
	Another common pitfall is that whitespace is sometimes
@@ -1411,7 +1411,7 @@ When kbuild executes, the following steps are followed (roughly):
	that may be shared between individual architectures.
	that may be shared between individual architectures.
	The recommended approach how to use a generic header file is
	The recommended approach how to use a generic header file is
	to list the file in the Kbuild file.
	to list the file in the Kbuild file.
	See "7.2 generic-y" for further info on syntax etc.
	See "8.2 generic-y" for further info on syntax etc.


7.11 Post-link pass
7.11 Post-link pass
-------------------
-------------------
@@ -1601,4 +1601,4 @@ is the right choice.


- Describe how kbuild supports shipped files with _shipped.
- Describe how kbuild supports shipped files with _shipped.
- Generating offset header files.
- Generating offset header files.
- Add more variables to section 7?
- Add more variables to chapters 7 or 9?
+0 −1
Original line number Original line Diff line number Diff line
@@ -755,7 +755,6 @@ static void build_conf(struct menu *menu)
			switch (ptype) {
			switch (ptype) {
			case P_MENU:
			case P_MENU:
				child_count++;
				child_count++;
				prompt = prompt;
				if (single_menu_mode) {
				if (single_menu_mode) {
					item_make(menu, 'm',
					item_make(menu, 'm',
						"%s%*c%s",
						"%s%*c%s",
+4 −1
Original line number Original line Diff line number Diff line
@@ -593,7 +593,10 @@ while ($repeat) {
}
}


my %setconfigs;
my %setconfigs;
my @preserved_kconfigs = split(/:/,$ENV{LMC_KEEP});
my @preserved_kconfigs;
if (defined($ENV{'LMC_KEEP'})) {
	@preserved_kconfigs = split(/:/,$ENV{LMC_KEEP});
}


sub in_preserved_kconfigs {
sub in_preserved_kconfigs {
    my $kconfig = $config2kfile{$_[0]};
    my $kconfig = $config2kfile{$_[0]};