]> sourceware.org Git - libabigail.git/commitdiff
Wire the soname check into abicompat
authorDodji Seketeli <dodji@redhat.com>
Mon, 8 Dec 2014 12:36:01 +0000 (13:36 +0100)
committerDodji Seketeli <dodji@redhat.com>
Mon, 8 Dec 2014 12:47:00 +0000 (13:47 +0100)
Now that the comparison engine knows how to take SONAMEs into account
during ABI abi comparison, it's feasible to make abicompat leverage
that capability.  This patch does just that.

* include/abg-comparison.h (corpus_diff::soname_changed): Declare
new member function.
* src/abg-comparison.cc (corpus_diff::soname_changed): Define new
member function.
(corpus_diff::length): Use the new corpus_diff::soname_changed()
method.
* tests/data/test-abicompat/libtest4-soname-changed-v0.so: New
test input data.
* tests/data/test-abicompat/libtest4-soname-changed-v1.so:
Likewise.
* tests/data/test-abicompat/test4-soname-changed-app: Likewise.
* tests/data/test-abicompat/test4-soname-changed-report-0.txt:
Likewise.
* tests/data/test-abicompat/test4-soname-changed-app.cc: Source
code for one of the binaries above.
* tests/data/test-abicompat/test4-soname-changed-v0.cc: Likewise.
* tests/data/test-abicompat/test4-soname-changed-v1.cc: Likewise.
* tests/test-abicompat.cc (in_out_specs): Add the new test input
data to the list of input data to run this harness over.
(main): Take the soname change in account to determine if the
change is ABI incompatible.
* tests/data/Makefile.am: Add the new test input data above to source
distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
12 files changed:
include/abg-comparison.h
src/abg-comparison.cc
tests/data/Makefile.am
tests/data/test-abicompat/libtest4-soname-changed-v0.so [new file with mode: 0755]
tests/data/test-abicompat/libtest4-soname-changed-v1.so [new file with mode: 0755]
tests/data/test-abicompat/test4-soname-changed-app [new file with mode: 0755]
tests/data/test-abicompat/test4-soname-changed-app.cc [new file with mode: 0644]
tests/data/test-abicompat/test4-soname-changed-report-0.txt [new file with mode: 0644]
tests/data/test-abicompat/test4-soname-changed-v0.cc [new file with mode: 0644]
tests/data/test-abicompat/test4-soname-changed-v1.cc [new file with mode: 0644]
tests/test-abicompat.cc
tools/abicompat.cc

index 0b51adb7f3b04ef87eb58733d46bcbdccab5ab37..0bf9fd50d14212f12f9ba2b464c490ab3eb3b0b6 100644 (file)
@@ -2029,6 +2029,9 @@ public:
   edit_script&
   variable_changes() const;
 
+  bool
+  soname_changed() const;
+
   const string_function_ptr_map&
   deleted_functions() const;
 
index ef77fa9492e4628f72bb288f54b258c38f294e51..5537f77ce9b2a90683d0d611ee5d2efecd988107 100644 (file)
@@ -10119,6 +10119,13 @@ edit_script&
 corpus_diff::variable_changes() const
 {return priv_->vars_edit_script_;}
 
+/// Test if the soname of the underying corpus has changed.
+///
+/// @return true iff the soname has changed.
+bool
+corpus_diff::soname_changed() const
+{return !priv_->sonames_equal_;}
+
 /// Getter for the deleted functions of the diff.
 ///
 /// @return the the deleted functions of the diff.
