public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] Fix wrong source path in scripts/namespace.pl
@ 2010-09-30  6:28 Amerigo Wang
  2010-09-30  6:28 ` [PATCH 2/4] namespace.pl: update file exclusion list Amerigo Wang
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Amerigo Wang @ 2010-09-30  6:28 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Amerigo Wang, Stephen Hemminger, Andrew Morton, Michal Marek,
	linux-kernel

File::Find will do chdir automatically, so we need to get
the absolute patch with $File::Find::dir.

Reported-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Amerigo Wang <amwang@redhat.com>
---
 scripts/namespace.pl |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/namespace.pl b/scripts/namespace.pl
index 361d0f7..fb4e245 100755
--- a/scripts/namespace.pl
+++ b/scripts/namespace.pl
@@ -167,11 +167,11 @@ sub do_nm
 		printf STDERR "$fullname is not an object file\n";
 		return;
 	}
-	($source = $fullname) =~ s/\.o$//;
-	if (-e "$objtree$source.c" || -e "$objtree$source.S") {
-		$source = "$objtree$source";
+	($source = $basename) =~ s/\.o$//;
+	if (-e "$source.c" || -e "$source.S") {
+		$source = "$objtree$File::Find::dir/$source";
 	} else {
-		$source = "$srctree$source";
+		$source = "$srctree$File::Find::dir/$source";
 	}
 	if (! -e "$source.c" && ! -e "$source.S") {
 		# No obvious source, exclude the object if it is conglomerate
-- 
1.6.5.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] namespace.pl: update file exclusion list
  2010-09-30  6:28 [PATCH 1/4] Fix wrong source path in scripts/namespace.pl Amerigo Wang
@ 2010-09-30  6:28 ` Amerigo Wang
  2010-09-30  6:28 ` [PATCH 3/4] Some bug fixes for namespace.pl Amerigo Wang
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Amerigo Wang @ 2010-09-30  6:28 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Stephen Hemminger, Amerigo Wang, Andrew Morton, Michal Marek,
	linux-kernel

From: Stephen Hemminger <shemminger@vyatta.com>

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Amerigo Wang <amwang@redhat.com>

---
 scripts/namespace.pl |  103 +++++++++++++++++++++++++++-----------------------
 1 files changed, 56 insertions(+), 47 deletions(-)

diff --git a/scripts/namespace.pl b/scripts/namespace.pl
index fb4e245..c8d0922 100755
--- a/scripts/namespace.pl
+++ b/scripts/namespace.pl
@@ -84,6 +84,58 @@ my %ksymtab = ();	# names that appear in __ksymtab_
 my %ref = ();		# $ref{$name} exists if there is a true external reference to $name
 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,
+    '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,
+);
+
+my %nameexception = (
+    'mod_use_count_'	 => 1,
+    '__initramfs_end'	=> 1,
+    '__initramfs_start'	=> 1,
+    '_einittext'	=> 1,
+    '_sinittext'	=> 1,
+    'kallsyms_names'	=> 1,
+    'kallsyms_num_syms'	=> 1,
+    'kallsyms_addresses'=> 1,
+    '__this_module'	=> 1,
+    '_etext'		=> 1,
+    '_edata'		=> 1,
+    '_end'		=> 1,
+    '__bss_start'	=> 1,
+    '_text'		=> 1,
+    '_stext'		=> 1,
+    '__gp'		=> 1,
+    'ia64_unw_start'	=> 1,
+    'ia64_unw_end'	=> 1,
+    '__init_begin'	=> 1,
+    '__init_end'	=> 1,
+    '__bss_stop'	=> 1,
+    '__nosave_begin'	=> 1,
+    '__nosave_end'	=> 1,
+    'pg0'		=> 1,
+);
+
+
 &find(\&linux_objects, '.');	# find the objects and do_nm on them
 &list_multiply_defined();
 &resolve_external_references();
@@ -270,27 +322,9 @@ sub do_nm
 	close($nmdata);
 
 	if ($#nmdata < 0) {
-		if (
-			$fullname ne "lib/brlock.o"
-			&& $fullname ne "lib/dec_and_lock.o"
-			&& $fullname ne "fs/xfs/xfs_macros.o"
-			&& $fullname ne "drivers/ide/ide-probe-mini.o"
-			&& $fullname ne "usr/initramfs_data.o"
-			&& $fullname ne "drivers/acpi/executer/exdump.o"
-			&& $fullname ne "drivers/acpi/resources/rsdump.o"
-			&& $fullname ne "drivers/acpi/namespace/nsdumpdv.o"
-			&& $fullname ne "drivers/acpi/namespace/nsdump.o"
-			&& $fullname ne "arch/ia64/sn/kernel/sn2/io.o"
-			&& $fullname ne "arch/ia64/kernel/gate-data.o"
-			&& $fullname ne "drivers/ieee1394/oui.o"
-			&& $fullname ne "security/capability.o"
-			&& $fullname ne "sound/core/wrappers.o"
-			&& $fullname ne "fs/ntfs/sysctl.o"
-			&& $fullname ne "fs/jfs/jfs_debug.o"
-		) {
-			printf "No nm data for $fullname\n";
-		}
-		return;
+	    printf "No nm data for $fullname\n"
+		unless $nmexception{$fullname};
+	    return;
 	}
 	$nmdata{$fullname} = \@nmdata;
 }
@@ -372,31 +406,7 @@ sub resolve_external_references
 						$ref{$name} = ""
 					}
 				}
-				elsif (    $name ne "mod_use_count_"
-					&& $name ne "__initramfs_end"
-					&& $name ne "__initramfs_start"
-					&& $name ne "_einittext"
-					&& $name ne "_sinittext"
-					&& $name ne "kallsyms_names"
-					&& $name ne "kallsyms_num_syms"
-					&& $name ne "kallsyms_addresses"
-					&& $name ne "__this_module"
-					&& $name ne "_etext"
-					&& $name ne "_edata"
-					&& $name ne "_end"
-					&& $name ne "__bss_start"
-					&& $name ne "_text"
-					&& $name ne "_stext"
-					&& $name ne "__gp"
-					&& $name ne "ia64_unw_start"
-					&& $name ne "ia64_unw_end"
-					&& $name ne "__init_begin"
-					&& $name ne "__init_end"
-					&& $name ne "__bss_stop"
-					&& $name ne "__nosave_begin"
-					&& $name ne "__nosave_end"
-					&& $name ne "pg0"
-					&& $name ne "__module_text_address"
+				elsif ( ! $nameexception{$name}
 					&& $name !~ /^__sched_text_/
 					&& $name !~ /^__start_/
 					&& $name !~ /^__end_/
@@ -407,7 +417,6 @@ sub resolve_external_references
 					&& $name !~ /^__.*per_cpu_end/
 					&& $name !~ /^__alt_instructions/
 					&& $name !~ /^__setup_/
-					&& $name !~ /^jiffies/
 					&& $name !~ /^__mod_timer/
 					&& $name !~ /^__mod_page_state/
 					&& $name !~ /^init_module/
-- 
1.6.5.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] Some bug fixes for namespace.pl
  2010-09-30  6:28 [PATCH 1/4] Fix wrong source path in scripts/namespace.pl Amerigo Wang
  2010-09-30  6:28 ` [PATCH 2/4] namespace.pl: update file exclusion list Amerigo Wang
