summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rwxr-xr-xsrc/util/sortobjdump.pl16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/util/sortobjdump.pl b/src/util/sortobjdump.pl
index 99d793b68..7257161c1 100755
--- a/src/util/sortobjdump.pl
+++ b/src/util/sortobjdump.pl
@@ -4,9 +4,9 @@ use strict;
use warnings;
# Sort the symbol table portion of the output of objdump -ht by
-# section, then by symbol value. Used to enhance the linker maps
-# produced by "make bin/%.map" by also showing the values of all
-# non-global symbols.
+# section, then by symbol value, then by size. Used to enhance the
+# linker maps produced by "make bin/%.map" by also showing the values
+# of all non-global symbols.
my %section_idx = ( "*ABS*" => "." );
my %lines;
@@ -17,14 +17,16 @@ while ( <> ) {
print;
( my $index, my $section ) = ( $1, $2 );
$section_idx{$section} = sprintf ( "%02d", $index );
- } elsif ( /^([0-9a-fA-F]+)\s.*?\s([\.\*]\S+)\s/ ) {
+ } elsif ( /^([0-9a-fA-F]+)\s.*?\s([\.\*]\S+)\s+([0-9a-fA-F]+)\s/ ) {
# It's a symbol line - store it in the hash, indexed by
- # "<section index>.<value>"
- ( my $value, my $section ) = ( $1, $2 );
+ # "<section index>:<value>:<size>"
+ ( my $value, my $section, my $size ) = ( $1, $2, $3 );
die "Unrecognised section \"$section\"\n"
unless exists $section_idx{$section};
my $section_idx = $section_idx{$section};
- $lines{${section_idx}.":".${value}} = $_;
+ my $key = $section_idx.":".$value.":".$size;
+ $lines{$key} ||= '';
+ $lines{$key} .= $_;
} else {
# It's a generic header line: just print it.
print;