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 - # "
." - ( my $value, my $section ) = ( $1, $2 ); + # "
::" + ( 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;