@ 2010-09-30  6:28 ` Amerigo Wang
  2010-09-30  6:28 ` [PATCH 4/4] Improve namespace.pl to get more correct result Amerigo Wang
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Amerigo Wang @ 2010-09-30  6:28 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Amerigo Wang, Stephen Hemminger, Andrew Morton, Michal Marek,
	linux-kernel

1. Teach namespace.pl to understand "V" and "v"
2. cond_syscalls are moved into kernel/sys_ni.c

Signed-off-by: Amerigo Wang <amwang@redhat.com>
---
 scripts/namespace.pl |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/scripts/namespace.pl b/scripts/namespace.pl
index c8d0922..bccf610 100755
--- a/scripts/namespace.pl
+++ b/scripts/namespace.pl
@@ -266,6 +266,7 @@ sub do_nm
 		# T global label/procedure
 		# U external reference
 		# W weak external reference to text that has been resolved
+		# V similar to W, but the value of the weak symbol becomes zero with no error.
 		# a assembler equate
 		# b static variable, uninitialised
 		# d static variable, initialised
@@ -274,8 +275,9 @@ sub do_nm
 		# s static variable, uninitialised, small bss
 		# t static label/procedures
 		# w weak external reference to text that has not been resolved
+		# v similar to w
 		# ? undefined type, used a lot by modules
