diff options
author | 2015-08-28 09:58:54 +0800 | |
---|---|---|
committer | 2015-09-01 12:44:00 +0800 | |
commit | e44e3482bdb4d0ebde2d8b41830ac2cdb07948fb (patch) | |
tree | 66b09f592c55df2878107a468a91d21506104d3f /qemu/roms/ipxe/src/util/sortobjdump.pl | |
parent | 9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (diff) |
Add qemu 2.4.0
Change-Id: Ic99cbad4b61f8b127b7dc74d04576c0bcbaaf4f5
Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Diffstat (limited to 'qemu/roms/ipxe/src/util/sortobjdump.pl')
-rwxr-xr-x | qemu/roms/ipxe/src/util/sortobjdump.pl | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/qemu/roms/ipxe/src/util/sortobjdump.pl b/qemu/roms/ipxe/src/util/sortobjdump.pl new file mode 100755 index 000000000..1373a7ffd --- /dev/null +++ b/qemu/roms/ipxe/src/util/sortobjdump.pl @@ -0,0 +1,40 @@ +#!/usr/bin/perl -w + +use strict; +use warnings; + +# Sort the symbol table portion of the output of objdump -ht by +# 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*" => ".", "*UND*" => "_" ); +my %lines; +while ( <> ) { + if ( /^\s+(\d+)\s+([\.\*]\S+)\s+[0-9a-fA-F]+\s+[0-9a-fA-F]/ ) { + # It's a header line containing a section definition; extract the + # section index and store it. Also print the header line. + print; + ( my $index, my $section ) = ( $1, $2 ); + $section_idx{$section} = sprintf ( "%02d", $index ); + } elsif ( /^([0-9a-fA-F]+)\s.*?\s([\.\*]\S+)\s+([0-9a-fA-F]+)\s+(\S+)/ ) { + # It's a symbol line - store it in the hash, indexed by + # "<section_index>:<value>:<size>:<end_tag>". <end_tag> is "0" if + # the symbol name is of the form xxx_end, "1" otherwise; this is + # done so that table end markers show up before any other symbols + # with the same value. + ( my $value, my $section, my $size, my $name ) = ( $1, $2, $3, $4 ); + die "Unrecognised section \"$section\"\n" + unless exists $section_idx{$section}; + my $section_idx = $section_idx{$section}; + my $end = ( $name =~ /_end$/ ) ? "0" : "1"; + my $key = $section_idx.":".$value.":".$size.":".$end; + $lines{$key} ||= ''; + $lines{$key} .= $_; + } else { + # It's a generic header line: just print it. + print; + } +} + +print $lines{$_} foreach sort keys %lines; |