Browse Source

Use symbol size as a third index, mainly so that zero-length symbols

(e.g. section start indicators) show up before the symbols they're
indicating the start of.
tags/v0.9.3
Michael Brown 19 years ago
parent
commit
d6930e6e40
1 changed files with 9 additions and 7 deletions
  1. 9
    7
      src/util/sortobjdump.pl

+ 9
- 7
src/util/sortobjdump.pl View File

4
 use warnings;
4
 use warnings;
5
 
5
 
6
 # Sort the symbol table portion of the output of objdump -ht by
6
 # Sort the symbol table portion of the output of objdump -ht by
7
-# section, then by symbol value.  Used to enhance the linker maps
8
-# produced by "make bin/%.map" by also showing the values of all
9
-# non-global symbols.
7
+# section, then by symbol value, then by size.  Used to enhance the
8
+# linker maps produced by "make bin/%.map" by also showing the values
9
+# of all non-global symbols.
10
 
10
 
11
 my %section_idx = ( "*ABS*" => "." );
11
 my %section_idx = ( "*ABS*" => "." );
12
 my %lines;
12
 my %lines;
17
     print;
17
     print;
18
     ( my $index, my $section ) = ( $1, $2 );
18
     ( my $index, my $section ) = ( $1, $2 );
19
     $section_idx{$section} = sprintf ( "%02d", $index );
19
     $section_idx{$section} = sprintf ( "%02d", $index );
20
-  } elsif ( /^([0-9a-fA-F]+)\s.*?\s([\.\*]\S+)\s/ ) {
20
+  } elsif ( /^([0-9a-fA-F]+)\s.*?\s([\.\*]\S+)\s+([0-9a-fA-F]+)\s/ ) {
21
     # It's a symbol line - store it in the hash, indexed by
21
     # It's a symbol line - store it in the hash, indexed by
22
-    # "<section index>.<value>"
23
-    ( my $value, my $section ) = ( $1, $2 );
22
+    # "<section index>:<value>:<size>"
23
+    ( my $value, my $section, my $size ) = ( $1, $2, $3 );
24
     die "Unrecognised section \"$section\"\n"
24
     die "Unrecognised section \"$section\"\n"
25
 	unless exists $section_idx{$section};
25
 	unless exists $section_idx{$section};
26
     my $section_idx = $section_idx{$section};
26
     my $section_idx = $section_idx{$section};
27
-    $lines{${section_idx}.":".${value}} = $_;
27
+    my $key = $section_idx.":".$value.":".$size;
28
+    $lines{$key} ||= '';
29
+    $lines{$key} .= $_;
28
   } else {
30
   } else {
29
     # It's a generic header line: just print it.
31
     # It's a generic header line: just print it.
30
     print;
32
     print;

Loading…
Cancel
Save