-		if ($type !~ /^[ABCDGRSTUWabdgrstw?]$/) {
+		if ($type !~ /^[ABCDGRSTUWVabdgrstwv?]$/) {
 			printf STDERR "nm output for $fullname contains unknown type '$_'\n";
 		}
 		elsif ($name =~ /\./) {
@@ -286,7 +288,7 @@ sub do_nm
 			# binutils keeps changing the type for exported symbols, force it to R
 			$type = 'R' if ($name =~ /^__ksymtab/ || $name =~ /^__kstrtab/);
 			$name =~ s/_R[a-f0-9]{8}$//;	# module versions adds this
-			if ($type =~ /[ABCDGRSTW]/ &&
+			if ($type =~ /[ABCDGRSTWV]/ &&
 				$name ne 'init_module' &&
 				$name ne 'cleanup_module' &&
 				$name ne 'Using_Versions' &&
@@ -353,11 +355,12 @@ sub list_multiply_defined
 	foreach my $name (keys(%def)) {
 		if ($#{$def{$name}} > 0) {
 			# Special case for cond_syscall
-			if ($#{$def{$name}} == 1 && $name =~ /^sys_/ &&
-			    ($def{$name}[0] eq "kernel/sys.o" ||
-			     $def{$name}[1] eq "kernel/sys.o")) {
-				&drop_def("kernel/sys.o", $name);
-				next;
+			if ($#{$def{$name}} == 1 && $name =~ /^sys_/) {
+				if($def{$name}[0] eq "kernel/sys_ni.o" ||
+				   $def{$name}[1] eq "kernel/sys_ni.o") {
+					&drop_def("kernel/sys_ni.o", $name);
+					next;
+				}
 			}
 			# Special case for i386 entry code
 			if ($#{$def{$name}} == 1 && $name =~ /^__kernel_/ &&
-- 
1.6.5.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] Improve namespace.pl to get more correct result
  2010-09-30  6:28 [PATCH 1/4] Fix wrong source path in scripts/namespace.pl Amerigo Wang
  2010-09-30  6:28 ` [PATCH 2/4] namespace.pl: update file exclusion list Amerigo Wang
  2010-09-30  6:28 ` [PATCH 3/4] Some bug fixes for namespace.pl Amerigo Wang
@ 2010-09-30  6:28 ` Amerigo Wang
  2010-09-30  7:01 ` [PATCH 1/4] Fix wrong source path in scripts/namespace.pl Stephen Hemminger
       [not found] ` <20101001145618.613e3e1f@s6510>
  4 siblings, 0 replies; 6+ messages in thread
From: Amerigo Wang @ 2010-09-30  6:28 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Amerigo Wang, Stephen Hemminger, Andrew Morton, Michal Marek,
	linux-kernel

Exclude more symbols from arch/x86/vdso/ and arch/x86/boot/;
add some more linker-defined symbols into exception list;
add other cond_syscalls besides "sys_*".

Signed-off-by: Amerigo Wang <amwang@redhat.com>
---
 scripts/namespace.pl |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/scripts/namespace.pl b/scripts/namespace.pl
index bccf610..a71be6b 100755
--- a/scripts/namespace.pl
+++ b/scripts/namespace.pl
@@ -133,6 +133,12 @@ my %nameexception = (
     '__nosave_begin'	=> 1,
     '__nosave_end'	=> 1,
     'pg0'		=> 1,
+    'vdso_enabled'	=> 1,
+    '__stack_chk_fail'  => 1,
+    'VDSO32_PRELINK'	=> 1,
+    'VDSO32_vsyscall'	=> 1,
+    'VDSO32_rt_sigreturn'=>1,
+    'VDSO32_sigreturn'	=> 1,
 );
 
 
@@ -157,7 +163,8 @@ sub linux_objects
 	if (/.*\.o$/ &&
 		! (
 		m:/built-in.o$:
-		|| m:arch/x86/kernel/vsyscall-syms.o$:
+		|| m:arch/x86/vdso/:
+		|| m:arch/x86/boot/:
 		|| m:arch/ia64/ia32/ia32.o$:
 		|| m:arch/ia64/kernel/gate-syms.o$:
 		|| m:arch/ia64/lib/__divdi3.o$:
@@ -200,6 +207,7 @@ sub linux_objects
 		|| m:^.*/\.tmp_:
 		|| m:^\.tmp_:
 		|| m:/vmlinux-obj.o$:
+		|| m:^tools/:
 		)
 	) {
 		do_nm($basename, $_);
@@ -355,20 +363,15 @@ sub list_multiply_defined
 	foreach my $name (keys(%def)) {
 		if ($#{$def{$name}} > 0) {
 			# Special case for cond_syscall
-			if ($#{$def{$name}} == 1 && $name =~ /^sys_/) {
+			if ($#{$def{$name}} == 1 &&
+			   ($name =~ /^sys_/ || $name =~ /^compat_sys_/ ||
+			    $name =~ /^sys32_/)) {
 				if($def{$name}[0] eq "kernel/sys_ni.o" ||
 				   $def{$name}[1] eq "kernel/sys_ni.o") {
 					&drop_def("kernel/sys_ni.o", $name);
 					next;
 				}
 			}
-			# Special case for i386 entry code
-			if ($#{$def{$name}} == 1 && $name =~ /^__kernel_/ &&
-			    $def{$name}[0] eq "arch/x86/kernel/vsyscall-int80_32.o" &&
-			    $def{$name}[1] eq "arch/x86/kernel/vsyscall-sysenter_32.o") {
-				&drop_def("arch/x86/kernel/vsyscall-sysenter_32.o", $name);
-				next;
-			}
 
 			printf "$name is multiply defined in :-\n";
 			foreach my $module (@{$def{$name}}) {
-- 
1.6.5.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/4] Fix wrong source path in scripts/namespace.pl
  2010-09-30  6:28 [PATCH 1/4] Fix wrong source path in scripts/namespace.pl Amerigo Wang
                   ` (2 preceding siblings ...)
  2010-09-30  6:28 ` [PATCH 4/4] Improve namespace.pl to get more correct result Amerigo Wang
@ 2010-09-30  7:01 ` Stephen Hemminger
       [not found] ` <20101001145618.613e3e1f@s6510>
  4 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2010-09-30  7:01 UTC (permalink / raw)
  To: Amerigo Wang; +Cc: linux-kbuild, Andrew Morton, Michal Marek, linux-kernel

On Thu, 30 Sep 2010 14:28:55 +0800
Amerigo Wang <amwang@redhat.com> wrote:

> File::Find will do chdir automatically, so we need to get
> the absolute patch with $File::Find::dir.
> 
> Reported-by: Stephen Hemminger <shemminger@vyatta.com>
> Signed-off-by: Amerigo Wang <amwang@redhat.com>

Works for me.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/4] Fix wrong source path in scripts/namespace.pl
       [not found] ` <20101001145618.613e3e1f@s6510>
@ 2010-10-01  6:28   ` Cong Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Cong Wang @ 2010-10-01  6:28 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: linux-kbuild, Andrew Morton, Michal Marek, linux-kernel

On 10/01/10 13:56, Stephen Hemminger wrote:
> On Thu, 30 Sep 2010 14:28:55 +0800
> Amerigo Wang<amwang@redhat.com>  wrote:
>
>> File::Find will do chdir automatically, so we need to get
>> the absolute patch with $File::Find::dir.
>>
>> Reported-by: Stephen Hemminger<shemminger@vyatta.com>
>> Signed-off-by: Amerigo Wang<amwang@redhat.com>
>> ---
>>   scripts/namespace.pl |    8 ++++----
>>   1 files changed, 4 insertions(+), 4 deletions(-)
>
> How did you test this? I tried your patches and when I run
> it on a compiled kernel in a way that most developers would
> do it:
>   $ make allmodconfig
>   $ make
>   $ ./scripts/namespace.pl


I use 'make namespacecheck'.

>
> With your patch it still doesn't find the kernel source files.
> I find it frustrating because my patch worked, yours didn't.
>
> --------
> No source file found for arch/x86/crypto/aes-i586-asm_32.o
> No source file found for arch/x86/crypto/aes_glue.o
...

Actually, this shows it is working. :)

There are two reasons why you got so many of these:

1) You didn't do a 'make mrproper', so some source file may be
deleted or renamed in git repo;

2) There are no path/to/foo.c for path/to/foo.o which is
normal, we should add those files to exception list.

I got much fewer of such warning when I tested it.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-10-01  6:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-30  6:28 [PATCH 1/4] Fix wrong source path in scripts/namespace.pl Amerigo Wang
2010-09-30  6:28 ` [PATCH 2/4] namespace.pl: update file exclusion list Amerigo Wang
2010-09-30  6:28 ` [PATCH 3/4] Some bug fixes for namespace.pl Amerigo Wang
2010-09-30  6:28 ` [PATCH 4/4] Improve namespace.pl to get more correct result Amerigo Wang
2010-09-30  7:01 ` [PATCH 1/4] Fix wrong source path in scripts/namespace.pl Stephen Hemminger
     [not found] ` <20101001145618.613e3e1f@s6510>
2010-10-01  6:28   ` Cong Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox