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.
This commit is contained in:
parent
ac01cf4997
commit
d6930e6e40
|
@ -4,9 +4,9 @@ use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
# Sort the symbol table portion of the output of objdump -ht by
|
# Sort the symbol table portion of the output of objdump -ht by
|
||||||
# section, then by symbol value. Used to enhance the linker maps
|
# section, then by symbol value, then by size. Used to enhance the
|
||||||
# produced by "make bin/%.map" by also showing the values of all
|
# linker maps produced by "make bin/%.map" by also showing the values
|
||||||
# non-global symbols.
|
# of all non-global symbols.
|
||||||
|
|
||||||
my %section_idx = ( "*ABS*" => "." );
|
my %section_idx = ( "*ABS*" => "." );
|
||||||
my %lines;
|
my %lines;
|
||||||
|
@ -17,14 +17,16 @@ while ( <> ) {
|
||||||
print;
|
print;
|
||||||
( my $index, my $section ) = ( $1, $2 );
|
( my $index, my $section ) = ( $1, $2 );
|
||||||
$section_idx{$section} = sprintf ( "%02d", $index );
|
$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
|
# It's a symbol line - store it in the hash, indexed by
|
||||||
# "<section index>.<value>"
|
# "<section index>:<value>:<size>"
|
||||||
( my $value, my $section ) = ( $1, $2 );
|
( my $value, my $section, my $size ) = ( $1, $2, $3 );
|
||||||
die "Unrecognised section \"$section\"\n"
|
die "Unrecognised section \"$section\"\n"
|
||||||
unless exists $section_idx{$section};
|
unless exists $section_idx{$section};
|
||||||
my $section_idx = $section_idx{$section};
|
my $section_idx = $section_idx{$section};
|
||||||
$lines{${section_idx}.":".${value}} = $_;
|
my $key = $section_idx.":".$value.":".$size;
|
||||||
|
$lines{$key} ||= '';
|
||||||
|
$lines{$key} .= $_;
|
||||||
} else {
|
} else {
|
||||||
# It's a generic header line: just print it.
|
# It's a generic header line: just print it.
|
||||||
print;
|
print;
|
||||||
|
|
Reference in New Issue