File: checker.pl

package info (click to toggle)
mol 0.9.61-6
  • links: PTS
  • area: contrib
  • in suites: woody
  • size: 6,140 kB
  • ctags: 8,491
  • sloc: ansic: 50,560; asm: 2,826; sh: 458; makefile: 373; perl: 165; lex: 135; yacc: 131
file content (28 lines) | stat: -rwxr-xr-x 714 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl -w
#
# Unfortunately, the namespace barrier between the
# assembly files and the c-soruces get breached
# if a record is added to the symbol table 
# (.long <symname> causes this for instance).
# It is not to be possible to solve the problem
# with strip - I think modutils should be altered.
# This script makes sure we don't use local symbols
# as globaly.

$bad = 0;

@msyms = `nm $ARGV[0]` =~ / U (.*)/g or $bad++;
@lsyms = `nm $ARGV[0]` =~ / [td] (.*)/g or $bad++;

for( $i=0; $i <= $#msyms ; $i++ ) {
    for( $j=0; $j <= $#lsyms ; $j++ ) {
	if( $msyms[$i] eq $lsyms[$j] ) {
	    print "Error: *** Local symbol '".$lsyms[$j]."' appears globally! ***\n";
	    $bad++;
	}
    }
}

exit $bad;