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

 - add modpost warn exported symbols marked as 'static' because 'static'
   and EXPORT_SYMBOL is an odd combination

 - break the build early if gold linker is used

 - optimize the Bison rule to produce .c and .h files by a single
   pattern rule

 - handle PREEMPT_RT in the module vermagic and UTS_VERSION

 - warn CONFIG options leaked to the user-space except existing ones

 - make single targets work properly

 - rebuild modules when module linker scripts are updated

 - split the module final link stage into scripts/Makefile.modfinal

 - fix the missed error code in merge_config.sh

 - improve the error message displayed on the attempt of the O= build in
   unclean source tree

 - remove 'clean-dirs' syntax

 - disable -Wimplicit-fallthrough warning for Clang

 - add CONFIG_CC_OPTIMIZE_FOR_SIZE_O3 for ARC

 - remove ARCH_{CPP,A,C}FLAGS variables

 - add $(BASH) to run bash scripts

 - change *CFLAGS_<basetarget>.o to take the relative path to $(obj)
   instead of the basename

 - stop suppressing Clang's -Wunused-function warnings when W=1

 - fix linux/export.h to avoid genksyms calculating CRC of trimmed
   exported symbols

 - misc cleanups

* tag 'kbuild-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (63 commits)
  genksyms: convert to SPDX License Identifier for lex.l and parse.y
  modpost: use __section in the output to *.mod.c
  modpost: use MODULE_INFO() for __module_depends
  export.h, genksyms: do not make genksyms calculate CRC of trimmed symbols
  export.h: remove defined(__KERNEL__), which is no longer needed
  kbuild: allow Clang to find unused static inline functions for W=1 build
  kbuild: rename KBUILD_ENABLE_EXTRA_GCC_CHECKS to KBUILD_EXTRA_WARN
  kbuild: refactor scripts/Makefile.extrawarn
  merge_config.sh: ignore unwanted grep errors
  kbuild: change *FLAGS_<basetarget>.o to take the path relative to $(obj)
  modpost: add NOFAIL to strndup
  modpost: add guid_t type definition
  kbuild: add $(BASH) to run scripts with bash-extension
  kbuild: remove ARCH_{CPP,A,C}FLAGS
  kbuild,arc: add CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 for ARC
  kbuild: Do not enable -Wimplicit-fallthrough for clang for now
  kbuild: clean up subdir-ymn calculation in Makefile.clean
  kbuild: remove unneeded '+' marker from cmd_clean
  kbuild: remove clean-dirs syntax
  kbuild: check clean srctree even earlier
  ...
parents 574cc453 77564a48
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@
*.mod.c
*.o
*.o.*
*.order
*.patch
*.s
*.so
@@ -46,6 +45,7 @@
*.xz
Module.symvers
modules.builtin
modules.order

#
# Top-level generic files
+9 −19
Original line number Diff line number Diff line
@@ -105,6 +105,15 @@ The output directory can also be specified using "O=...".

Setting "O=..." takes precedence over KBUILD_OUTPUT.

KBUILD_EXTRA_WARN
-----------------
Specify the extra build checks. The same value can be assigned by passing
W=... from the command line.

See `make help` for the list of the supported values.

Setting "W=..." takes precedence over KBUILD_EXTRA_WARN.

KBUILD_DEBARCH
--------------
For the deb-pkg target, allows overriding the normal heuristics deployed by
@@ -241,11 +250,6 @@ To get all available archs you can also specify all. E.g.::

    $ make ALLSOURCE_ARCHS=all tags

KBUILD_ENABLE_EXTRA_GCC_CHECKS
------------------------------
If enabled over the make command line with "W=1", it turns on additional
gcc -W... options for more extensive build-time checking.

KBUILD_BUILD_TIMESTAMP
----------------------
Setting this to a date string overrides the timestamp used in the
@@ -258,17 +262,3 @@ KBUILD_BUILD_USER, KBUILD_BUILD_HOST
These two variables allow to override the user@host string displayed during
boot and in /proc/version. The default value is the output of the commands
whoami and host, respectively.

KBUILD_LDS
----------
The linker script with full path. Assigned by the top-level Makefile.

KBUILD_VMLINUX_OBJS
-------------------
All object files for vmlinux. They are linked to vmlinux in the same
order as listed in KBUILD_VMLINUX_OBJS.

KBUILD_VMLINUX_LIBS
-------------------
All .a "lib" files for vmlinux. KBUILD_VMLINUX_OBJS and KBUILD_VMLINUX_LIBS
together specify all the object files used to link vmlinux.
+25 −42
Original line number Diff line number Diff line
@@ -471,21 +471,6 @@ more details, with real examples.
	The second argument is optional, and if supplied will be used
	if first argument is not supported.

    cc-ldoption
	cc-ldoption is used to check if $(CC) when used to link object files
	supports the given option.  An optional second option may be
	specified if first option are not supported.

	Example::

		#arch/x86/kernel/Makefile
		vsyscall-flags += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)

	In the above example, vsyscall-flags will be assigned the option
	-Wl$(comma)--hash-style=sysv if it is supported by $(CC).
	The second argument is optional, and if supplied will be used
	if first argument is not supported.

    as-instr
	as-instr checks if the assembler reports a specific instruction
	and then outputs either option1 or option2
