summaryrefslogtreecommitdiffstats
path: root/src/util/sortobjdump.pl
diff options
context:
space:
mode:
authorMichael Brown2005-04-27 12:54:33 +0200
committerMichael Brown2005-04-27 12:54:33 +0200
commitd6930e6e405f5a4a0a96e374e10e86b4bcd863d8 (patch)
tree9e473eef427bc7d401a8d355943ebecf5765b2b0 /src/util/sortobjdump.pl
parentFirst version (diff)
downloadipxe-d6930e6e405f5a4a0a96e374e10e86b4bcd863d8.tar.gz
ipxe-d6930e6e405f5a4a0a96e374e10e86b4bcd863d8.tar.xz
ipxe-d6930e6e405f5a4a0a96e374e10e86b4bcd863d8.zip
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.
Diffstat (limited to 'src/util/sortobjdump.pl')
-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 99d793b6..7257161c 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;