]> sourceware.org Git - libabigail.git/commitdiff
Symbols with the same zero value are not aliases
authorDodji Seketeli <dodji@redhat.com>
Mon, 12 Jun 2017 17:10:20 +0000 (19:10 +0200)
committerDodji Seketeli <dodji@redhat.com>
Mon, 3 Jul 2017 15:45:49 +0000 (17:45 +0200)
When looking at ELF file of the ET_REL kind (i.e, relocatable object
files), several kinds of symbols (for instance weak symbols) can have
the symbol value zero.  Although they have the same value, the fact
that that value is zero prevents us from considering those symbols as
being aliases.

Libabigail was wrongly considering those symbols with value zero as
being aliases.  So, in practice, it was considering all WEAK symbols
as being aliases, because the value of a weak symbols is zero.

When comparing two binaries originating from the same source code, one
compiled with g++ and the other one compiled with clang++, abidiff was
thus reporting spurious function aliases changes due to this issue.

Note that the two binaries in question come from the bug PR21486.
Comparing them using abidiff exhibits several other issues that were
fixed in previous commits, such as

 - Reporting changes about top cv qualifier changes on function
 parameter types.
 - Not supporting ELF symbol visibility

* src/abg-dwarf-reader.cc (load_symbol_maps_from_symtab_section):
Do not consider symbols with zero value as being aliases.
* tests/data/test-diff-filter/test20-inline-report-0.txt: Adjust.
* tests/data/test-diff-filter/test20-inline-report-1.txt:
Likewise.
* test-diff-filter/test41-PR21486-abg-writer.gcc.o: New test
binary input.
* tests/data/test-diff-filter/test41-PR21486-abg-writer.llvm.o:
Likewise.
* tests/data/Makefile.am: Add the new test material to source
distribution.
* tests/test-diff-filter.cc (in_out_specs): Run the test harness
on the new test input above.
* tests/data/test-diff-dwarf/test5-report.txt: Adjust.
* tests/data/test-diff-filter/test9-report.txt: Adjust.
* tests/data/test-diff-filter/test20-inline-report-0.txt: Adjust.
* tests/data/test-diff-filter/test20-inline-report-1.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
src/abg-dwarf-reader.cc
tests/data/Makefile.am
tests/data/test-diff-dwarf/test5-report.txt
tests/data/test-diff-filter/test20-inline-report-0.txt
tests/data/test-diff-filter/test20-inline-report-1.txt
tests/data/test-diff-filter/test41-PR21486-abg-writer.gcc.o [new file with mode: 0644]
tests/data/test-diff-filter/test41-PR21486-abg-writer.llvm.o [new file with mode: 0644]
tests/data/test-diff-filter/test41-report-0.txt [new file with mode: 0644]
tests/data/test-diff-filter/test9-report.txt
tests/test-diff-filter.cc

index f6faa34ef7fc994f326a4e068f6c5bb7ed298bd2..01e83fb7dfa1be5085ddbce74c439dbd2e3ec4fc 100644 (file)
@@ -6682,7 +6682,7 @@ public:
                    fun_addr_sym_map_->find(sym->st_value);
                  if (it == fun_addr_sym_map_->end())
                    (*fun_addr_sym_map_)[sym->st_value] = symbol;
-                 else
+                 else  if (sym->st_value != 0)
                    it->second->get_main_symbol()->add_alias(symbol);
 
                  if (is_ppc64)
index c7e405ef9415436616c940e96d5066a5f7a54bc9..bc107303c583db93d1d6e4d67621658526e64b18 100644 (file)
@@ -625,6 +625,9 @@ test-diff-filter/libtest40-v1.so \
 test-diff-filter/test40-report-0.txt \
 test-diff-filter/test40-v0.cc \
 test-diff-filter/test40-v1.cc \