@@ -765,7 +750,8 @@ Files matching the patterns "*.[oas]", "*.ko", plus some additional files
generated by kbuild are deleted all over the kernel src tree when
"make clean" is executed.

Additional files can be specified in kbuild makefiles by use of $(clean-files).
Additional files or directories can be specified in kbuild makefiles by use of
$(clean-files).

	Example::

@@ -776,23 +762,8 @@ When executing "make clean", the file "crc32table.h" will be deleted.
Kbuild will assume files to be in the same relative directory as the
Makefile, except if prefixed with $(objtree).

To delete a directory hierarchy use:

	Example::

		#scripts/package/Makefile
		clean-dirs := $(objtree)/debian/

This will delete the directory debian in the toplevel directory, including all
subdirectories.

To exclude certain files from make clean, use the $(no-clean-files) variable.
This is only a special case used in the top level Kbuild file:

	Example::

		#Kbuild
		no-clean-files := $(bounds-file) $(offsets-file)
To exclude certain files or directories from make clean, use the
$(no-clean-files) variable.

Usually kbuild descends down in subdirectories due to "obj-* := dir/",
but in the architecture makefiles where the kbuild infrastructure
@@ -988,13 +959,25 @@ When kbuild executes, the following steps are followed (roughly):
	$(KBUILD_ARFLAGS) set by the top level Makefile to "D" (deterministic
	mode) if this option is supported by $(AR).

    ARCH_CPPFLAGS, ARCH_AFLAGS, ARCH_CFLAGS   Overrides the kbuild defaults
    KBUILD_LDS

	The linker script with full path. Assigned by the top-level Makefile.

    KBUILD_LDS_MODULE

	The module linker script with full path. Assigned by the top-level
	Makefile and additionally by the arch Makefile.

    KBUILD_VMLINUX_OBJS

	All object files for vmlinux. They are linked to vmlinux in the same
	order as listed in KBUILD_VMLINUX_OBJS.

	These variables are appended to the KBUILD_CPPFLAGS,
	KBUILD_AFLAGS, and KBUILD_CFLAGS, respectively, after the
	top-level Makefile has set any other flags. This provides a
	means for an architecture to override the defaults.
    KBUILD_VMLINUX_LIBS

	All .a "lib" files for vmlinux. KBUILD_VMLINUX_OBJS and
	KBUILD_VMLINUX_LIBS together specify all the object files used to
	link vmlinux.

6.2 Add prerequisites to archheaders
------------------------------------
@@ -1139,7 +1122,7 @@ When kbuild executes, the following steps are followed (roughly):

    header-test-y

	header-test-y specifies headers (*.h) in the current directory that
	header-test-y specifies headers (`*.h`) in the current directory that
	should be compile tested to ensure they are self-contained,
	i.e. compilable as standalone units. If CONFIG_HEADER_TEST is enabled,
	this builds them as part of extra-y.
@@ -1147,11 +1130,11 @@ When kbuild executes, the following steps are followed (roughly):
    header-test-pattern-y

	This works as a weaker version of header-test-y, and accepts wildcard
	patterns. The typical usage is:
	patterns. The typical usage is::

		header-test-pattern-y += *.h

	This specifies all the files that matches to '*.h' in the current
	This specifies all the files that matches to `*.h` in the current
	directory, but the files in 'header-test-' are excluded.

6.7 Commands useful for building a boot image
+0 −7
Original line number Diff line number Diff line
@@ -18,8 +18,6 @@ $(bounds-file): kernel/bounds.s FORCE

timeconst-file := include/generated/timeconst.h

targets += $(timeconst-file)

filechk_gentimeconst = echo $(CONFIG_HZ) | bc -q $<

$(timeconst-file): kernel/time/timeconst.bc FORCE
@@ -42,7 +40,6 @@ $(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE
# Check for missing system calls

always += missing-syscalls
targets += missing-syscalls

quiet_cmd_syscalls = CALL    $<
      cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
@@ -54,13 +51,9 @@ missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
# Check atomic headers are up-to-date

always += old-atomics
targets += old-atomics

quiet_cmd_atomics = CALL    $<
      cmd_atomics = $(CONFIG_SHELL) $<

old-atomics: scripts/atomic/check-atomics.sh FORCE
	$(call cmd,atomics)

# Keep these three files during make clean
no-clean-files := $(bounds-file) $(offsets-file) $(timeconst-file)
+151 −145

File changed.

Preview size limit exceeded, changes collapsed.

Loading