aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Ponomarenko <andrewponomarenko@yandex.ru>2016-10-06 19:51:11 +0300
committerAndrey Ponomarenko <andrewponomarenko@yandex.ru>2016-10-06 19:51:11 +0300
commit959dd198ef8caa20d87638e56b02e8dfb91d134c (patch)
tree26a58077dd59bdf0e28655641bd6a8bb57ecdd54
parentdd17216a28b68b543069c28efdce2b8da415593e (diff)
downloadabi-compliance-checker-959dd198ef8caa20d87638e56b02e8dfb91d134c.tar.gz
Added -test-abi-dumper option. Do not list a symbol as removed in the source-compatibility report if it is presented in the dynsym table.
-rw-r--r--abi-compliance-checker.pl32
-rw-r--r--modules/Internals/RegTests.pm95
2 files changed, 89 insertions, 38 deletions
diff --git a/abi-compliance-checker.pl b/abi-compliance-checker.pl
index 26ff6b7..d0bf036 100644
--- a/abi-compliance-checker.pl
+++ b/abi-compliance-checker.pl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
###########################################################################
-# ABI Compliance Checker (ABICC) 1.99.24
+# ABI Compliance Checker (ABICC) 1.99.25
# A tool for checking backward compatibility of a C/C++ library API
#
# Copyright (C) 2009-2011 Institute for System Programming, RAS
@@ -60,7 +60,7 @@ use Storable qw(dclone);
use Data::Dumper;
use Config;
-my $TOOL_VERSION = "1.99.24";
+my $TOOL_VERSION = "1.99.25";
my $ABI_DUMP_VERSION = "3.3";
my $XML_REPORT_VERSION = "1.2";
my $XML_ABI_DUMP_VERSION = "1.2";
@@ -93,7 +93,7 @@ $CheckInfo, $Quick, $AffectLimit, $AllAffected, $CxxIncompat,
$SkipInternalSymbols, $SkipInternalTypes, $TargetArch, $GccOptions,
$TypesListPath, $SkipTypesListPath, $CheckPrivateABI, $CountSymbols, $OldStyle,
$DisableQuickEmptyReport, $SkipTypedefUncover, $MinGWCompat, $SkipUnidentified,
-$DisableConstantsCheck, $SkipAddedConstants, $SkipRemovedConstants);
+$DisableConstantsCheck, $SkipAddedConstants, $SkipRemovedConstants, $TestABIDumper);
my $CmdName = get_filename($0);
my %OS_LibExt = (
@@ -234,6 +234,7 @@ GetOptions("h|help!" => \$Help,
# other options
"test!" => \$TestTool,
"test-dump!" => \$TestDump,
+ "test-abi-dumper!" => \$TestABIDumper,
"debug!" => \$Debug,
"cpp-compatible!" => \$CxxCompat,
"cxx-incompatible|cpp-incompatible!" => \$CxxIncompat,
@@ -652,12 +653,15 @@ OTHER OPTIONS:
-test-dump
Test ability to create, read and compare ABI dumps.
+ -test-abi-dumper
+ Compare ABI dumps created by the ABI Dumper tool.
+
-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.
+ Also consider using -dump option for debugging the tool.
-cpp-compatible
Do nothing.
@@ -12982,6 +12986,15 @@ sub detectRemoved_H($)
if(not defined $CompleteSignature{2}{$Symbol}
or not $CompleteSignature{2}{$Symbol}{"MnglName"})
{
+ if(defined $UsedDump{1}{"DWARF"}
+ and $Level eq "Source")
+ {
+ if(link_symbol($Symbol, 2, "-Deps"))
+ { # not present in debug-info,
+ # but present as ELF symbol
+ next;
+ }
+ }
if($UsedDump{1}{"SrcBin"})
{
if($UsedDump{2}{"BinOnly"} or not checkDump(2, "2.11"))
@@ -23094,13 +23107,20 @@ sub scenario()
$TargetHeaders{1}{get_filename($TargetHeader)} = 1;
$TargetHeaders{2}{get_filename($TargetHeader)} = 1;
}
+ if($TestABIDumper)
+ {
+ if($OSgroup ne "linux") {
+ exitStatus("Error", "-test-abi-dumper option is available on Linux only");
+ }
+ }
if($TestTool
- or $TestDump)
+ or $TestDump
+ or $TestABIDumper)
{ # --test, --test-dump
detect_default_paths("bin|gcc"); # to compile libs
loadModule("RegTests");
testTool($TestDump, $Debug, $Quiet, $ExtendedCheck, $LogMode, $ReportFormat, $DumpFormat,
- $LIB_EXT, $GCC_PATH, $SortDump, $CheckHeadersOnly, $OldStyle);
+ $LIB_EXT, $GCC_PATH, $SortDump, $CheckHeadersOnly, $OldStyle, $TestABIDumper);
exit(0);
}
if($DumpSystem)
diff --git a/modules/Internals/RegTests.pm b/modules/Internals/RegTests.pm
index 81aaa98..121662f 100644
--- a/modules/Internals/RegTests.pm
+++ b/modules/Internals/RegTests.pm
@@ -25,14 +25,14 @@ use strict;
my ($TestDump, $Debug, $Quiet, $ExtendedCheck, $LogMode, $ReportFormat,
$DumpFormat, $LIB_EXT, $GCC_PATH, $SortDump, $CheckHeadersOnly,
-$OldStyle);
+$OldStyle, $TestABIDumper);
my $OSgroup = get_OSgroup();
sub testTool($$$$$$$$$$$)
{
($TestDump, $Debug, $Quiet, $ExtendedCheck, $LogMode, $ReportFormat,
$DumpFormat, $LIB_EXT, $GCC_PATH, $SortDump, $CheckHeadersOnly,
- $OldStyle) = @_;
+ $OldStyle, $TestABIDumper) = @_;
testC();
testCpp();
@@ -4677,15 +4677,19 @@ sub testC()
sub runTests($$$$$$$$)
{
my ($LibName, $Lang, $HEADER1, $SOURCE1, $HEADER2, $SOURCE2, $Opaque, $Private) = @_;
- my $Ext = ($Lang eq "C++")?"cpp":"c";
+
+ my $SrcE = ($Lang eq "C++")?"cpp":"c";
rmtree($LibName);
+
+ my $ObjName = "libsample";
+
# creating test suite
- my $Path_v1 = "$LibName/libsample.v1";
- my $Path_v2 = "$LibName/libsample.v2";
+ my $Path_v1 = "$LibName/$ObjName.v1";
+ my $Path_v2 = "$LibName/$ObjName.v2";
mkpath($Path_v1);
mkpath($Path_v2);
- writeFile("$Path_v1/libsample.h", $HEADER1."\n");
- writeFile("$Path_v1/libsample.$Ext", "#include \"libsample.h\"\n".$SOURCE1."\n");
+ writeFile("$Path_v1/$ObjName.h", $HEADER1."\n");
+ writeFile("$Path_v1/$ObjName.$SrcE", "#include \"$ObjName.h\"\n".$SOURCE1."\n");
writeFile("$LibName/v1.xml", "
<version>
1.0
@@ -4710,8 +4714,8 @@ sub runTests($$$$$$$$)
<include_paths>
".get_abs_path($Path_v1)."
</include_paths>\n");
- writeFile("$Path_v1/test.$Ext", "
- #include \"libsample.h\"
+ writeFile("$Path_v1/test.$SrcE", "
+ #include \"$ObjName.h\"
#include <stdio.h>
".($Lang eq "C++"?"using namespace TestNS;":"")."
int main()
@@ -4721,8 +4725,8 @@ sub runTests($$$$$$$$)
return 0;
}\n");
- writeFile("$Path_v2/libsample.h", $HEADER2."\n");
- writeFile("$Path_v2/libsample.$Ext", "#include \"libsample.h\"\n".$SOURCE2."\n");
+ writeFile("$Path_v2/$ObjName.h", $HEADER2."\n");
+ writeFile("$Path_v2/$ObjName.$SrcE", "#include \"$ObjName.h\"\n".$SOURCE2."\n");
writeFile("$LibName/v2.xml", "
<version>
2.0
@@ -4747,8 +4751,8 @@ sub runTests($$$$$$$$)
<include_paths>
".get_abs_path($Path_v2)."
</include_paths>\n");
- writeFile("$Path_v2/test.$Ext", "
- #include \"libsample.h\"
+ writeFile("$Path_v2/test.$SrcE", "
+ #include \"$ObjName.h\"
#include <stdio.h>
".($Lang eq "C++"?"using namespace TestNS;":"")."
int main()
@@ -4767,8 +4771,8 @@ sub runTests($$$$$$$$)
if(not $CL) {
exitStatus("Not_Found", "can't find \"cl\" compiler");
}
- $BuildCmd = "$CL /LD libsample.$Ext >build_log.txt 2>&1";
- $BuildCmd_Test = "$CL test.$Ext libsample.$LIB_EXT";
+ $BuildCmd = "$CL /LD $ObjName.$SrcE >build_log.txt 2>&1";
+ $BuildCmd_Test = "$CL test.$SrcE $ObjName.$LIB_EXT";
}
elsif($OSgroup eq "linux")
{
@@ -4798,13 +4802,13 @@ sub runTests($$$$$$$$)
changedDefaultVersion;
};
");
- $BuildCmd = $GCC_PATH." -Wl,--version-script version -shared libsample.$Ext -o libsample.$LIB_EXT -g -Og";
- $BuildCmd_Test = $GCC_PATH." -Wl,--version-script version test.$Ext -Wl,libsample.$LIB_EXT -o test";
+ $BuildCmd = $GCC_PATH." -Wl,--version-script version -shared $ObjName.$SrcE -o $ObjName.$LIB_EXT -g -Og";
+ $BuildCmd_Test = $GCC_PATH." -Wl,--version-script version test.$SrcE -Wl,$ObjName.$LIB_EXT -o test";
}
else
{
- $BuildCmd = $GCC_PATH." -shared -x c++ libsample.$Ext -lstdc++ -o libsample.$LIB_EXT -g -Og";
- $BuildCmd_Test = $GCC_PATH." -x c++ test.$Ext -lstdc++ -Wl,libsample.$LIB_EXT -o test";
+ $BuildCmd = $GCC_PATH." -shared -x c++ $ObjName.$SrcE -lstdc++ -o $ObjName.$LIB_EXT -g -Og";
+ $BuildCmd_Test = $GCC_PATH." -x c++ test.$SrcE -lstdc++ -Wl,$ObjName.$LIB_EXT -o test";
}
if(getArch_GCC(1)=~/\A(arm|x86_64)\Z/i)
{ # relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
@@ -4816,13 +4820,13 @@ sub runTests($$$$$$$$)
{ # using GCC -dynamiclib
if($Lang eq "C")
{
- $BuildCmd = $GCC_PATH." -dynamiclib libsample.$Ext -o libsample.$LIB_EXT";
- $BuildCmd_Test = $GCC_PATH." test.$Ext libsample.$LIB_EXT -o test";
+ $BuildCmd = $GCC_PATH." -dynamiclib $ObjName.$SrcE -o $ObjName.$LIB_EXT";
+ $BuildCmd_Test = $GCC_PATH." test.$SrcE $ObjName.$LIB_EXT -o test";
}
else
{ # C++
- $BuildCmd = $GCC_PATH." -dynamiclib -x c++ libsample.$Ext -lstdc++ -o libsample.$LIB_EXT";
- $BuildCmd_Test = $GCC_PATH." -x c++ test.$Ext libsample.$LIB_EXT -o test";
+ $BuildCmd = $GCC_PATH." -dynamiclib -x c++ $ObjName.$SrcE -lstdc++ -o $ObjName.$LIB_EXT";
+ $BuildCmd_Test = $GCC_PATH." -x c++ test.$SrcE $ObjName.$LIB_EXT -o test";
}
}
else
@@ -4830,13 +4834,13 @@ sub runTests($$$$$$$$)
# symbian target
if($Lang eq "C")
{
- $BuildCmd = $GCC_PATH." -shared libsample.$Ext -o libsample.$LIB_EXT -g -Og";
- $BuildCmd_Test = $GCC_PATH." test.$Ext -Wl,libsample.$LIB_EXT -o test";
+ $BuildCmd = $GCC_PATH." -shared $ObjName.$SrcE -o $ObjName.$LIB_EXT -g -Og";
+ $BuildCmd_Test = $GCC_PATH." test.$SrcE -Wl,$ObjName.$LIB_EXT -o test";
}
else
{ # C++
- $BuildCmd = $GCC_PATH." -shared -x c++ libsample.$Ext -lstdc++ -o libsample.$LIB_EXT -g -Og";
- $BuildCmd_Test = $GCC_PATH." -x c++ test.$Ext -Wl,libsample.$LIB_EXT -o test";
+ $BuildCmd = $GCC_PATH." -shared -x c++ $ObjName.$SrcE -lstdc++ -o $ObjName.$LIB_EXT -g -Og";
+ $BuildCmd_Test = $GCC_PATH." -x c++ test.$SrcE -Wl,$ObjName.$LIB_EXT -o test";
}
}
@@ -4848,10 +4852,10 @@ sub runTests($$$$$$$$)
my $MkContent = "all:\n\t$BuildCmd\ntest:\n\t$BuildCmd_Test\n";
if($OSgroup eq "windows") {
- $MkContent .= "clean:\n\tdel test libsample.so\n";
+ $MkContent .= "clean:\n\tdel test $ObjName.so\n";
}
else {
- $MkContent .= "clean:\n\trm test libsample.so\n";
+ $MkContent .= "clean:\n\trm test $ObjName.so\n";
}
writeFile("$Path_v1/Makefile", $MkContent);
writeFile("$Path_v2/Makefile", $MkContent);
@@ -4868,8 +4872,35 @@ sub runTests($$$$$$$$)
if($?) {
exitStatus("Error", "can't compile $LibName v.2: \'$Path_v2/build-log.txt\'");
}
- # running the tool
- my @Cmd = ("perl", $0, "-l", $LibName, "-d1", "$LibName/v1.xml", "-d2", "$LibName/v2.xml");
+ # executing the tool
+ my @Cmd = ("perl", $0, "-l", $LibName);
+
+ if($TestABIDumper and $OSgroup eq "linux")
+ {
+ my @Cmd_d1 = ("abi-dumper", $Path_v1."/".$ObjName.".".$LIB_EXT, "-o", $LibName."/ABIv1.dump");
+ @Cmd_d1 = (@Cmd_d1, "-public-headers", $Path_v1, "-lver", "1.0");
+ if($Debug)
+ { # debug mode
+ printMsg("INFO", "executing @Cmd_d1");
+ }
+ system(@Cmd_d1);
+ printMsg("INFO", "");
+
+ my @Cmd_d2 = ("abi-dumper", $Path_v2."/".$ObjName.".".$LIB_EXT, "-o", $LibName."/ABIv2.dump");
+ @Cmd_d2 = (@Cmd_d2, "-public-headers", $Path_v2, "-lver", "2.0");
+ if($Debug)
+ { # debug mode
+ printMsg("INFO", "executing @Cmd_d2");
+ }
+ system(@Cmd_d2);
+ printMsg("INFO", "");
+
+ @Cmd = (@Cmd, "-old", $LibName."/ABIv1.dump", "-new", $LibName."/ABIv2.dump");
+ }
+ else
+ {
+ @Cmd = (@Cmd, "-old", "$LibName/v1.xml", "-new", "$LibName/v2.xml");
+ }
if($Lang eq "C") {
@Cmd = (@Cmd, "-cxx-incompatible");
@@ -4918,7 +4949,7 @@ sub runTests($$$$$$$$)
if($Debug)
{ # debug mode
@Cmd = (@Cmd, "-debug");
- printMsg("INFO", "running @Cmd");
+ printMsg("INFO", "executing @Cmd");
}
system(@Cmd);