Kbuild fixes for v6.13 (2nd)

- Remove stale code in usr/include/headers_check.pl
 
  - Fix issues in the user-mode-linux Debian package
 
  - Fix false-positive "export twice" errors in modpost
 -----BEGIN PGP SIGNATURE-----
 
 iQJJBAABCgAzFiEEbmPs18K1szRHjPqEPYsBB53g2wYFAmdmyq4VHG1hc2FoaXJv
 eUBrZXJuZWwub3JnAAoJED2LAQed4NsGbEcQAJGVUhg9pWwCVmmj69B+Sj1sOM21
 CJP+0B3sEQCzMICkG84h2NwOdGCRcF7AkGVPOfiVAzGbC7B1+iuSgyTb7RLOouhr
 Z69PqwsMluG8pQRkAI76MVrL/N8695x6r50xc1xR9J9MgIEL0+7QBLRHF+IFlpZl
 75/EuvzxzMsAa11io7T5krcn7IpuRuLV1LgNicPG5fuEM7DNZqzufZDOzbAQaNO3
 wrLvRSfJ6cmKq6I3hNImN39H1ccDvZJcIKu4bSpITG9wmYpYt69lhKG19qpdT0s9
 hVIgXnU0hEtdLMCNlH6Tp6R+iytiQ7EQ6B8F3Xr0bpmwBZIvBwresXfCZzbZHoIy
 ioOG0g8lFgDqNWnAH7+QvGjZ7Cn1lexaQNtt+ullx+g+jCMytyFWN6dw+XPJxorY
 HK1oE91geFtpc4emQFn/xo47NqX1LshNPiMMWuJdZwXFdIpbkhkECFf/QRfDWkmr
 jsOqmOJZpxHNwOq4VQuqxhBr5LYy6WVTX43anTL95SRO+ArqDy1nym4LO3Oh0FSp
 WRnuJ5kcdRrYKdji/xCZ8CafLaDmGbRKg1stXukS7jWAJALBKvndafr7X6BKLmD9
 j5UU2tBi24HDTnDjiQTP7/ElUrkecOkis6dHzqvtfJDlcFTPNLnHuBfqdjit2U9j
 8keM+ZF0ys0DHIvb
 =X4LY
 -----END PGP SIGNATURE-----

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

Pull Kbuild fixes from Masahiro Yamada:

 - Remove stale code in usr/include/headers_check.pl

 - Fix issues in the user-mode-linux Debian package

 - Fix false-positive "export twice" errors in modpost

* tag 'kbuild-fixes-v6.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  modpost: distinguish same module paths from different dump files
  kbuild: deb-pkg: Do not install maint scripts for arch 'um'
  kbuild: deb-pkg: add debarch for ARCH=um
  kbuild: Drop support for include/asm-<arch> in headers_check.pl
This commit is contained in:
Linus Torvalds 2024-12-21 11:24:32 -08:00
commit a016546ba6
6 changed files with 27 additions and 17 deletions

View File

