david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

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:
Michael Brown 2005-04-27 10:54:33 +00:00
parent ac01cf4997
commit d6930e6e40
1 changed files with 9 additions and 7 deletions

View File

@ -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;