mirror of
https://git.proxmox.com/git/pve-kernel
synced 2025-04-29 22:07:22 +00:00
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 $abinew = shift;
|
||||||
my $abiold = shift;
|
my $abiold = shift;
|
||||||
@ -57,11 +60,11 @@ my %module_syms;
|
|||||||
my $ignore = 0;
|
my $ignore = 0;
|
||||||
print " Reading symbols/modules to ignore...";
|
print " Reading symbols/modules to ignore...";
|
||||||
|
|
||||||
for $file ("abi-blacklist") {
|
for my $file ("abi-blacklist") {
|
||||||
if (-f $file) {
|
next if !-f $file;
|
||||||
open(IGNORE, "< $file") or
|
open(my $IGNORE_FH, '<', $file) or die "Could not open $file - $!";
|
||||||
die "Could not open $file";
|
|
||||||
while (<IGNORE>) {
|
while (<$IGNORE_FH>) {
|
||||||
chomp;
|
chomp;
|
||||||
if ($_ =~ m/M: (.*)/) {
|
if ($_ =~ m/M: (.*)/) {
|
||||||
$modules_ignore{$1} = 1;
|
$modules_ignore{$1} = 1;
|
||||||
@ -70,8 +73,7 @@ for $file ("abi-blacklist") {
|
|||||||
}
|
}
|
||||||
$ignore++;
|
$ignore++;
|
||||||
}
|
}
|
||||||
close(IGNORE);
|
close($IGNORE_FH);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
print "read $ignore symbols/modules.\n";
|
print "read $ignore symbols/modules.\n";
|
||||||
|
|
||||||
@ -90,9 +92,8 @@ sub is_ignored($$) {
|
|||||||
# Read new syms first
|
# Read new syms first
|
||||||
print " Reading new symbols ($abistr)...";
|
print " Reading new symbols ($abistr)...";
|
||||||
$count = 0;
|
$count = 0;
|
||||||
open(NEW, "< $abinew") or
|
open(my $NEW_FH, '<', $abinew) or die "Could not open $abinew - $!";
|
||||||
die "Could not open $abinew";
|
while (<$NEW_FH>) {
|
||||||
while (<NEW>) {
|
|
||||||
chomp;
|
chomp;
|
||||||
m/^(\S+)\s(.+)\s(0x[0-9a-f]+)\s(.+)$/;
|
m/^(\S+)\s(.+)\s(0x[0-9a-f]+)\s(.+)$/;
|
||||||
$symbols{$4}{'type'} = $1;
|
$symbols{$4}{'type'} = $1;
|
||||||
@ -101,15 +102,14 @@ while (<NEW>) {
|
|||||||
$module_syms{$2} = 0;
|
$module_syms{$2} = 0;
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
close(NEW);
|
close($NEW_FH);
|
||||||
print "read $count symbols.\n";
|
print "read $count symbols.\n";
|
||||||
|
|
||||||
# Now the old symbols, checking for missing ones
|
# Now the old symbols, checking for missing ones
|
||||||
print " Reading old symbols...";
|
print " Reading old symbols...";
|
||||||
$count = 0;
|
$count = 0;
|
||||||
open(OLD, "< $abiold") or
|
open(my $OLD_FH, '<', $abiold) or die "Could not open $abiold - $!";
|
||||||
die "Could not open $abiold";
|
while (<$OLD_FH>) {
|
||||||
while (<OLD>) {
|
|
||||||
chomp;
|
chomp;
|
||||||
m/^(\S+)\s(.+)\s(0x[0-9a-f]+)\s(.+)$/;
|
m/^(\S+)\s(.+)\s(0x[0-9a-f]+)\s(.+)$/;
|
||||||
$symbols{$4}{'old_type'} = $1;
|
$symbols{$4}{'old_type'} = $1;
|
||||||
@ -117,17 +117,16 @@ while (<OLD>) {
|
|||||||
$symbols{$4}{'old_hash'} = $3;
|
$symbols{$4}{'old_hash'} = $3;
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
close(OLD);
|
close($OLD_FH);
|
||||||
|
|
||||||
print "read $count symbols.\n";
|
print "read $count symbols.\n";
|
||||||
|
|
||||||
print "II: Checking for missing symbols in new ABI...";
|
print "II: Checking for missing symbols in new ABI...";
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach $sym (keys(%symbols)) {
|
for my $sym (keys(%symbols)) {
|
||||||
if (!defined($symbols{$sym}{'type'})) {
|
if (!defined($symbols{$sym}{'type'})) {
|
||||||
print "\n" if not $count;
|
print "\n" if not $count;
|
||||||
printf(" MISS : %s%s\n", $sym,
|
printf(" MISS : %s%s\n", $sym, is_ignored($symbols{$sym}{'old_loc'}, $sym) ? " (ignored)" : "");
|
||||||
is_ignored($symbols{$sym}{'old_loc'}, $sym) ? " (ignored)" : "");
|
|
||||||
$count++ if !is_ignored($symbols{$sym}{'old_loc'}, $sym);
|
$count++ if !is_ignored($symbols{$sym}{'old_loc'}, $sym);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,7 +140,7 @@ if ($count) {
|
|||||||
|
|
||||||
print "II: Checking for new symbols in new ABI...";
|
print "II: Checking for new symbols in new ABI...";
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach $sym (keys(%symbols)) {
|
for my $sym (keys(%symbols)) {
|
||||||
if (!defined($symbols{$sym}{'old_type'})) {
|
if (!defined($symbols{$sym}{'old_type'})) {
|
||||||
print "\n" if not $count;
|
print "\n" if not $count;
|
||||||
print " NEW : $sym\n";
|
print " NEW : $sym\n";
|
||||||
@ -159,16 +158,14 @@ $count = 0;
|
|||||||
my $moved = 0;
|
my $moved = 0;
|
||||||
my $changed_type = 0;
|
my $changed_type = 0;
|
||||||
my $changed_hash = 0;
|
my $changed_hash = 0;
|
||||||
foreach $sym (keys(%symbols)) {
|
for my $sym (keys(%symbols)) {
|
||||||
if (!defined($symbols{$sym}{'old_type'}) or
|
if (!defined($symbols{$sym}{'old_type'}) or !defined($symbols{$sym}{'type'})) {
|
||||||
!defined($symbols{$sym}{'type'})) {
|
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Changes in location don't hurt us, but log it anyway
|
# Changes in location don't hurt us, but log it anyway
|
||||||
if ($symbols{$sym}{'loc'} ne $symbols{$sym}{'old_loc'}) {
|
if ($symbols{$sym}{'loc'} ne $symbols{$sym}{'old_loc'}) {
|
||||||
printf(" MOVE : %-40s : %s => %s\n", $sym, $symbols{$sym}{'old_loc'},
|
printf(" MOVE : %-40s : %s => %s\n", $sym, $symbols{$sym}{'old_loc'}, $symbols{$sym}{'loc'});
|
||||||
$symbols{$sym}{'loc'});
|
|
||||||
$moved++;
|
$moved++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,8 +175,7 @@ foreach $sym (keys(%symbols)) {
|
|||||||
printf(" TYPE : %-40s : %s => %s%s\n", $sym, $symbols{$sym}{'old_type'}.
|
printf(" TYPE : %-40s : %s => %s%s\n", $sym, $symbols{$sym}{'old_type'}.
|
||||||
$symbols{$sym}{'type'}, is_ignored($symbols{$sym}{'loc'}, $sym)
|
$symbols{$sym}{'type'}, is_ignored($symbols{$sym}{'loc'}, $sym)
|
||||||
? " (ignored)" : "");
|
? " (ignored)" : "");
|
||||||
$changed_type++ if $symbols{$sym}{'type'} ne "EXPORT_SYMBOL"
|
$changed_type++ if $symbols{$sym}{'type'} ne "EXPORT_SYMBOL" and !is_ignored($symbols{$sym}{'loc'}, $sym);
|
||||||
and !is_ignored($symbols{$sym}{'loc'}, $sym);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Changes to the hash are always bad
|
# 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;
|
$errors++ if $changed_hash or $changed_type;
|
||||||
if ($changed_hash) {
|
if ($changed_hash) {
|
||||||
print "II: Module hash change summary...\n";
|
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};
|
next if ! $module_syms{$mod};
|
||||||
printf(" %-40s: %d\n", $mod, $module_syms{$mod});
|
printf(" %-40s: %d\n", $mod, $module_syms{$mod});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user