Skip to content

Commit e81a2da

Browse files
committed
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
2 parents d2c5231 + 2d7d1bc commit e81a2da

File tree

7 files changed

+41
-15
lines changed

7 files changed

+41
-15
lines changed

Documentation/kbuild/kconfig-language.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,32 @@ above, leading to:
573573
bool "Support for foo hardware"
574574
depends on ARCH_FOO_VENDOR || COMPILE_TEST
575575

576+
Optional dependencies
577+
~~~~~~~~~~~~~~~~~~~~~
578+
579+
Some drivers are able to optionally use a feature from another module
580+
or build cleanly with that module disabled, but cause a link failure
581+
when trying to use that loadable module from a built-in driver.
582+
583+
The most common way to express this optional dependency in Kconfig logic
584+
uses the slightly counterintuitive::
585+
586+
config FOO
587+
tristate "Support for foo hardware"
588+
depends on BAR || !BAR
589+
590+
This means that there is either a dependency on BAR that disallows
591+
the combination of FOO=y with BAR=m, or BAR is completely disabled.
592+
For a more formalized approach if there are multiple drivers that have
593+
the same dependency, a helper symbol can be used, like::
594+
595+
config FOO
596+
tristate "Support for foo hardware"
597+
depends on BAR_OPTIONAL
598+
599+
config BAR_OPTIONAL
600+
def_tristate BAR || !BAR
601+
576602
Kconfig recursive dependency limitations
577603
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
578604

include/asm-generic/vmlinux.lds.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,6 @@
138138
* are handled as text/data or they can be discarded (which
139139
* often happens at runtime)
140140
*/
141-
#ifdef CONFIG_HOTPLUG_CPU
142-
#define CPU_KEEP(sec) *(.cpu##sec)
143-
#define CPU_DISCARD(sec)
144-
#else
145-
#define CPU_KEEP(sec)
146-
#define CPU_DISCARD(sec) *(.cpu##sec)
147-
#endif
148141

149142
#if defined(CONFIG_MEMORY_HOTPLUG)
150143
#define MEM_KEEP(sec) *(.mem##sec)

scripts/Makefile.modinst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ endif
144144
quiet_cmd_gzip = GZIP $@
145145
cmd_gzip = $(KGZIP) -n -f $<
146146
quiet_cmd_xz = XZ $@
147-
cmd_xz = $(XZ) --lzma2=dict=2MiB -f $<
147+
cmd_xz = $(XZ) --check=crc32 --lzma2=dict=1MiB -f $<
148148
quiet_cmd_zstd = ZSTD $@
149149
cmd_zstd = $(ZSTD) -T0 --rm -f -q $<
150150

scripts/mod/file2alias.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1604,7 +1604,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
16041604
/* First handle the "special" cases */
16051605
if (sym_is(name, namelen, "usb"))
16061606
do_usb_table(symval, sym->st_size, mod);
1607-
if (sym_is(name, namelen, "of"))
1607+
else if (sym_is(name, namelen, "of"))
16081608
do_of_table(symval, sym->st_size, mod);
16091609
else if (sym_is(name, namelen, "pnp"))
16101610
do_pnp_device_entry(symval, sym->st_size, mod);

scripts/mod/modpost.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,9 +1015,20 @@ static int secref_whitelist(const char *fromsec, const char *fromsym,
10151015
"*_console")))
10161016
return 0;
10171017

1018-
/* symbols in data sections that may refer to meminit/exit sections */
1018+
/* symbols in data sections that may refer to meminit sections */
10191019
if (match(fromsec, PATTERNS(DATA_SECTIONS)) &&
1020-
match(tosec, PATTERNS(ALL_XXXINIT_SECTIONS, ALL_EXIT_SECTIONS)) &&
1020+
match(tosec, PATTERNS(ALL_XXXINIT_SECTIONS, ALL_XXXEXIT_SECTIONS)) &&
1021+
match(fromsym, PATTERNS("*driver")))
1022+
return 0;
1023+
1024+
/*
1025+
* symbols in data sections must not refer to .exit.*, but there are
1026+
* quite a few offenders, so hide these unless for W=1 builds until
1027+
* these are fixed.
1028+
*/
1029+
if (!extra_warn &&
1030+
match(fromsec, PATTERNS(DATA_SECTIONS)) &&
1031+
match(tosec, PATTERNS(EXIT_SECTIONS)) &&
10211032
match(fromsym, PATTERNS("*driver")))
10221033
return 0;
10231034

scripts/package/builddeb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ install_linux_image () {
6464

6565
${MAKE} -f ${srctree}/Makefile INSTALL_MOD_PATH="${pdir}" modules_install
6666
rm -f "${pdir}/lib/modules/${KERNELRELEASE}/build"
67-
rm -f "${pdir}/lib/modules/${KERNELRELEASE}/source"
6867

6968
# Install the kernel
7069
if [ "${ARCH}" = um ] ; then

scripts/package/kernel.spec

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ cp $(%{make} %{makeflags} -s image_name) %{buildroot}/boot/vmlinuz-%{KERNELRELEA
6868
cp System.map %{buildroot}/boot/System.map-%{KERNELRELEASE}
6969
cp .config %{buildroot}/boot/config-%{KERNELRELEASE}
7070
ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEASE}/build
71-
ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEASE}/source
7271
%if %{with_devel}
7372
%{make} %{makeflags} run-command KBUILD_RUN_COMMAND='${srctree}/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE}'
7473
%endif
@@ -101,7 +100,6 @@ fi
101100
%defattr (-, root, root)
102101
/lib/modules/%{KERNELRELEASE}
103102
%exclude /lib/modules/%{KERNELRELEASE}/build
104-
%exclude /lib/modules/%{KERNELRELEASE}/source
105103
/boot/*
106104

107105
%files headers
@@ -113,5 +111,4 @@ fi
113111
%defattr (-, root, root)
114112
/usr/src/kernels/%{KERNELRELEASE}
115113
/lib/modules/%{KERNELRELEASE}/build
116-
/lib/modules/%{KERNELRELEASE}/source
117114
%endif

0 commit comments

Comments
 (0)