scripts: modernize abi-check a bit
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
920c82fb9b
commit
c0b70725e7
52
debian/scripts/abi-check
vendored
52
debian/scripts/abi-check
vendored
@ -1,4 +1,7 @@
|
||||
#!/usr/bin/perl -w
|
||||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $abinew = shift;
|
||||
my $abiold = shift;
|
||||
@ -57,11 +60,11 @@ my %module_syms;
|
||||
my $ignore = 0;
|
||||
print " Reading symbols/modules to ignore...";
|
||||
|
||||
for $file ("abi-blacklist") {
|
||||
if (-f $file) {
|
||||
open(IGNORE, "< $file") or
|
||||
die "Could not open $file";
|
||||
while (<IGNORE>) {
|
||||
for my $file ("abi-blacklist") {
|
||||
next if !-f $file;
|
||||
open(my $IGNORE_FH, '<', $file) or die "Could not open $file - $!";
|
||||
|
||||
while (<$IGNORE_FH>) {
|
||||
chomp;
|
||||
if ($_ =~ m/M: (.*)/) {
|
||||
$modules_ignore{$1} = 1;
|
||||
@ -70,8 +73,7 @@ for $file ("abi-blacklist") {
|
||||
}
|
||||
$ignore++;
|
||||
}
|
||||
close(IGNORE);
|
||||
}
|
||||
close($IGNORE_FH);
|
||||
}
|
||||
print "read $ignore symbols/modules.\n";
|
||||
|
||||
@ -90,9 +92,8 @@ sub is_ignored($$) {
|
||||
# Read new syms first
|
||||
print " Reading new symbols ($abistr)...";
|
||||
$count = 0;
|
||||
open(NEW, "< $abinew") or
|
||||
die "Could not open $abinew";
|
||||
while (<NEW>) {
|
||||
open(my $NEW_FH, '<', $abinew) or die "Could not open $abinew - $!";
|
||||
while (<$NEW_FH>) {
|
||||
chomp;
|
||||
m/^(\S+)\s(.+)\s(0x[0-9a-f]+)\s(.+)$/;
|
||||
$symbols{$4}{'type'} = $1;
|
||||
@ -101,15 +102,14 @@ while (<NEW>) {
|
||||
$module_syms{$2} = 0;
|
||||
$count++;
|
||||
}
|
||||
close(NEW);
|
||||
close($NEW_FH);
|
||||
print "read $count symbols.\n";
|
||||
|
||||
# Now the old symbols, checking for missing ones
|
||||
print " Reading old symbols...";
|
||||
$count = 0;
|
||||
open(OLD, "< $abiold") or
|
||||
die "Could not open $abiold";
|
||||
while (<OLD>) {
|
||||
open(my $OLD_FH, '<', $abiold) or die "Could not open $abiold - $!";
|
||||
while (<$OLD_FH>) {
|
||||
chomp;
|
||||
m/^(\S+)\s(.+)\s(0x[0-9a-f]+)\s(.+)$/;
|
||||
$symbols{$4}{'old_type'} = $1;
|
||||
@ -117,17 +117,16 @@ while (<OLD>) {
|
||||
$symbols{$4}{'old_hash'} = $3;
|
||||
$count++;
|
||||
}
|
||||
close(OLD);
|
||||
close($OLD_FH);
|
||||
|
||||
print "read $count symbols.\n";
|
||||
|
||||
print "II: Checking for missing symbols in new ABI...";
|
||||
$count = 0;
|
||||
foreach $sym (keys(%symbols)) {
|
||||
for my $sym (keys(%symbols)) {
|
||||
if (!defined($symbols{$sym}{'type'})) {
|
||||
print "\n" if not $count;
|
||||
printf(" MISS : %s%s\n", $sym,
|
||||
is_ignored($symbols{$sym}{'old_loc'}, $sym) ? " (ignored)" : "");
|
||||
printf(" MISS : %s%s\n", $sym, is_ignored($symbols{$sym}{'old_loc'}, $sym) ? " (ignored)" : "");
|
||||
$count++ if !is_ignored($symbols{$sym}{'old_loc'}, $sym);
|
||||
}
|
||||
}
|
||||
@ -141,7 +140,7 @@ if ($count) {
|
||||
|
||||
print "II: Checking for new symbols in new ABI...";
|
||||
$count = 0;
|
||||
foreach $sym (keys(%symbols)) {
|
||||
for my $sym (keys(%symbols)) {
|
||||
if (!defined($symbols{$sym}{'old_type'})) {
|
||||
print "\n" if not $count;
|
||||
print " NEW : $sym\n";
|
||||
@ -159,16 +158,14 @@ $count = 0;
|
||||
my $moved = 0;
|
||||
my $changed_type = 0;
|
||||
my $changed_hash = 0;
|
||||
foreach $sym (keys(%symbols)) {
|
||||
if (!defined($symbols{$sym}{'old_type'}) or
|
||||
!defined($symbols{$sym}{'type'})) {
|
||||
for my $sym (keys(%symbols)) {
|
||||
if (!defined($symbols{$sym}{'old_type'}) or !defined($symbols{$sym}{'type'})) {
|
||||
next;
|
||||
}
|
||||
|
||||
# Changes in location don't hurt us, but log it anyway
|
||||
if ($symbols{$sym}{'loc'} ne $symbols{$sym}{'old_loc'}) {
|
||||
printf(" MOVE : %-40s : %s => %s\n", $sym, $symbols{$sym}{'old_loc'},
|
||||
$symbols{$sym}{'loc'});
|
||||
printf(" MOVE : %-40s : %s => %s\n", $sym, $symbols{$sym}{'old_loc'}, $symbols{$sym}{'loc'});
|
||||
$moved++;
|
||||
}
|
||||
|
||||
@ -178,8 +175,7 @@ foreach $sym (keys(%symbols)) {
|
||||
printf(" TYPE : %-40s : %s => %s%s\n", $sym, $symbols{$sym}{'old_type'}.
|
||||
$symbols{$sym}{'type'}, is_ignored($symbols{$sym}{'loc'}, $sym)
|
||||
? " (ignored)" : "");
|
||||
$changed_type++ if $symbols{$sym}{'type'} ne "EXPORT_SYMBOL"
|
||||
and !is_ignored($symbols{$sym}{'loc'}, $sym);
|
||||
$changed_type++ if $symbols{$sym}{'type'} ne "EXPORT_SYMBOL" and !is_ignored($symbols{$sym}{'loc'}, $sym);
|
||||
}
|
||||
|
||||
# Changes to the hash are always bad
|
||||
@ -199,7 +195,7 @@ print "$EE $changed_hash symbols changed hash and weren't ignored\n" if $changed
|
||||
$errors++ if $changed_hash or $changed_type;
|
||||
if ($changed_hash) {
|
||||
print "II: Module hash change summary...\n";
|
||||
foreach $mod (sort { $module_syms{$b} <=> $module_syms{$a} } keys %module_syms) {
|
||||
for my $mod (sort { $module_syms{$b} <=> $module_syms{$a} } keys %module_syms) {
|
||||
next if ! $module_syms{$mod};
|
||||
printf(" %-40s: %d\n", $mod, $module_syms{$mod});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user