Skip to contentSkip to conversation

scripts: update namespace.pl

PATCH In review [email protected] 2 participants 8 messages Oct 3, 2019 – Oct 23, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

cover scripts: update namespace.pl

This patch series updates scripts/namespace.pl:

1/4: handle rename of lib-ksyms.o to lib.a by scripts/Makefile.build 2/4: add a few x86 object files to the namespace exceptions list 3/4: include trailing ".o" in the namespace exceptions list of
file names and change/fix "acpia" to "acpica"
4/4: add a blank line to separate a section of the output

 scripts/namespace.pl |   48 +++++++++++++++++++++++------------------
 1 file changed, 27 insertions(+), 21 deletions(-)
#1 lore raw

PATCH 1/4 scripts: namespace.pl: handle lib-ksyms.o as lib.a

Fix these warnings:
No source file found for drivers/firmware/efi/libstub/lib-ksyms.o No source file found for arch/x86/lib/lib-ksyms.o
No source file found for lib/lib-ksyms.o

In scripts/Makefile.build, any resulting lib-ksyms.o file is renamed to lib.a, so handle that rename here also.

Cc Masahiro Yamada <[email protected]>
Cc Randy Dunlap <[email protected]>

---
patch 1/4:

 scripts/namespace.pl |    3 +++
 1 file changed, 3 insertions(+)
scripts/namespace.pl +3 -0
@@ -231,6 +231,9 @@ sub do_nm
 		return;
 	}
 	($source = $basename) =~ s/\.o$//;