@@ -10204,7 +10211,7 @@ corpus_diff::get_pretty_representation() const
 unsigned
 corpus_diff::length() const
 {
-  return (!priv_->sonames_equal_
+  return (soname_changed()
          + priv_->deleted_fns_.size()
          + priv_->added_fns_.size()
          + priv_->changed_fns_.size()
index 369c63a9abbd64d538e11e720534dd9410809d23..8cbcf1c7b6764635bf395e4dc8883abadacbbc09 100644 (file)
@@ -464,4 +464,11 @@ test-abicompat/test3-fn-removed-report-0.txt \
 test-abicompat/test3-fn-removed-v0.cc \
 test-abicompat/test3-fn-removed-v1.cc \
 test-abicompat/test3-fn-removed-version-script-0 \
-test-abicompat/test3-fn-removed-version-script-1
+test-abicompat/test3-fn-removed-version-script-1 \
+test-abicompat/libtest4-soname-changed-v0.so \
+test-abicompat/libtest4-soname-changed-v1.so \
+test-abicompat/test4-soname-changed-app \
+test-abicompat/test4-soname-changed-app.cc \
+test-abicompat/test4-soname-changed-v0.cc \
+test-abicompat/test4-soname-changed-v1.cc \
+test-abicompat/test4-soname-changed-report-0.txt
diff --git a/tests/data/test-abicompat/libtest4-soname-changed-v0.so b/tests/data/test-abicompat/libtest4-soname-changed-v0.so
new file mode 100755 (executable)
index 0000000..0db6880
Binary files /dev/null and b/tests/data/test-abicompat/libtest4-soname-changed-v0.so differ
diff --git a/tests/data/test-abicompat/libtest4-soname-changed-v1.so b/tests/data/test-abicompat/libtest4-soname-changed-v1.so
new file mode 100755 (executable)
index 0000000..bf46679
Binary files /dev/null and b/tests/data/test-abicompat/libtest4-soname-changed-v1.so differ
diff --git a/tests/data/test-abicompat/test4-soname-changed-app b/tests/data/test-abicompat/test4-soname-changed-app
new file mode 100755 (executable)
index 0000000..fdf02be
Binary files /dev/null and b/tests/data/test-abicompat/test4-soname-changed-app differ
diff --git a/tests/data/test-abicompat/test4-soname-changed-app.cc b/tests/data/test-abicompat/test4-soname-changed-app.cc
new file mode 100644 (file)
index 0000000..0c2bd25
--- /dev/null
@@ -0,0 +1,10 @@
+// compile with:
+//   bg++ -g -Wall -L. -ltest4-soname-changed-v0 -o test4-soname-change-app test4-soname-change-app.cc
+
+extern void func0();
+
+int
+main()
+{
+  func0();
+}
diff --git a/tests/data/test-abicompat/test4-soname-changed-report-0.txt b/tests/data/test-abicompat/test4-soname-changed-report-0.txt
new file mode 100644 (file)
index 0000000..89211fd
--- /dev/null
@@ -0,0 +1,7 @@
+ELF file 'test4-soname-changed-app' is not ABI compatible with 'libtest4-soname-changed-v1.so' due to differences with 'libtest4-soname-changed-v0.so' below:
+ELF SONAME changed
+Functions changes summary: 0 Removed, 0 Changed, 0 Added function
+Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
+
+SONAME changed from 'libtest4-soname-changed.so.0' to 'libtest4-soname-changed.so.1'
+
diff --git a/tests/data/test-abicompat/test4-soname-changed-v0.cc b/tests/data/test-abicompat/test4-soname-changed-v0.cc
new file mode 100644 (file)
index 0000000..309ea3c
--- /dev/null
@@ -0,0 +1,7 @@
+// Compile this file with:
+//   g++ -g -Wall -shared -Wl,-soname=libtest4-soname-changed.so.0  -o libtest4-soname-changed-v0.so test4-soname-changed-v0.cc
+
+void
+func0()
+{
+}
diff --git a/tests/data/test-abicompat/test4-soname-changed-v1.cc b/tests/data/test-abicompat/test4-soname-changed-v1.cc
new file mode 100644 (file)
index 0000000..1a2251f
--- /dev/null
@@ -0,0 +1,12 @@
+// Compile this file with:
+//   g++ -g -Wall -shared -Wl,-soname=libtest4-soname-changed.so.1  -o libtest4-soname-changed-v1.so test4-soname-changed-v1.cc
+
+void
+func0()
+{
+}
+
+void
+func1()
+{
+}
index 0fc3e36e186b9b5629a69bdd29c22e87cba96f20..488e2d07eeee19f7738b592ac53940876962605b 100644 (file)
@@ -101,6 +101,15 @@ InOutSpec in_out_specs[] =
     "data/test-abicompat/test3-fn-removed-report-0.txt",
     "output/test-abicompat/test3-fn-removed-report-0.txt",
   },
+  {
+    "data/test-abicompat/test4-soname-changed-app",
+    "data/test-abicompat/libtest4-soname-changed-v0.so",
+    "data/test-abicompat/libtest4-soname-changed-v1.so",
+    "",
+    "--show-base-names",
+    "data/test-abicompat/test4-soname-changed-report-0.txt",
+    "output/test-abicompat/test4-soname-changed-report-0.txt",
+  },
   // This entry must be the last one.
   {0, 0, 0, 0, 0, 0, 0}
 };
index cd81d56be53d212b047e57b5fc34fcdbb3011808..5c18724d22a8d1d9d6d6a4b17a29c00252092624 100644 (file)
@@ -380,7 +380,8 @@ main(int argc, char* argv[])
   const corpus_diff::diff_stats& s =
     changes->apply_filters_and_suppressions_before_reporting();
 
-  if (s.num_func_removed() != 0
+  if (changes->soname_changed()
+      || s.num_func_removed() != 0
       || s.num_vars_removed() != 0
       || s.num_func_syms_removed() != 0
       || s.num_var_syms_removed() != 0
@@ -398,7 +399,8 @@ main(int argc, char* argv[])
          base_name(opts.lib2_path, lib2_path);
        }
 
-      bool abi_break_for_sure = s.num_vars_removed()
+      bool abi_break_for_sure = changes->soname_changed()
+       || s.num_vars_removed()
        || s.num_func_removed()
        || s.num_var_syms_removed()
        || s.num_func_syms_removed();
This page took 0.063421 seconds and 5 git commands to generate.