diff options
Diffstat (limited to 'scripts/namespace.pl')
| -rwxr-xr-x | scripts/namespace.pl | 147 |
1 files changed, 81 insertions, 66 deletions
diff --git a/scripts/namespace.pl b/scripts/namespace.pl index 361d0f71184b..a71be6b7cdec 100755 --- a/scripts/namespace.pl +++ b/scripts/namespace.pl | |||
| @@ -84,6 +84,64 @@ my %ksymtab = (); # names that appear in __ksymtab_ | |||
| 84 | my %ref = (); # $ref{$name} exists if there is a true external reference to $name | 84 | my %ref = (); # $ref{$name} exists if there is a true external reference to $name |
| 85 | my %export = (); # $export{$name} exists if there is an EXPORT_... of $name | 85 | my %export = (); # $export{$name} exists if there is an EXPORT_... of $name |
| 86 | 86 | ||
| 87 | my %nmexception = ( | ||
| 88 | 'fs/ext3/bitmap' => 1, | ||
| 89 | 'fs/ext4/bitmap' => 1, | ||
| 90 | 'arch/x86/lib/thunk_32' => 1, | ||
| 91 | 'arch/x86/lib/cmpxchg' => 1, | ||
| 92 | 'arch/x86/vdso/vdso32/note' => 1, | ||
| 93 | 'lib/irq_regs' => 1, | ||
| 94 | 'usr/initramfs_data' => 1, | ||
| 95 | 'drivers/scsi/aic94xx/aic94xx_dump' => 1, | ||
| 96 | 'drivers/scsi/libsas/sas_dump' => 1, | ||
| 97 | 'lib/dec_and_lock' => 1, | ||
| 98 | 'drivers/ide/ide-probe-mini' => 1, | ||
| 99 | 'usr/initramfs_data' => 1, | ||
| 100 | 'drivers/acpi/acpia/exdump' => 1, | ||
| 101 | 'drivers/acpi/acpia/rsdump' => 1, | ||
| 102 | 'drivers/acpi/acpia/nsdumpdv' => 1, | ||
| 103 | 'drivers/acpi/acpia/nsdump' => 1, | ||
| 104 | 'arch/ia64/sn/kernel/sn2/io' => 1, | ||
| 105 | 'arch/ia64/kernel/gate-data' => 1, | ||
| 106 | 'security/capability' => 1, | ||
| 107 | 'fs/ntfs/sysctl' => 1, | ||
| 108 | 'fs/jfs/jfs_debug' => 1, | ||
| 109 | ); | ||
| 110 | |||
| 111 | my %nameexception = ( | ||
| 112 | 'mod_use_count_' => 1, | ||
| 113 | '__initramfs_end' => 1, | ||
| 114 | '__initramfs_start' => 1, | ||
| 115 | '_einittext' => 1, | ||
| 116 | '_sinittext' => 1, | ||
| 117 | 'kallsyms_names' => 1, | ||
| 118 | 'kallsyms_num_syms' => 1, | ||
| 119 | 'kallsyms_addresses'=> 1, | ||
| 120 | '__this_module' => 1, | ||
| 121 | '_etext' => 1, | ||
| 122 | '_edata' => 1, | ||
| 123 | '_end' => 1, | ||
| 124 | '__bss_start' => 1, | ||
| 125 | '_text' => 1, | ||
| 126 | '_stext' => 1, | ||
| 127 | '__gp' => 1, | ||
| 128 | 'ia64_unw_start' => 1, | ||
| 129 | 'ia64_unw_end' => 1, | ||
| 130 | '__init_begin' => 1, | ||
| 131 | '__init_end' => 1, | ||
| 132 | '__bss_stop' => 1, | ||
| 133 | '__nosave_begin' => 1, | ||
| 134 | '__nosave_end' => 1, | ||
| 135 | 'pg0' => 1, | ||
| 136 | 'vdso_enabled' => 1, | ||
| 137 | '__stack_chk_fail' => 1, | ||
| 138 | 'VDSO32_PRELINK' => 1, | ||
| 139 | 'VDSO32_vsyscall' => 1, | ||
| 140 | 'VDSO32_rt_sigreturn'=>1, | ||
| 141 | 'VDSO32_sigreturn' => 1, | ||
| 142 | ); | ||
| 143 | |||
| 144 | |||
| 87 | &find(\&linux_objects, '.'); # find the objects and do_nm on them | 145 | &find(\&linux_objects, '.'); # find the objects and do_nm on them |
| 88 | &list_multiply_defined(); | 146 | &list_multiply_defined(); |
| 89 | &resolve_external_references(); | 147 | &resolve_external_references(); |
| @@ -105,7 +163,8 @@ sub linux_objects | |||
| 105 | if (/.*\.o$/ && | 163 | if (/.*\.o$/ && |
| 106 | ! ( | 164 | ! ( |
| 107 | m:/built-in.o$: | 165 | m:/built-in.o$: |
| 108 | || m:arch/x86/kernel/vsyscall-syms.o$: | 166 | || m:arch/x86/vdso/: |
| 167 | || m:arch/x86/boot/: | ||
| 109 | || m:arch/ia64/ia32/ia32.o$: | 168 | || m:arch/ia64/ia32/ia32.o$: |
| 110 | || m:arch/ia64/kernel/gate-syms.o$: | 169 | || m:arch/ia64/kernel/gate-syms.o$: |
| 111 | || m:arch/ia64/lib/__divdi3.o$: | 170 | || m:arch/ia64/lib/__divdi3.o$: |
| @@ -148,6 +207,7 @@ sub linux_objects | |||
| 148 | || m:^.*/\.tmp_: | 207 | || m:^.*/\.tmp_: |
| 149 | || m:^\.tmp_: | 208 | || m:^\.tmp_: |
| 150 | || m:/vmlinux-obj.o$: | 209 | || m:/vmlinux-obj.o$: |
| 210 | || m:^tools/: | ||
| 151 | ) | 211 | ) |
| 152 | ) { | 212 | ) { |
| 153 | do_nm($basename, $_); | 213 | do_nm($basename, $_); |
| @@ -167,11 +227,11 @@ sub do_nm | |||
| 167 | printf STDERR "$fullname is not an object file\n"; | 227 | printf STDERR "$fullname is not an object file\n"; |
| 168 | return; | 228 | return; |
| 169 | } | 229 | } |
| 170 | ($source = $fullname) =~ s/\.o$//; | 230 | ($source = $basename) =~ s/\.o$//; |
| 171 | if (-e "$objtree$source.c" || -e "$objtree$source.S") { | 231 | if (-e "$source.c" || -e "$source.S") { |
| 172 | $source = "$objtree$source"; | 232 | $source = "$objtree$File::Find::dir/$source"; |
| 173 | } else { | 233 | } else { |
| 174 | $source = "$srctree$source"; | 234 | $source = "$srctree$File::Find::dir/$source"; |
| 175 | } | 235 | } |
| 176 | if (! -e "$source.c" && ! -e "$source.S") { | 236 | if (! -e "$source.c" && ! -e "$source.S") { |
| 177 | # No obvious source, exclude the object if it is conglomerate | 237 | # No obvious source, exclude the object if it is conglomerate |
| @@ -214,6 +274,7 @@ sub do_nm | |||
| 214 | # T global label/procedure | 274 | # T global label/procedure |
| 215 | # U external reference | 275 | # U external reference |
| 216 | # W weak external reference to text that has been resolved | 276 | # W weak external reference to text that has been resolved |
| 277 | # V similar to W, but the value of the weak symbol becomes zero with no error. | ||
| 217 | # a assembler equate | 278 | # a assembler equate |
| 218 | # b static variable, uninitialised | 279 | # b static variable, uninitialised |
| 219 | # d static variable, initialised | 280 | # d static variable, initialised |
| @@ -222,8 +283,9 @@ sub do_nm | |||
| 222 | # s static variable, uninitialised, small bss | 283 | # s static variable, uninitialised, small bss |
| 223 | # t static label/procedures | 284 | # t static label/procedures |
| 224 | # w weak external reference to text that has not been resolved | 285 | # w weak external reference to text that has not been resolved |
| 286 | # v similar to w | ||
| 225 | # ? undefined type, used a lot by modules | 287 | # ? undefined type, used a lot by modules |
| 226 | if ($type !~ /^[ABCDGRSTUWabdgrstw?]$/) { | 288 | if ($type !~ /^[ABCDGRSTUWVabdgrstwv?]$/) { |
| 227 | printf STDERR "nm output for $fullname contains unknown type '$_'\n"; | 289 | printf STDERR "nm output for $fullname contains unknown type '$_'\n"; |
| 228 | } | 290 | } |
| 229 | elsif ($name =~ /\./) { | 291 | elsif ($name =~ /\./) { |
| @@ -234,7 +296,7 @@ sub do_nm | |||
| 234 | # binutils keeps changing the type for exported symbols, force it to R | 296 | # binutils keeps changing the type for exported symbols, force it to R |
| 235 | $type = 'R' if ($name =~ /^__ksymtab/ || $name =~ /^__kstrtab/); | 297 | $type = 'R' if ($name =~ /^__ksymtab/ || $name =~ /^__kstrtab/); |
| 236 | $name =~ s/_R[a-f0-9]{8}$//; # module versions adds this | 298 | $name =~ s/_R[a-f0-9]{8}$//; # module versions adds this |
| 237 | if ($type =~ /[ABCDGRSTW]/ && | 299 | if ($type =~ /[ABCDGRSTWV]/ && |
| 238 | $name ne 'init_module' && | 300 | $name ne 'init_module' && |
| 239 | $name ne 'cleanup_module' && | 301 | $name ne 'cleanup_module' && |
| 240 | $name ne 'Using_Versions' && | 302 | $name ne 'Using_Versions' && |
| @@ -270,27 +332,9 @@ sub do_nm | |||
| 270 | close($nmdata); | 332 | close($nmdata); |
| 271 | 333 | ||
| 272 | if ($#nmdata < 0) { | 334 | if ($#nmdata < 0) { |
| 273 | if ( | 335 | printf "No nm data for $fullname\n" |
| 274 | $fullname ne "lib/brlock.o" | 336 | unless $nmexception{$fullname}; |
| 275 | && $fullname ne "lib/dec_and_lock.o" | 337 | return; |
| 276 | && $fullname ne "fs/xfs/xfs_macros.o" | ||
| 277 | && $fullname ne "drivers/ide/ide-probe-mini.o" | ||
| 278 | && $fullname ne "usr/initramfs_data.o" | ||
| 279 | && $fullname ne "drivers/acpi/executer/exdump.o" | ||
| 280 | && $fullname ne "drivers/acpi/resources/rsdump.o" | ||
| 281 | && $fullname ne "drivers/acpi/namespace/nsdumpdv.o" | ||
| 282 | && $fullname ne "drivers/acpi/namespace/nsdump.o" | ||
| 283 | && $fullname ne "arch/ia64/sn/kernel/sn2/io.o" | ||
| 284 | && $fullname ne "arch/ia64/kernel/gate-data.o" | ||
| 285 | && $fullname ne "drivers/ieee1394/oui.o" | ||
| 286 | && $fullname ne "security/capability.o" | ||
| 287 | && $fullname ne "sound/core/wrappers.o" | ||
| 288 | && $fullname ne "fs/ntfs/sysctl.o" | ||
| 289 | && $fullname ne "fs/jfs/jfs_debug.o" | ||
| 290 | ) { | ||
| 291 | printf "No nm data for $fullname\n"; | ||
| 292 | } | ||
| 293 | return; | ||
| 294 | } | 338 | } |
| 295 | $nmdata{$fullname} = \@nmdata; | 339 | $nmdata{$fullname} = \@nmdata; |
| 296 | } | 340 | } |
| @@ -319,18 +363,14 @@ sub list_multiply_defined | |||
| 319 | foreach my $name (keys(%def)) { | 363 | foreach my $name (keys(%def)) { |
| 320 | if ($#{$def{$name}} > 0) { | 364 | if ($#{$def{$name}} > 0) { |
| 321 | # Special case for cond_syscall | 365 | # Special case for cond_syscall |
| 322 | if ($#{$def{$name}} == 1 && $name =~ /^sys_/ && | 366 | if ($#{$def{$name}} == 1 && |
| 323 | ($def{$name}[0] eq "kernel/sys.o" || | 367 | ($name =~ /^sys_/ || $name =~ /^compat_sys_/ || |
| 324 | $def{$name}[1] eq "kernel/sys.o")) { | 368 | $name =~ /^sys32_/)) { |
| 325 | &drop_def("kernel/sys.o", $name); | 369 | if($def{$name}[0] eq "kernel/sys_ni.o" || |
| 326 | next; | 370 | $def{$name}[1] eq "kernel/sys_ni.o") { |
| 327 | } | 371 | &drop_def("kernel/sys_ni.o", $name); |
| 328 | # Special case for i386 entry code | 372 | next; |
| 329 | if ($#{$def{$name}} == 1 && $name =~ /^__kernel_/ && | 373 | } |
| 330 | $def{$name}[0] eq "arch/x86/kernel/vsyscall-int80_32.o" && | ||
| 331 | $def{$name}[1] eq "arch/x86/kernel/vsyscall-sysenter_32.o") { | ||
| 332 | &drop_def("arch/x86/kernel/vsyscall-sysenter_32.o", $name); | ||
| 333 | next; | ||
| 334 | } | 374 | } |
| 335 | 375 | ||
| 336 | printf "$name is multiply defined in :-\n"; | 376 | printf "$name is multiply defined in :-\n"; |
| @@ -372,31 +412,7 @@ sub resolve_external_references | |||
| 372 | $ref{$name} = "" | 412 | $ref{$name} = "" |
| 373 | } | 413 | } |
| 374 | } | 414 | } |
| 375 | elsif ( $name ne "mod_use_count_" | 415 | elsif ( ! $nameexception{$name} |
| 376 | && $name ne "__initramfs_end" | ||
| 377 | && $name ne "__initramfs_start" | ||
| 378 | && $name ne "_einittext" | ||
| 379 | && $name ne "_sinittext" | ||
| 380 | && $name ne "kallsyms_names" | ||
| 381 | && $name ne "kallsyms_num_syms" | ||
| 382 | && $name ne "kallsyms_addresses" | ||
| 383 | && $name ne "__this_module" | ||
| 384 | && $name ne "_etext" | ||
| 385 | && $name ne "_edata" | ||
| 386 | && $name ne "_end" | ||
| 387 | && $name ne "__bss_start" | ||
| 388 | && $name ne "_text" | ||
| 389 | && $name ne "_stext" | ||
| 390 | && $name ne "__gp" | ||
| 391 | && $name ne "ia64_unw_start" | ||
| 392 | && $name ne "ia64_unw_end" | ||
| 393 | && $name ne "__init_begin" | ||
| 394 | && $name ne "__init_end" | ||
| 395 | && $name ne "__bss_stop" | ||
| 396 | && $name ne "__nosave_begin" | ||
| 397 | && $name ne "__nosave_end" | ||
| 398 | && $name ne "pg0" | ||
| 399 | && $name ne "__module_text_address" | ||
| 400 | && $name !~ /^__sched_text_/ | 416 | && $name !~ /^__sched_text_/ |
| 401 | && $name !~ /^__start_/ | 417 | && $name !~ /^__start_/ |
| 402 | && $name !~ /^__end_/ | 418 | && $name !~ /^__end_/ |
| @@ -407,7 +423,6 @@ sub resolve_external_references | |||
| 407 | && $name !~ /^__.*per_cpu_end/ | 423 | && $name !~ /^__.*per_cpu_end/ |
| 408 | && $name !~ /^__alt_instructions/ | 424 | && $name !~ /^__alt_instructions/ |
| 409 | && $name !~ /^__setup_/ | 425 | && $name !~ /^__setup_/ |
| 410 | && $name !~ /^jiffies/ | ||
| 411 | && $name !~ /^__mod_timer/ | 426 | && $name !~ /^__mod_timer/ |
| 412 | && $name !~ /^__mod_page_state/ | 427 | && $name !~ /^__mod_page_state/ |
| 413 | && $name !~ /^init_module/ | 428 | && $name !~ /^init_module/ |
