\r\n -> \n
[gnokii.git] / bigfunc
1 #! /usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 open NM,"-|",'m68k-pic-coff-nm gnokii/gnokii.coff|sort'
7                 or die "nm: $!";
8 my(%big,$prevhex,$prevsym,$tot);
9 while (<NM>) {
10         chomp;
11         /^([0-9a-f]+) (\w) (.*)$/ or die "parse: $_";
12         my $hex=hex $1;
13         my $type=$2;
14         my $sym=$3;
15         next if $type!~/[tT]/ || $sym=~/^\./ || $sym=~/^L\d+$/ || $sym eq "__gnu_compiled_c" || $sym eq "gcc2_compiled.";
16         if ($prevhex) {
17                 warn "dup: $prevsym" if exists $big{$prevsym};
18                 $big{$prevsym}=$hex-$prevhex;
19                 $tot+=$hex-$prevhex;
20                 }
21         $prevhex=$hex;
22         $prevsym=$sym;
23         }
24 close NM;
25 $big{"_TOTAL"}=$tot;
26 for (sort { $big{$b} <=> $big{$a} } keys %big) {
27         printf "%4u %s\n",$big{$_},$_;
28         }