@ -155,12 +155,13 @@ char *get_line(char **stringp)
/* A list of all modules we processed */
LIST_HEAD(modules);
static struct module *find_module(const char *modname)
static struct module *find_module(const char *filename, const char *modname)
{
struct module *mod;
list_for_each_entry(mod, &modules, list) {
if (strcmp(mod->name, modname) == 0)
if (!strcmp(mod->dump_file, filename) &&
!strcmp(mod->name, modname))
return mod;
}
return NULL;
@ -2030,10 +2031,10 @@ static void read_dump(const char *fname)
continue;
}
mod = find_module(modname);
mod = find_module(fname, modname);
if (!mod) {
mod = new_module(modname, strlen(modname));
mod->from_dump = true;
mod->dump_file = fname;
}
s = sym_add_exported(symname, mod, gpl_only, namespace);
sym_set_crc(s, crc);
@ -2052,7 +2053,7 @@ static void write_dump(const char *fname)
struct symbol *sym;
list_for_each_entry(mod, &modules, list) {
if (mod->from_dump)
if (mod->dump_file)
continue;
list_for_each_entry(sym, &mod->exported_symbols, list) {
if (trim_unused_exports && !sym->used)
@ -2076,7 +2077,7 @@ static void write_namespace_deps_files(const char *fname)
list_for_each_entry(mod, &modules, list) {
if (mod->from_dump || list_empty(&mod->missing_namespaces))
if (mod->dump_file || list_empty(&mod->missing_namespaces))
continue;
buf_printf(&ns_deps_buf, "%s.ko:", mod->name);
@ -2194,7 +2195,7 @@ int main(int argc, char **argv)
read_symbols_from_files(files_source);
list_for_each_entry(mod, &modules, list) {
if (mod->from_dump || mod->is_vmlinux)
if (mod->dump_file || mod->is_vmlinux)
continue;
check_modname_len(mod);
@ -2205,7 +2206,7 @@ int main(int argc, char **argv)
handle_white_list_exports(unused_exports_white_list);
list_for_each_entry(mod, &modules, list) {
if (mod->from_dump)
if (mod->dump_file)
continue;
if (mod->is_vmlinux)

View File

@ -95,14 +95,15 @@ struct module_alias {
/**
* struct module - represent a module (vmlinux or *.ko)
*
* @dump_file: path to the .symvers file if loaded from a file
* @aliases: list head for module_aliases
*/
struct module {
struct list_head list;
struct list_head exported_symbols;
struct list_head unresolved_symbols;
const char *dump_file;
bool is_gpl_compatible;
bool from_dump; /* true if module was loaded from *.symvers */
bool is_vmlinux;
bool seen;
bool has_init;

View File

@ -63,6 +63,12 @@ install_linux_image () {
esac
cp "$(${MAKE} -s -f ${srctree}/Makefile image_name)" "${pdir}/${installed_image_path}"
if [ "${ARCH}" != um ]; then
install_maint_scripts "${pdir}"
fi
}
install_maint_scripts () {
# Install the maintainer scripts
# Note: hook scripts under /etc/kernel are also executed by official Debian
# kernel packages, as well as kernel packages built using make-kpkg.

View File

@ -70,6 +70,13 @@ set_debarch() {
debarch=sh4$(if_enabled_echo CONFIG_CPU_BIG_ENDIAN eb)
fi
;;
um)
if is_enabled CONFIG_64BIT; then
debarch=amd64
else
debarch=i386
fi
;;
esac
if [ -z "$debarch" ]; then
debarch=$(dpkg-architecture -qDEB_HOST_ARCH)

View File

@ -78,7 +78,7 @@ quiet_cmd_hdrtest = HDRTEST $<
cmd_hdrtest = \
$(CC) $(c_flags) -fsyntax-only -x c /dev/null \
$(if $(filter-out $(no-header-test), $*.h), -include $< -include $<); \
$(PERL) $(src)/headers_check.pl $(obj) $(SRCARCH) $<; \
$(PERL) $(src)/headers_check.pl $(obj) $<; \
touch $@
$(obj)/%.hdrtest: $(obj)/%.h FORCE

View File

@ -3,9 +3,8 @@
#
# headers_check.pl execute a number of trivial consistency checks
#
# Usage: headers_check.pl dir arch [files...]
# Usage: headers_check.pl dir [files...]
# dir: dir to look for included files
# arch: architecture
# files: list of files to check
#
# The script reads the supplied files line by line and:
@ -23,7 +22,7 @@ use warnings;
use strict;
use File::Basename;
my ($dir, $arch, @files) = @ARGV;
my ($dir, @files) = @ARGV;
my $ret = 0;
my $line;
@ -54,10 +53,6 @@ sub check_include
my $inc = $1;
my $found;
$found = stat($dir . "/" . $inc);
if (!$found) {
$inc =~ s#asm/#asm-$arch/#;
$found = stat($dir . "/" . $inc);
}
if (!$found) {
printf STDERR "$filename:$lineno: included file '$inc' is not exported\n";
$ret = 1;