forked from lvc/abi-compliance-checker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabi-compliance-checker.pl
executable file
·22997 lines (21624 loc) · 737 KB
/
abi-compliance-checker.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/perl
###########################################################################
# ABI Compliance Checker (ACC) 1.99.9
# A tool for checking backward compatibility of a C/C++ library API
#
# Copyright (C) 2009-2010 The Linux Foundation
# Copyright (C) 2009-2011 Institute for System Programming, RAS
# Copyright (C) 2011-2012 Nokia Corporation and/or its subsidiary(-ies)
# Copyright (C) 2011-2014 ROSA Laboratory
#
# Written by Andrey Ponomarenko
#
# PLATFORMS
# =========
# Linux, FreeBSD, Mac OS X, Haiku, MS Windows, Symbian
#
# REQUIREMENTS
# ============
# Linux
# - G++ (3.0-4.7, 4.8.3, recommended 4.5 or newer)
# - GNU Binutils (readelf, c++filt, objdump)
# - Perl 5 (5.8 or newer)
# - Ctags (5.8 or newer)
#
# Mac OS X
# - Xcode (g++, c++filt, otool, nm)
# - Ctags (5.8 or newer)
#
# MS Windows
# - MinGW (3.0-4.7, recommended 4.5 or newer)
# - MS Visual C++ (dumpbin, undname, cl)
# - Active Perl 5 (5.8 or newer)
# - Sigcheck v1.71 or newer
# - Info-ZIP 3.0 (zip, unzip)
# - Ctags (5.8 or newer)
# - Add tool locations to the PATH environment variable
# - Run vsvars32.bat (C:\Microsoft Visual Studio 9.0\Common7\Tools\)
#
# COMPATIBILITY
# =============
# ABI Dumper >= 0.98
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License or the GNU Lesser
# General Public License as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# and the GNU Lesser General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.
###########################################################################
use Getopt::Long;
Getopt::Long::Configure ("posix_default", "no_ignore_case");
use File::Path qw(mkpath rmtree);
use File::Temp qw(tempdir);
use File::Copy qw(copy move);
use Cwd qw(abs_path cwd realpath);
use Storable qw(dclone);
use Data::Dumper;
use Config;
my $TOOL_VERSION = "1.99.9";
my $ABI_DUMP_VERSION = "3.2";
my $OLDEST_SUPPORTED_VERSION = "1.18";
my $XML_REPORT_VERSION = "1.2";
my $XML_ABI_DUMP_VERSION = "1.2";
my $OSgroup = get_OSgroup();
my $ORIG_DIR = cwd();
my $TMP_DIR = tempdir(CLEANUP=>1);
# Internal modules
my $MODULES_DIR = get_Modules();
push(@INC, get_dirname($MODULES_DIR));
# Rules DB
my %RULES_PATH = (
"Binary" => $MODULES_DIR."/RulesBin.xml",
"Source" => $MODULES_DIR."/RulesSrc.xml");
my ($Help, $ShowVersion, %Descriptor, $TargetLibraryName, $GenerateTemplate,
$TestTool, $DumpAPI, $SymbolsListPath, $CheckHeadersOnly_Opt, $UseDumps,
$CheckObjectsOnly_Opt, $AppPath, $StrictCompat, $DumpVersion, $ParamNamesPath,
%RelativeDirectory, $TargetLibraryFName, $TestDump, $CheckImpl, $LoggingPath,
%TargetVersion, $InfoMsg, $UseOldDumps, $CrossGcc, %OutputLogPath,
$OutputReportPath, $OutputDumpPath, $ShowRetVal, $SystemRoot_Opt, $DumpSystem,
$CmpSystems, $TargetLibsPath, $Debug, $CrossPrefix, $UseStaticLibs, $NoStdInc,
$TargetComponent_Opt, $TargetSysInfo, $TargetHeader, $ExtendedCheck, $Quiet,
$SkipHeadersPath, $CppCompat, $LogMode, $StdOut, $ListAffected, $ReportFormat,
$UserLang, $TargetHeadersPath, $BinaryOnly, $SourceOnly, $BinaryReportPath,
$SourceReportPath, $UseXML, $Browse, $OpenReport, $SortDump, $DumpFormat,
$ExtraInfo, $ExtraDump, $Force, $Tolerance, $Tolerant, $SkipSymbolsListPath,
$CheckInfo, $Quick, $AffectLimit, $AllAffected, $CppIncompat, $SkipInternal);
my $CmdName = get_filename($0);
my %OS_LibExt = (
"dynamic" => {
"linux"=>"so",
"macos"=>"dylib",
"windows"=>"dll",
"symbian"=>"dso",
"default"=>"so"
},
"static" => {
"linux"=>"a",
"windows"=>"lib",
"symbian"=>"lib",
"default"=>"a"
}
);
my %OS_Archive = (
"windows"=>"zip",
"default"=>"tar.gz"
);
my %ERROR_CODE = (
# Compatible verdict
"Compatible"=>0,
"Success"=>0,
# Incompatible verdict
"Incompatible"=>1,
# Undifferentiated error code
"Error"=>2,
# System command is not found
"Not_Found"=>3,
# Cannot access input files
"Access_Error"=>4,
# Cannot compile header files
"Cannot_Compile"=>5,
# Header compiled with errors
"Compile_Error"=>6,
# Invalid input ABI dump
"Invalid_Dump"=>7,
# Incompatible version of ABI dump
"Dump_Version"=>8,
# Cannot find a module
"Module_Error"=>9,
# Empty intersection between
# headers and shared objects
"Empty_Intersection"=>10,
# Empty set of symbols in headers
"Empty_Set"=>11
);
my %HomePage = (
"Wiki"=>"http://ispras.linuxbase.org/index.php/ABI_compliance_checker",
"Dev1"=>"https://github.com/lvc/abi-compliance-checker",
"Dev2"=>"http://forge.ispras.ru/projects/abi-compliance-checker"
);
my $ShortUsage = "ABI Compliance Checker (ACC) $TOOL_VERSION
A tool for checking backward compatibility of a C/C++ library API
Copyright (C) 2014 ROSA Laboratory
License: GNU LGPL or GNU GPL
Usage: $CmdName [options]
Example: $CmdName -lib NAME -old OLD.xml -new NEW.xml
OLD.xml and NEW.xml are XML-descriptors:
<version>
1.0
</version>
<headers>
/path/to/headers/
</headers>
<libs>
/path/to/libraries/
</libs>
More info: $CmdName --help\n";
if($#ARGV==-1)
{
printMsg("INFO", $ShortUsage);
exit(0);
}
foreach (2 .. $#ARGV)
{ # correct comma separated options
if($ARGV[$_-1] eq ",")
{
$ARGV[$_-2].=",".$ARGV[$_];
splice(@ARGV, $_-1, 2);
}
elsif($ARGV[$_-1]=~/,\Z/)
{
$ARGV[$_-1].=$ARGV[$_];
splice(@ARGV, $_, 1);
}
elsif($ARGV[$_]=~/\A,/
and $ARGV[$_] ne ",")
{
$ARGV[$_-1].=$ARGV[$_];
splice(@ARGV, $_, 1);
}
}
GetOptions("h|help!" => \$Help,
"i|info!" => \$InfoMsg,
"v|version!" => \$ShowVersion,
"dumpversion!" => \$DumpVersion,
# general options
"l|lib|library=s" => \$TargetLibraryName,
"d1|old|o=s" => \$Descriptor{1}{"Path"},
"d2|new|n=s" => \$Descriptor{2}{"Path"},
"dump|dump-abi|dump_abi=s" => \$DumpAPI,
"old-dumps!" => \$UseOldDumps,
# extra options
"d|descriptor-template!" => \$GenerateTemplate,
"app|application=s" => \$AppPath,
"static-libs!" => \$UseStaticLibs,
"cross-gcc|gcc-path=s" => \$CrossGcc,
"cross-prefix|gcc-prefix=s" => \$CrossPrefix,
"sysroot=s" => \$SystemRoot_Opt,
"v1|version1|vnum=s" => \$TargetVersion{1},
"v2|version2=s" => \$TargetVersion{2},
"s|strict!" => \$StrictCompat,
"symbols-list=s" => \$SymbolsListPath,
"skip-symbols=s" => \$SkipSymbolsListPath,
"headers-list=s" => \$TargetHeadersPath,
"skip-headers=s" => \$SkipHeadersPath,
"header=s" => \$TargetHeader,
"headers-only|headers_only!" => \$CheckHeadersOnly_Opt,
"objects-only!" => \$CheckObjectsOnly_Opt,
"check-impl|check-implementation!" => \$CheckImpl,
"show-retval!" => \$ShowRetVal,
"use-dumps!" => \$UseDumps,
"nostdinc!" => \$NoStdInc,
"dump-system=s" => \$DumpSystem,
"sysinfo=s" => \$TargetSysInfo,
"cmp-systems!" => \$CmpSystems,
"libs-list=s" => \$TargetLibsPath,
"ext|extended!" => \$ExtendedCheck,
"q|quiet!" => \$Quiet,
"stdout!" => \$StdOut,
"report-format=s" => \$ReportFormat,
"dump-format=s" => \$DumpFormat,
"xml!" => \$UseXML,
"lang=s" => \$UserLang,
"binary|bin|abi!" => \$BinaryOnly,
"source|src|api!" => \$SourceOnly,
"limit-affected|affected-limit=s" => \$AffectLimit,
# other options
"test!" => \$TestTool,
"test-dump!" => \$TestDump,
"debug!" => \$Debug,
"cpp-compatible!" => \$CppCompat,
"cpp-incompatible!" => \$CppIncompat,
"p|params=s" => \$ParamNamesPath,
"relpath1|relpath=s" => \$RelativeDirectory{1},
"relpath2=s" => \$RelativeDirectory{2},
"dump-path=s" => \$OutputDumpPath,
"sort!" => \$SortDump,
"report-path=s" => \$OutputReportPath,
"bin-report-path=s" => \$BinaryReportPath,
"src-report-path=s" => \$SourceReportPath,
"log-path=s" => \$LoggingPath,
"log1-path=s" => \$OutputLogPath{1},
"log2-path=s" => \$OutputLogPath{2},
"logging-mode=s" => \$LogMode,
"list-affected!" => \$ListAffected,
"l-full|lib-full=s" => \$TargetLibraryFName,
"component=s" => \$TargetComponent_Opt,
"b|browse=s" => \$Browse,
"open!" => \$OpenReport,
"extra-info=s" => \$ExtraInfo,
"extra-dump!" => \$ExtraDump,
"force!" => \$Force,
"tolerance=s" => \$Tolerance,
"tolerant!" => \$Tolerant,
"check!" => \$CheckInfo,
"quick!" => \$Quick,
"all-affected!" => \$AllAffected,
"skip-internal=s" => \$SkipInternal
) or ERR_MESSAGE();
sub ERR_MESSAGE()
{
printMsg("INFO", "\n".$ShortUsage);
exit($ERROR_CODE{"Error"});
}
my $LIB_TYPE = $UseStaticLibs?"static":"dynamic";
my $SLIB_TYPE = $LIB_TYPE;
if($OSgroup!~/macos|windows/ and $SLIB_TYPE eq "dynamic")
{ # show as "shared" library
$SLIB_TYPE = "shared";
}
my $LIB_EXT = getLIB_EXT($OSgroup);
my $AR_EXT = getAR_EXT($OSgroup);
my $BYTE_SIZE = 8;
my $COMMON_LOG_PATH = "logs/run.log";
my $HelpMessage="
NAME:
ABI Compliance Checker ($CmdName)
Check backward compatibility of a C/C++ library API
DESCRIPTION:
ABI Compliance Checker (ACC) is a tool for checking backward binary and
source-level compatibility of a $SLIB_TYPE C/C++ library. The tool checks
header files and $SLIB_TYPE libraries (*.$LIB_EXT) of old and new versions and
analyzes changes in API and ABI (ABI=API+compiler ABI) that may break binary
and/or source-level compatibility: changes in calling stack, v-table changes,
removed symbols, renamed fields, etc. Binary incompatibility may result in
crashing or incorrect behavior of applications built with an old version of
a library if they run on a new one. Source incompatibility may result in
recompilation errors with a new library version.
The tool is intended for developers of software libraries and maintainers
of operating systems who are interested in ensuring backward compatibility,
i.e. allow old applications to run or to be recompiled with newer library
versions.
Also the tool can be used by ISVs for checking applications portability to
new library versions. Found issues can be taken into account when adapting
the application to a new library version.
This tool is free software: you can redistribute it and/or modify it
under the terms of the GNU LGPL or GNU GPL.
USAGE:
$CmdName [options]
EXAMPLE:
$CmdName -lib NAME -old OLD.xml -new NEW.xml
OLD.xml and NEW.xml are XML-descriptors:
<version>
1.0
</version>
<headers>
/path1/to/header(s)/
/path2/to/header(s)/
...
</headers>
<libs>
/path1/to/library(ies)/
/path2/to/library(ies)/
...
</libs>
INFORMATION OPTIONS:
-h|-help
Print this help.
-i|-info
Print complete info.
-v|-version
Print version information.
-dumpversion
Print the tool version ($TOOL_VERSION) and don't do anything else.
GENERAL OPTIONS:
-l|-lib|-library NAME
Library name (without version).
-d1|-old|-o PATH
Descriptor of 1st (old) library version.
It may be one of the following:
1. XML-descriptor (VERSION.xml file):
<version>
1.0
</version>
<headers>
/path1/to/header(s)/
/path2/to/header(s)/
...
</headers>
<libs>
/path1/to/library(ies)/
/path2/to/library(ies)/
...
</libs>
... (XML-descriptor template
can be generated by -d option)
2. ABI dump generated by -dump option
3. Directory with headers and/or $SLIB_TYPE libraries
4. Single header file
5. Single $SLIB_TYPE library
6. Comma separated list of headers and/or libraries
If you are using an 2-6 descriptor types then you should
specify version numbers with -v1 and -v2 options too.
For more information, please see:
http://ispras.linuxbase.org/index.php/Library_Descriptor
-d2|-new|-n PATH
Descriptor of 2nd (new) library version.
-dump|-dump-abi PATH
Create library ABI dump for the input XML descriptor. You can
transfer it anywhere and pass instead of the descriptor. Also
it can be used for debugging the tool.
Supported ABI dump versions: 2.0<=V<=$ABI_DUMP_VERSION
-old-dumps
Enable support for old-version ABI dumps ($OLDEST_SUPPORTED_VERSION<=V<2.0).\n";
sub HELP_MESSAGE() {
printMsg("INFO", $HelpMessage."
MORE INFO:
$CmdName --info\n");
}
sub INFO_MESSAGE()
{
printMsg("INFO", "$HelpMessage
EXTRA OPTIONS:
-d|-descriptor-template
Create XML-descriptor template ./VERSION.xml
-app|-application PATH
This option allows one to specify the application that should be checked
for portability to the new library version.
-static-libs
Check static libraries instead of the shared ones. The <libs> section
of the XML-descriptor should point to static libraries location.
-cross-gcc|-gcc-path PATH
Path to the cross GCC compiler to use instead of the usual (host) GCC.
-cross-prefix|-gcc-prefix PREFIX
GCC toolchain prefix.
-sysroot DIR
Specify the alternative root directory. The tool will search for include
paths in the DIR/usr/include and DIR/usr/lib directories.
-v1|-version1 NUM
Specify 1st library version outside the descriptor. This option is needed
if you have preferred an alternative descriptor type (see -d1 option).
In general case you should specify it in the XML-descriptor:
<version>
VERSION
</version>
-v2|-version2 NUM
Specify 2nd library version outside the descriptor.
-s|-strict
Treat all compatibility warnings as problems. Add a number of \"Low\"
severity problems to the return value of the tool.
-headers-only
Check header files without $SLIB_TYPE libraries. It is easy to run, but may
provide a low quality compatibility report with false positives and
without detecting of added/removed symbols.
Alternatively you can write \"none\" word to the <libs> section
in the XML-descriptor:
<libs>
none
</libs>
-objects-only
Check $SLIB_TYPE libraries without header files. It is easy to run, but may
provide a low quality compatibility report with false positives and
without analysis of changes in parameters and data types.
Alternatively you can write \"none\" word to the <headers> section
in the XML-descriptor:
<headers>
none
</headers>
-check-impl|-check-implementation
Compare canonified disassembled binary code of $SLIB_TYPE libraries to
detect changes in the implementation. Add \'Problems with Implementation\'
section to the report.
-show-retval
Show the symbol's return type in the report.
-symbols-list PATH
This option allows one to specify a file with a list of symbols (mangled
names in C++) that should be checked, other symbols will not be checked.
-skip-symbols PATH
The list of symbols that should NOT be checked.
-headers-list PATH
The file with a list of headers, that should be checked/dumped.
-skip-headers PATH
The file with the list of header files, that should not be checked.
-header NAME
Check/Dump ABI of this header only.
-use-dumps
Make dumps for two versions of a library and compare dumps. This should
increase the performance of the tool and decrease the system memory usage.
-nostdinc
Do not search in GCC standard system directories for header files.
-dump-system NAME -sysroot DIR
Find all the shared libraries and header files in DIR directory,
create XML descriptors and make ABI dumps for each library. The result
set of ABI dumps can be compared (--cmp-systems) with the other one
created for other version of operating system in order to check them for
compatibility. Do not forget to specify -cross-gcc option if your target
system requires some specific version of GCC compiler (different from
the host GCC). The system ABI dump will be generated to:
sys_dumps/NAME/ARCH
-dump-system DESCRIPTOR.xml
The same as the previous option but takes an XML descriptor of the target
system as input, where you should describe it:
/* Primary sections */
<name>
/* Name of the system */
</name>
<headers>
/* The list of paths to header files and/or
directories with header files, one per line */
</headers>
<libs>
/* The list of paths to shared libraries and/or
directories with shared libraries, one per line */
</libs>
/* Optional sections */
<search_headers>
/* List of directories to be searched
for header files to automatically
generate include paths, one per line */
</search_headers>
<search_libs>
/* List of directories to be searched
for shared libraries to resolve
dependencies, one per line */
</search_libs>
<tools>
/* List of directories with tools used
for analysis (GCC toolchain), one per line */
</tools>
<cross_prefix>
/* GCC toolchain prefix.
Examples:
arm-linux-gnueabi
arm-none-symbianelf */
</cross_prefix>
<gcc_options>
/* Additional GCC options, one per line */
</gcc_options>
-sysinfo DIR
This option may be used with -dump-system to dump ABI of operating
systems and configure the dumping process.
Default:
modules/Targets/{unix, symbian, windows}
-cmp-systems -d1 sys_dumps/NAME1/ARCH -d2 sys_dumps/NAME2/ARCH
Compare two system ABI dumps. Create compatibility reports for each
library and the common HTML report including the summary of test
results for all checked libraries. Report will be generated to:
sys_compat_reports/NAME1_to_NAME2/ARCH
-libs-list PATH
The file with a list of libraries, that should be dumped by
the -dump-system option or should be checked by the -cmp-systems option.
-ext|-extended
If your library A is supposed to be used by other library B and you
want to control the ABI of B, then you should enable this option. The
tool will check for changes in all data types, even if they are not
used by any function in the library A. Such data types are not part
of the A library ABI, but may be a part of the ABI of the B library.
The short scheme is:
app C (broken) -> lib B (broken ABI) -> lib A (stable ABI)
-q|-quiet
Print all messages to the file instead of stdout and stderr.
Default path (can be changed by -log-path option):
$COMMON_LOG_PATH
-stdout
Print analysis results (compatibility reports and ABI dumps) to stdout
instead of creating a file. This would allow piping data to other programs.
-report-format FMT
Change format of compatibility report.
Formats:
htm - HTML format (default)
xml - XML format
-dump-format FMT
Change format of ABI dump.
Formats:
perl - Data::Dumper format (default)
xml - XML format
-xml
Alias for: --report-format=xml or --dump-format=xml
-lang LANG
Set library language (C or C++). You can use this option if the tool
cannot auto-detect a language. This option may be useful for checking
C-library headers (--lang=C) in --headers-only or --extended modes.
-binary|-bin|-abi
Show \"Binary\" compatibility problems only.
Generate report to:
compat_reports/LIB_NAME/V1_to_V2/abi_compat_report.html
-source|-src|-api
Show \"Source\" compatibility problems only.
Generate report to:
compat_reports/LIB_NAME/V1_to_V2/src_compat_report.html
-limit-affected LIMIT
The maximum number of affected symbols listed under the description
of the changed type in the report.
OTHER OPTIONS:
-test
Run internal tests. Create two binary incompatible versions of a sample
library and run the tool to check them for compatibility. This option
allows one to check if the tool works correctly in the current environment.
-test-dump
Test ability to create, read and compare ABI dumps.
-debug
Debugging mode. Print debug info on the screen. Save intermediate
analysis stages in the debug directory:
debug/LIB_NAME/VERSION/
Also consider using --dump option for debugging the tool.
-cpp-compatible
If your header files are written in C language and can be compiled
by the G++ compiler (i.e. don't use C++ keywords), then you can tell
the tool about this and speedup the analysis.
-cpp-incompatible
Set this option if input C header files use C++ keywords.
-p|-params PATH
Path to file with the function parameter names. It can be used
for improving report view if the library header files have no
parameter names. File format:
func1;param1;param2;param3 ...
func2;param1;param2;param3 ...
...
-relpath PATH
Replace {RELPATH} macros to PATH in the XML-descriptor used
for dumping the library ABI (see -dump option).
-relpath1 PATH
Replace {RELPATH} macros to PATH in the 1st XML-descriptor (-d1).
-relpath2 PATH
Replace {RELPATH} macros to PATH in the 2nd XML-descriptor (-d2).
-dump-path PATH
Specify a *.abi.$AR_EXT or *.abi file path where to generate an ABI dump.
Default:
abi_dumps/LIB_NAME/LIB_NAME_VERSION.abi.$AR_EXT
-sort
Enable sorting of data in ABI dumps.
-report-path PATH
Path to compatibility report.
Default:
compat_reports/LIB_NAME/V1_to_V2/compat_report.html
-bin-report-path PATH
Path to \"Binary\" compatibility report.
Default:
compat_reports/LIB_NAME/V1_to_V2/abi_compat_report.html
-src-report-path PATH
Path to \"Source\" compatibility report.
Default:
compat_reports/LIB_NAME/V1_to_V2/src_compat_report.html
-log-path PATH
Log path for all messages.
Default:
logs/LIB_NAME/VERSION/log.txt
-log1-path PATH
Log path for 1st version of a library.
Default:
logs/LIB_NAME/V1/log.txt
-log2-path PATH
Log path for 2nd version of a library.
Default:
logs/LIB_NAME/V2/log.txt
-logging-mode MODE
Change logging mode.
Modes:
w - overwrite old logs (default)
a - append old logs
n - do not write any logs
-list-affected
Generate file with the list of incompatible
symbols beside the HTML compatibility report.
Use 'c++filt \@file' command from GNU binutils
to unmangle C++ symbols in the generated file.
Default names:
abi_affected.txt
src_affected.txt
-component NAME
The component name in the title and summary of the HTML report.
Default:
library
-l-full|-lib-full NAME
Change library name in the report title to NAME. By default
will be displayed a name specified by -l option.
-b|-browse PROGRAM
Open report(s) in the browser (firefox, opera, etc.).
-open
Open report(s) in the default browser.
-extra-info DIR
Dump extra info to DIR.
-extra-dump
Create extended ABI dump containing all symbols
from the translation unit.
-force
Try to use this option if the tool doesn't work.
-tolerance LEVEL
Apply a set of heuristics to successfully compile input
header files. You can enable several tolerance levels by
joining them into one string (e.g. 13, 124, etc.).
Levels:
1 - skip non-Linux headers (e.g. win32_*.h, etc.)
2 - skip internal headers (e.g. *_p.h, impl/*.h, etc.)
3 - skip headers that iclude non-Linux headers
4 - skip headers included by others
-tolerant
Enable highest tolerance level [1234].
-check
Check completeness of the ABI dump.
-quick
Quick analysis. Disable check of some template instances.
-skip-internal PATTERN
Do not check internal interfaces matched by the pattern.
REPORT:
Compatibility report will be generated to:
compat_reports/LIB_NAME/V1_to_V2/compat_report.html
Log will be generated to:
logs/LIB_NAME/V1/log.txt
logs/LIB_NAME/V2/log.txt
EXIT CODES:
0 - Compatible. The tool has run without any errors.
non-zero - Incompatible or the tool has run with errors.
REPORT BUGS TO:
Andrey Ponomarenko <aponomarenko\@rosalab.ru>
MORE INFORMATION:
".$HomePage{"Wiki"}."
".$HomePage{"Dev1"}."\n");
}
my $DescriptorTemplate = "
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<descriptor>
/* Primary sections */
<version>
/* Version of the library */
</version>
<headers>
/* The list of paths to header files and/or
directories with header files, one per line */
</headers>
<libs>
/* The list of paths to shared libraries (*.$LIB_EXT) and/or
directories with shared libraries, one per line */
</libs>
/* Optional sections */
<include_paths>
/* The list of include paths that will be provided
to GCC to compile library headers, one per line.
NOTE: If you define this section then the tool
will not automatically generate include paths */
</include_paths>
<add_include_paths>
/* The list of include paths that will be added
to the automatically generated include paths, one per line */
</add_include_paths>
<skip_include_paths>
/* The list of include paths that will be removed from the
list of automatically generated include paths, one per line */
</skip_include_paths>
<gcc_options>
/* Additional GCC options, one per line */
</gcc_options>
<include_preamble>
/* The list of header files that will be
included before other headers, one per line */
</include_preamble>
<defines>
/* The list of defines that will be added at the
headers compiling stage, one per line:
#define A B
#define C D */
</defines>
<add_namespaces>
/* The list of namespaces that should be added to the alanysis
if the tool cannot find them automatically, one per line */
</add_namespaces>
<skip_types>
/* The list of data types, that
should not be checked, one per line */
</skip_types>
<skip_symbols>
/* The list of functions (mangled/symbol names in C++),
that should not be checked, one per line */
</skip_symbols>
<skip_namespaces>
/* The list of C++ namespaces, that
should not be checked, one per line */
</skip_namespaces>
<skip_constants>
/* The list of constants that should
not be checked, one name per line */
</skip_constants>
<skip_headers>
/* The list of header files and/or directories
with header files that should not be checked, one per line */
</skip_headers>
<skip_libs>
/* The list of shared libraries and/or directories
with shared libraries that should not be checked, one per line */
</skip_libs>
<skip_including>
/* The list of header files, that cannot be included
directly (or non-self compiled ones), one per line */
</skip_including>
<search_headers>
/* List of directories to be searched
for header files to automatically
generate include paths, one per line. */
</search_headers>
<search_libs>
/* List of directories to be searched
for shared librariess to resolve
dependencies, one per line */
</search_libs>
<tools>
/* List of directories with tools used
for analysis (GCC toolchain), one per line */
</tools>
<cross_prefix>
/* GCC toolchain prefix.
Examples:
arm-linux-gnueabi
arm-none-symbianelf */
</cross_prefix>
</descriptor>";
my %Operator_Indication = (
"not" => "~",
"assign" => "=",
"andassign" => "&=",
"orassign" => "|=",
"xorassign" => "^=",
"or" => "|",
"xor" => "^",
"addr" => "&",
"and" => "&",
"lnot" => "!",
"eq" => "==",
"ne" => "!=",
"lt" => "<",
"lshift" => "<<",
"lshiftassign" => "<<=",
"rshiftassign" => ">>=",
"call" => "()",
"mod" => "%",
"modassign" => "%=",
"subs" => "[]",
"land" => "&&",
"lor" => "||",
"rshift" => ">>",
"ref" => "->",
"le" => "<=",
"deref" => "*",
"mult" => "*",
"preinc" => "++",
"delete" => " delete",
"vecnew" => " new[]",
"vecdelete" => " delete[]",
"predec" => "--",
"postinc" => "++",
"postdec" => "--",
"plusassign" => "+=",
"plus" => "+",
"minus" => "-",
"minusassign" => "-=",
"gt" => ">",
"ge" => ">=",
"new" => " new",
"multassign" => "*=",
"divassign" => "/=",
"div" => "/",
"neg" => "-",
"pos" => "+",
"memref" => "->*",
"compound" => "," );
my %UnknownOperator;
my %NodeType= (
"array_type" => "Array",
"binfo" => "Other",
"boolean_type" => "Intrinsic",
"complex_type" => "Intrinsic",
"const_decl" => "Other",
"enumeral_type" => "Enum",
"field_decl" => "Other",
"function_decl" => "Other",
"function_type" => "FunctionType",
"identifier_node" => "Other",
"integer_cst" => "Other",
"integer_type" => "Intrinsic",
"vector_type" => "Vector",
"method_type" => "MethodType",