Selaa lähdekoodia

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 vuotta sitten
vanhempi
commit
d6930e6e40
1 muutettua tiedostoa jossa 9 lisäystä ja 7 poistoa
  1. 9
    7
      src/util/sortobjdump.pl

+ 9
- 7
src/util/sortobjdump.pl Näytä tiedosto

@@ -4,9 +4,9 @@ use strict;
4 4
 use warnings;
5 5
 
6 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 11
 my %section_idx = ( "*ABS*" => "." );
12 12
 my %lines;
@@ -17,14 +17,16 @@ while ( <> ) {
17 17
     print;
18 18
     ( my $index, my $section ) = ( $1, $2 );
19 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 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 24
     die "Unrecognised section \"$section\"\n"
25 25
 	unless exists $section_idx{$section};
26 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 30
   } else {
29 31
     # It's a generic header line: just print it.
30 32
     print;

Loading…
Peruuta
Tallenna