]>
git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - debian/scripts/abi-check
4 my $prev_abinum = shift;
6 my $prev_abidir = shift;
17 print "II: Checking ABI for $flavour...\n";
19 if (-f
"$prev_abidir/ignore"
20 or -f
"$prev_abidir/$flavour.ignore" or "$skipabi" eq "true") {
21 print "WW: Explicitly asked to ignore ABI, running in no-fail mode\n";
27 if ($prev_abinum != $abinum) {
28 print "II: Different ABI's, running in no-fail mode\n";
33 if (not -f
"$abidir/$flavour" or not -f
"$prev_abidir/$flavour") {
34 print "EE: Previous or current ABI file missing!\n";
35 print " $abidir/$flavour\n" if not -f
"$abidir/$flavour";
36 print " $prev_abidir/$flavour\n" if not -f
"$prev_abidir/$flavour";
38 # Exit if the ABI files are missing, but return status based on whether
39 # skip ABI was indicated.
40 if ("$abiskip" eq "1") {
52 # See if we have any ignores
54 print " Reading symbols/modules to ignore...";
56 for $file ("$prev_abidir/../blacklist", "$prev_abidir/../../perm-blacklist") {
58 open(IGNORE
, "< $file") or
59 die "Could not open $file";
62 if ($_ =~ m/M: (.*)/) {
63 $modules_ignore{$1} = 1;
65 $symbols_ignore{$_} = 1;
72 print "read $ignore symbols/modules.\n";
77 die "Missing module name in is_ignored()" if not defined($mod);
78 die "Missing symbol name in is_ignored()" if not defined($sym);
80 if (defined($symbols_ignore{$sym}) or defined($modules_ignore{$mod})) {
87 print " Reading new symbols ($abinum)...";
89 open(NEW
, "< $abidir/$flavour") or
90 die "Could not open $abidir/$flavour";
93 m/^(\S+)\s(.+)\s(0x[0-9a-f]+)\s(.+)$/;
94 $symbols{$4}{'type'} = $1;
95 $symbols{$4}{'loc'} = $2;
96 $symbols{$4}{'hash'} = $3;
101 print "read $count symbols.\n";
103 # Now the old symbols, checking for missing ones
104 print " Reading old symbols ($prev_abinum)...";
106 open(OLD
, "< $prev_abidir/$flavour") or
107 die "Could not open $prev_abidir/$flavour";
110 m/^(\S+)\s(.+)\s(0x[0-9a-f]+)\s(.+)$/;
111 $symbols{$4}{'old_type'} = $1;
112 $symbols{$4}{'old_loc'} = $2;
113 $symbols{$4}{'old_hash'} = $3;
118 print "read $count symbols.\n";
120 print "II: Checking for missing symbols in new ABI...";
122 foreach $sym (keys(%symbols)) {
123 if (!defined($symbols{$sym}{'type'})) {
124 print "\n" if not $count;
125 printf(" MISS : %s%s\n", $sym,
126 is_ignored
($symbols{$sym}{'old_loc'}, $sym) ?
" (ignored)" : "");
127 $count++ if !is_ignored
($symbols{$sym}{'old_loc'}, $sym);
131 print "found $count missing symbols\n";
133 print "$EE Symbols gone missing (what did you do!?!)\n";
138 print "II: Checking for new symbols in new ABI...";
140 foreach $sym (keys(%symbols)) {
141 if (!defined($symbols{$sym}{'old_type'})) {
142 print "\n" if not $count;
143 print " NEW : $sym\n";
148 print "found $count new symbols\n";
149 if ($count and $prev_abinum == $abinum) {
150 print "WW: Found new symbols within same ABI. Not recommended\n";
153 print "II: Checking for changes to ABI...\n";
156 my $changed_type = 0;
157 my $changed_hash = 0;
158 foreach $sym (keys(%symbols)) {
159 if (!defined($symbols{$sym}{'old_type'}) or
160 !defined($symbols{$sym}{'type'})) {
164 # Changes in location don't hurt us, but log it anyway
165 if ($symbols{$sym}{'loc'} ne $symbols{$sym}{'old_loc'}) {
166 printf(" MOVE : %-40s : %s => %s\n", $sym, $symbols{$sym}{'old_loc'},
167 $symbols{$sym}{'loc'});
171 # Changes to export type are only bad if new type isn't
172 # EXPORT_SYMBOL. Changing things to GPL are bad.
173 if ($symbols{$sym}{'type'} ne $symbols{$sym}{'old_type'}) {
174 printf(" TYPE : %-40s : %s => %s%s\n", $sym, $symbols{$sym}{'old_type'}.
175 $symbols{$sym}{'type'}, is_ignored
($symbols{$sym}{'loc'}, $sym)
176 ?
" (ignored)" : "");
177 $changed_type++ if $symbols{$sym}{'type'} ne "EXPORT_SYMBOL"
178 and !is_ignored
($symbols{$sym}{'loc'}, $sym);
181 # Changes to the hash are always bad
182 if ($symbols{$sym}{'hash'} ne $symbols{$sym}{'old_hash'}) {
183 printf(" HASH : %-40s : %s => %s%s\n", $sym, $symbols{$sym}{'old_hash'},
184 $symbols{$sym}{'hash'}, is_ignored
($symbols{$sym}{'loc'}, $sym)
185 ?
" (ignored)" : "");
186 $changed_hash++ if !is_ignored
($symbols{$sym}{'loc'}, $sym);
187 $module_syms{$symbols{$sym}{'loc'}}++;
191 print "WW: $moved symbols changed location\n" if $moved;
192 print "$EE $changed_type symbols changed export type and weren't ignored\n" if $changed_type;
193 print "$EE $changed_hash symbols changed hash and weren't ignored\n" if $changed_hash;
195 $errors++ if $changed_hash or $changed_type;
197 print "II: Module hash change summary...\n";
198 foreach $mod (sort { $module_syms{$b} <=> $module_syms{$a} } keys %module_syms) {
199 next if ! $module_syms{$mod};
200 printf(" %-40s: %d\n", $mod, $module_syms{$mod});