Commit e81a2dab authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'kbuild-fixes-v6.6-2' of...

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

Pull Kbuild fixes from Masahiro Yamada:

 - Fix the module compression with xz so the in-kernel decompressor
   works

 - Document a kconfig idiom to express an optional dependency between
   modules

 - Make modpost, when W=1 is given, detect broken drivers that reference
   .exit.* sections

 - Remove unused code

* tag 'kbuild-fixes-v6.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kbuild: remove stale code for 'source' symlink in packaging scripts
  modpost: Don't let "driver"s reference .exit.*
  vmlinux.lds.h: remove unused CPU_KEEP and CPU_DISCARD macros
  modpost: add missing else to the "of" check
  Documentation: kbuild: explain handling optional dependencies
  kbuild: Use CRC32 and a 1MiB dictionary for XZ compressed modules
parents d2c52315 2d7d1bc1
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -573,6 +573,32 @@ above, leading to:
	bool "Support for foo hardware"
	depends on ARCH_FOO_VENDOR || COMPILE_TEST

Optional dependencies
~~~~~~~~~~~~~~~~~~~~~

Some drivers are able to optionally use a feature from another module
or build cleanly with that module disabled, but cause a link failure
when trying to use that loadable module from a built-in driver.

The most common way to express this optional dependency in Kconfig logic
uses the slightly counterintuitive::

  config FOO
	tristate "Support for foo hardware"
	depends on BAR || !BAR

This means that there is either a dependency on BAR that disallows
the combination of FOO=y with BAR=m, or BAR is completely disabled.
For a more formalized approach if there are multiple drivers that have
the same dependency, a helper symbol can be used, like::

  config FOO
	tristate "Support for foo hardware"
	depends on BAR_OPTIONAL

  config BAR_OPTIONAL
	def_tristate BAR || !BAR

Kconfig recursive dependency limitations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+0 −7
Original line number Diff line number Diff line
@@ -138,13 +138,6 @@
 * are handled as text/data or they can be discarded (which
 * often happens at runtime)
 */
#ifdef CONFIG_HOTPLUG_CPU
#define CPU_KEEP(sec)    *(.cpu##sec)
#define CPU_DISCARD(sec)
#else
#define CPU_KEEP(sec)
#define CPU_DISCARD(sec) *(.cpu##sec)
#endif

#if defined(CONFIG_MEMORY_HOTPLUG)
#define MEM_KEEP(sec)    *(.mem##sec)
+1 −1
Original line number Diff line number Diff line
@@ -144,7 +144,7 @@ endif
quiet_cmd_gzip = GZIP    $@
      cmd_gzip = $(KGZIP) -n -f $<
quiet_cmd_xz = XZ      $@
      cmd_xz = $(XZ) --lzma2=dict=2MiB -f $<
      cmd_xz = $(XZ) --check=crc32 --lzma2=dict=1MiB -f $<
quiet_cmd_zstd = ZSTD    $@
      cmd_zstd = $(ZSTD) -T0 --rm -f -q $<

+1 −1
Original line number Diff line number Diff line
@@ -1604,7 +1604,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
	/* First handle the "special" cases */
	if (sym_is(name, namelen, "usb"))
		do_usb_table(symval, sym->st_size, mod);
	if (sym_is(name, namelen, "of"))
	else if (sym_is(name, namelen, "of"))
		do_of_table(symval, sym->st_size, mod);
	else if (sym_is(name, namelen, "pnp"))
		do_pnp_device_entry(symval, sym->st_size, mod);
+13 −2
Original line number Diff line number Diff line
@@ -1015,9 +1015,20 @@ static int secref_whitelist(const char *fromsec, const char *fromsym,
				    "*_console")))
		return 0;

	/* symbols in data sections that may refer to meminit/exit sections */
	/* symbols in data sections that may refer to meminit sections */
	if (match(fromsec, PATTERNS(DATA_SECTIONS)) &&
	    match(tosec, PATTERNS(ALL_XXXINIT_SECTIONS, ALL_EXIT_SECTIONS)) &&
	    match(tosec, PATTERNS(ALL_XXXINIT_SECTIONS, ALL_XXXEXIT_SECTIONS)) &&
	    match(fromsym, PATTERNS("*driver")))
		return 0;

	/*
	 * symbols in data sections must not refer to .exit.*, but there are
	 * quite a few offenders, so hide these unless for W=1 builds until
	 * these are fixed.
	 */
	if (!extra_warn &&
	    match(fromsec, PATTERNS(DATA_SECTIONS)) &&
	    match(tosec, PATTERNS(EXIT_SECTIONS)) &&
	    match(fromsym, PATTERNS("*driver")))
		return 0;

Loading