+	if ($basename eq "lib-ksyms.o") { # modified in scripts/Makefile.build
+		$basename = "lib.a";	# from lib.a to lib-ksyms.o
+	}
 	if (-e "$source.c" || -e "$source.S") {
 		$source = File::Spec->catfile($objtree, $File::Find::dir, $source)
 	} else {
#3 lore raw

PATCH 2/4 scripts: namespace.pl: add some x86 object files to nmexception

In reply to [email protected]

These x86 object files do not have any exports or public symbols so they can be excluded from the namespace checking.

Cc Masahiro Yamada <[email protected]>
Cc Randy Dunlap <[email protected]>

---
patch 2/4:

 scripts/namespace.pl |    2 ++
 1 file changed, 2 insertions(+)
scripts/namespace.pl +2 -0
@@ -91,6 +91,8 @@ my %nmexception = (
     'arch/x86/lib/thunk_32'		=> 1,
     'arch/x86/lib/cmpxchg'		=> 1,
     'arch/x86/vdso/vdso32/note'		=> 1,
+    'arch/x86/entry/vdso/vdso-note.o'	=> 1,
+    'arch/x86/entry/vdso/vdso32/note.o'	=> 1,
     'lib/irq_regs'			=> 1,
     'usr/initramfs_data'		=> 1,
     'drivers/scsi/aic94xx/aic94xx_dump'	=> 1,
#5 lore raw

PATCH 3/4 scripts: namespace.pl: add .o to nmexception file names and fix "acpica"

In reply to [email protected]

'nm' exceptions are checked against $fullname, which includes the trailing '.o', so the list of file names should include the trailing '.o'.
Also, the sub-directory for drivers/acpi/acpica/ has a typo, so s/acpia/acpica/g.

The acpica list of exceptions almost surely needs to be updated.

Cc Masahiro Yamada <[email protected]>
Cc Randy Dunlap <[email protected]>

---
patch 3/4:

 scripts/namespace.pl |   42 ++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)
scripts/namespace.pl +21 -21
@@ -86,29 +86,29 @@ my %ref = ();		# $ref{$name} exists if t
 my %export = ();	# $export{$name} exists if there is an EXPORT_... of $name
 
 my %nmexception = (
-    'fs/ext3/bitmap'			=> 1,
-    'fs/ext4/bitmap'			=> 1,
-    'arch/x86/lib/thunk_32'		=> 1,
-    'arch/x86/lib/cmpxchg'		=> 1,
-    'arch/x86/vdso/vdso32/note'		=> 1,
+    'fs/ext3/bitmap.o'			=> 1,
+    'fs/ext4/bitmap.o'			=> 1,
+    'arch/x86/lib/thunk_32.o'		=> 1,
+    'arch/x86/lib/cmpxchg.o'		=> 1,
+    'arch/x86/vdso/vdso32/note.o'	=> 1,
     'arch/x86/entry/vdso/vdso-note.o'	=> 1,
     'arch/x86/entry/vdso/vdso32/note.o'	=> 1,
-    'lib/irq_regs'			=> 1,
-    'usr/initramfs_data'		=> 1,
-    'drivers/scsi/aic94xx/aic94xx_dump'	=> 1,
-    'drivers/scsi/libsas/sas_dump'	=> 1,
-    'lib/dec_and_lock'			=> 1,
-    'drivers/ide/ide-probe-mini'	=> 1,
-    'usr/initramfs_data'		=> 1,
-    'drivers/acpi/acpia/exdump'		=> 1,
-    'drivers/acpi/acpia/rsdump'		=> 1,
-    'drivers/acpi/acpia/nsdumpdv'	=> 1,
-    'drivers/acpi/acpia/nsdump'		=> 1,
-    'arch/ia64/sn/kernel/sn2/io'	=> 1,
-    'arch/ia64/kernel/gate-data'	=> 1,
-    'security/capability'		=> 1,
-    'fs/ntfs/sysctl'			=> 1,
-    'fs/jfs/jfs_debug'			=> 1,
+    'lib/irq_regs.o'			=> 1,
+    'usr/initramfs_data.o'		=> 1,
+    'drivers/scsi/aic94xx/aic94xx_dump.o' => 1,
+    'drivers/scsi/libsas/sas_dump.o'	=> 1,
+    'lib/dec_and_lock.o'		=> 1,
+    'drivers/ide/ide-probe-mini.o'	=> 1,
+    'usr/initramfs_data.o'		=> 1,
+    'drivers/acpi/acpica/exdump.o'	=> 1,
+    'drivers/acpi/acpica/rsdump.o'	=> 1,
+    'drivers/acpi/acpica/nsdumpdv.o'	=> 1,
+    'drivers/acpi/acpica/nsdump.o'	=> 1,
+    'arch/ia64/sn/kernel/sn2/io.o'	=> 1,
+    'arch/ia64/kernel/gate-data.o'	=> 1,
+    'security/capability.o'		=> 1,
+    'fs/ntfs/sysctl.o'			=> 1,
+    'fs/jfs/jfs_debug.o'		=> 1,
 );
 
 my %nameexception = (
#7 lore raw

PATCH 4/4 scripts: namespace.pl: add blank section separator line

In reply to [email protected]

Most namespace report sections are separated by blank lines, but a blank line is needed before the "multiply defined" output as a separator, to make it easier to find the beginning of this section of output.

Cc Masahiro Yamada <[email protected]>
Cc Randy Dunlap <[email protected]>

---
patch 4/4:

 scripts/namespace.pl |    1 +
 1 file changed, 1 insertion(+)
scripts/namespace.pl +1 -0
@@ -368,6 +368,7 @@ sub drop_def
 
 sub list_multiply_defined
 {
+	printf "\n";
 	foreach my $name (keys(%def)) {
 		if ($#{$def{$name}} > 0) {
 			# Special case for cond_syscall
#2 lore raw

Re: [PATCH 1/4] scripts: namespace.pl: handle lib-ksyms.o as lib.a

In reply to [email protected]

Randy,

Quoted 2 lines · On Thu, Oct 3, 2019 at 12:18 PM <[email protected]> wrote:

In scripts/Makefile.build, any resulting lib-ksyms.o file is renamed to lib.a, so handle that rename here also.

This description is incorrect.
lib-ksyms.o is included in built-in.a

The code attempts to suppress the warnings
in a strange way.

I think the following is a more straightforward way.

scripts/namespace.pl +1 -0
index 4a545ba868f8..f0c94333a23d 100755
@@ -166,6 +166,7 @@ sub linux_objects
        if (/.*\.o$/ &&
                ! (
                m:/built-in.a$:
+               || m:/lib-ksyms.o$:
                || m:arch/x86/vdso/:
                || m:arch/x86/boot/:
                || m:arch/ia64/ia32/ia32.o$:

--
Best Regards
Masahiro Yamada

#4 lore raw

Re: [PATCH 2/4] scripts: namespace.pl: add some x86 object files to nmexception

In reply to [email protected]

On Thu, Oct 3, 2019 at 12:18 PM <[email protected]> wrote:

You can grow %nmexception until
you no longer see "No nm data for ..." messages,
but is this maintainable?

I think it is more realistic to
delete the printf "No nm data for $fullname\n" line.

Signature · 2 lines
Best Regards
Masahiro Yamada
#6 lore raw

Re: [PATCH 3/4] scripts: namespace.pl: add .o to nmexception file names and fix "acpica"

In reply to [email protected]

On Thu, Oct 3, 2019 at 12:18 PM <[email protected]> wrote:

The same comment as 2/4.
I doubt if %nmexception is maintainable.

For example, you are fixing fs/ext3/bitmap to fs/ext3/bitmap.o but I do not see the directory fs/ext3/.

How many entries in the %nmexception are still valid?

--
Best Regards
Masahiro Yamada