Coccinelle: Add contextual message
[linux-2.6.git] / scripts / namespace.pl
index bccf610..fd2d946 100755 (executable)
@@ -133,8 +133,34 @@ 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,
 );
 
+# Files with exceptions to source file location
+my %sourceloc = (
+    'net/dccp/dccp_probe.o'    => 'probe',
+    'net/dccp/dccp_ipv4.o'     => 'ipv4',
+    'net/dccp/dccp_ipv6.o'     => 'ipv6',
+    'net/dccp/dccp_diag.o'     => 'diag',
+    'drivers/char/hw_random/rng-core.o'        => 'core',
+    'fs/fat/msdos.o'           => 'namei_msdos',
+    'fs/fat/vfat.o'            => 'namei_vfat',
+    'fs/nfs_common/nfs_acl.o'  => 'nfsacl',
+    'sound/soundcore.o'                => 'sound_core',
+    'drivers/md/dm-mirror.o'   => 'dm-raid1',
+    'drivers/message/i2o/i2o_bus.o' => 'bus-osm',
+    'arch/x86/kvm/kvm-amd.o'   => 'svm',
+    'arch/x86/kvm/kvm-intel.o' => 'vmx',
+    'arch/x86/crypto/twofish-x86_64.o' => 'twofish-x86_64-asm_64',
+    'arch/x86/crypto/aes-x86_64.o' => 'aes-x86_64-asm_64',
+    'arch/x86/crypto/aesni-intel.o' => 'aesni-intel_asm',
+    'arch/x86/crypto/salsa20-x86_64.o' => 'salsa20-x86_64-asm_64',
+);
 
 &find(\&linux_objects, '.');   # find the objects and do_nm on them
 &list_multiply_defined();
@@ -157,7 +183,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 +227,7 @@ sub linux_objects
                || m:^.*/\.tmp_:
                || m:^\.tmp_:
                || m:/vmlinux-obj.o$:
+               || m:^tools/:
                )
        ) {
                do_nm($basename, $_);
@@ -220,11 +248,15 @@ sub do_nm
                return;
        }
        ($source = $basename) =~ s/\.o$//;
+
+       $source = $sourceloc{$fullname} if ($sourceloc{$fullname});
+
        if (-e "$source.c" || -e "$source.S") {
                $source = "$objtree$File::Find::dir/$source";
        } else {
                $source = "$srctree$File::Find::dir/$source";
        }
+
        if (! -e "$source.c" && ! -e "$source.S") {
                # No obvious source, exclude the object if it is conglomerate
                open(my $objdumpdata, "$objdump $basename|")
@@ -355,20 +387,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}}) {