+test-diff-filter/test41-PR21486-abg-writer.gcc.o \
+test-diff-filter/test41-PR21486-abg-writer.llvm.o \
+test-diff-filter/test41-report-0.txt \
 \
 test-diff-suppr/test0-type-suppr-v0.cc \
 test-diff-suppr/test0-type-suppr-v1.cc \
index 2f099dbc1db89ee2921fe104d09cd2ea7b6424fc..c8c9830f2ad6694ca68c9bbf23709ceefc423f6f 100644 (file)
@@ -4,8 +4,6 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
 1 function with some indirect sub-type change:
 
   [C]'function C0 foo()' has some indirect sub-type changes:
-    Please note that the symbol of this function is _ZN2C0C2Ev
-     and it aliases symbols: _ZN2C0C1Ev, _Z3foov
     return type changed:
       entity changed from 'class C0' to compatible type 'typedef c0_type'
         type size hasn't changed
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..9666a8fddad78d092179150f680a1742aadfff09 100644 (file)
@@ -0,0 +1,3 @@
+Functions changes summary: 0 Removed, 0 Changed (1 filtered out), 0 Added function
+Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
+
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..2abdae7766073ff84a1eba2007b64965e6e0447c 100644 (file)
@@ -0,0 +1,9 @@
+Functions changes summary: 0 Removed, 1 Changed, 0 Added function
+Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
+
+1 function with some indirect sub-type change:
+
+  [C]'function int bar()' has some indirect sub-type changes:
+    'function int bar() {_ZN1S3fooEv}' now becomes 'method int S::foo() {_ZN1S3fooEv}'
+
+
diff --git a/tests/data/test-diff-filter/test41-PR21486-abg-writer.gcc.o b/tests/data/test-diff-filter/test41-PR21486-abg-writer.gcc.o
new file mode 100644 (file)
index 0000000..2927c24
Binary files /dev/null and b/tests/data/test-diff-filter/test41-PR21486-abg-writer.gcc.o differ
diff --git a/tests/data/test-diff-filter/test41-PR21486-abg-writer.llvm.o b/tests/data/test-diff-filter/test41-PR21486-abg-writer.llvm.o
new file mode 100644 (file)
index 0000000..1a9f8f9
Binary files /dev/null and b/tests/data/test-diff-filter/test41-PR21486-abg-writer.llvm.o differ
diff --git a/tests/data/test-diff-filter/test41-report-0.txt b/tests/data/test-diff-filter/test41-report-0.txt
new file mode 100644 (file)
index 0000000..b167de0
--- /dev/null
@@ -0,0 +1,42 @@
+Functions changes summary: 0 Removed, 0 Changed (4 filtered out), 1 Added function
+Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
+Function symbols changes summary: 12 Removed, 15 Added function symbols not referenced by debug info
+Variable symbols changes summary: 0 Removed, 0 Added variable symbol not referenced by debug info
+
+1 Added function:
+
+  'function bool abigail::xml_writer::annotate(const abigail::ir::function_type_sptr&, abigail::xml_writer::write_context&, unsigned int)'    {_ZN7abigail10xml_writer13write_context10sort_typesERKSt6vectorINSt3tr110shared_ptrINS_2ir13function_typeEEESaIS7_EERS2_INS4_INS5_9type_baseEEESaISD_EE}
+
+12 Removed function symbols not referenced by debug info:
+
+  _ZN7abigail10xml_writer13write_context32record_decl_only_type_as_emittedEPNS_2ir9type_baseE
+  _ZN7abigail10xml_writer13write_contextC1EPKNS_2ir11environmentERSob
+  _ZN7abigail10xml_writer13write_contextD1Ev
+  _ZNKSt3tr18__detail20_Prime_rehash_policy14_M_need_rehashEmmm
+  _ZNSt11_Deque_baseIjSaIjEED1Ev
+  _ZNSt11_Deque_baseIjSaIjEED2Ev
+  _ZNSt3tr114__shared_countILN9__gnu_cxx12_Lock_policyE2EEaSERKS3_
+  _ZNSt3tr116_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE10_M_releaseEv
+  _ZNSt5dequeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE12emplace_backIJS5_EEEvDpOT_
+  _ZNSt5dequeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE16_M_push_back_auxIJS5_EEEvDpOT_
+  _ZNSt5dequeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EED1Ev
+  _ZNSt5dequeIjSaIjEE16_M_push_back_auxIJRKjEEEvDpOT_
+
+15 Added function symbols not referenced by debug info:
+
+  _ZN7abigail10xml_writer13write_context10sort_typesERNSt3tr113unordered_mapIPNS_2ir9type_baseENS_15interned_stringENS0_11type_hasherENS_10diff_utils19deep_ptr_eq_functorESaISt4pairIKS6_S7_EEEERSt6vectorIS6_SaIS6_EE
+  _ZN7abigail10xml_writer13write_context18get_id_for_fn_tmplB5cxx11ERKNSt3tr110shared_ptrINS_2ir14function_tdeclEEE
+  _ZN7abigail10xml_writer13write_context21get_id_for_class_tmplB5cxx11ERKNSt3tr110shared_ptrINS_2ir11class_tdeclEEE
+  _ZN7abigail10xml_writer13write_context25record_type_id_as_emittedERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
+  _ZNSt11_Deque_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE15_M_create_nodesEPPS5_S9_
+  _ZNSt11_Deque_baseIjSaIjEE15_M_create_nodesEPPjS3_
+  _ZNSt20__uninitialized_copyILb0EE13__uninit_copyISt15_Deque_iteratorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS8_PS9_ES2_IS8_RS8_PS8_EEET0_T_SH_SG_
+  _ZNSt3tr116_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EED2Ev
+  _ZNSt3tr132__enable_shared_from_this_helperILN9__gnu_cxx12_Lock_policyE2EEEvRKNS_14__shared_countIXT_EEEz
+  _ZNSt5dequeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE16_M_push_back_auxERKS5_
+  _ZNSt5dequeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_M_reallocate_mapEmb
+  _ZNSt5dequeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE19_M_destroy_data_auxESt15_Deque_iteratorIS5_RS5_PS5_ESB_
+  _ZNSt5dequeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEC2ERKS7_
+  _ZNSt5dequeIjSaIjEE17_M_reallocate_mapEmb
+  _ZNSt5stackINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt5dequeIS5_SaIS5_EEE4pushERKS5_
+
index a600efe50e2f4b6179cf28fed001d1c8ece8da02..94b973ba98065b4d98fc86656242c533330c1c10 100644 (file)
@@ -1,5 +1,7 @@
 Functions changes summary: 0 Removed, 1 Changed, 2 Added functions
 Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
+Function symbols changes summary: 0 Removed, 1 Added function symbol not referenced by debug info
+Variable symbols changes summary: 0 Removed, 0 Added variable symbol not referenced by debug info
 
 2 Added functions:
 
@@ -16,3 +18,7 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
           'int S::m0', at offset 0 (in bits)
 
 
+1 Added function symbol not referenced by debug info:
+
+  _ZN1SC1Ev
+
index 4254aaa2b7382a6cac376c4a9e1bc062a4d3ddcb..1b8e38d54e9d056c8969e88726162e9ae46f5234 100644 (file)
@@ -471,6 +471,13 @@ InOutSpec in_out_specs[] =
     "data/test-diff-filter/test40-report-0.txt",
     "output/test-diff-filter/test40-report-0.txt",
   },
+  {
+    "data/test-diff-filter/test41-PR21486-abg-writer.gcc.o",
+    "data/test-diff-filter/test41-PR21486-abg-writer.llvm.o",
+    "--no-default-suppression",
+    "data/test-diff-filter/test41-report-0.txt",
+    "output/test-diff-filter/test41-report-0.txt",
+  },
   // This should be the last entry
   {NULL, NULL, NULL, NULL, NULL}
 };
This page took 0.075587 seconds and 5 git commands to generate.