diff options
author | Frediano Ziglio <fziglio@redhat.com> | 2016-09-16 20:55:14 +0100 |
---|---|---|
committer | Frediano Ziglio <fziglio@redhat.com> | 2016-09-16 20:55:14 +0100 |
commit | 83e7b7d588477a1cdcb3cdab1092d67fe1ff83b2 (patch) | |
tree | a89c69a79982dfedc595f42d5e4e855e6318c6f7 | |
parent | 0741f664897cfdb2bc29a6788233a292969a8b3b (diff) |
Add script to check for globals
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
-rwxr-xr-x | spice-server/reentrant_size | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spice-server/reentrant_size b/spice-server/reentrant_size new file mode 100755 index 0000000..d2fc0aa --- /dev/null +++ b/spice-server/reentrant_size @@ -0,0 +1,30 @@ +#!/usr/bin/perl + +use strict; + +open(my $sizes, "-|", 'size', @ARGV) or die; +while (<$sizes>) { + my @a = split("\t"); + next if $a[3] <= 0 || ($a[1] == 0 && $a[2] == 0); + my $fn = $a[5]; + chomp($fn); + open(my $symbols, '-|', 'objdump', '-t', $fn) or die; + my $output = ''; + while (<$symbols>) { + next if !/^([0-9a-f]{8,}) (.......) (\S+)\t([0-9a-f]{8,}) (.*)/i; + my ($offset, $flags, $sec, $size, $name) = ($1, $2, $3, $4, $5); + next if $sec =~ /^\*UND\*$|^\*ABS\*$|^\.text|^\.rodata$|^\.comment$|^\.data\.rel\.ro(\.local)?$|^\.rodata\.str|^\.rodata\.cst/; + next if substr($flags, 5, 1) eq 'd' && $sec eq $name; + + # gobject + if ($sec eq '.bss') { + $size =~ s/^0+//; + next if $size eq '8' && $name =~ /^g_define_type_id__volatile\.\d+$/; + next if $size eq '4' && $name =~ /_private_offset$/; + next if $size eq '8' && $name =~ /_parent_class$/; + } + + $output .= $_; + } + print "$fn\n$output\n" if $output; +} |