libabigail/tests/data/test-read-dwarf
Dodji Seketeli 95c53c89f3 dwarf-reader: Avoid having several functions with the same symbol
In the DWARF debug info, a C++ class can be represented by pieces
throughout a given binary.

In this picture, a given virtual member function can be represented
several times; each time in one different piece of the C++ class.  In
a given piece of the class, a virtual member function can be
represented with its ELF symbol set.  In another one, the same virtual
member function can be represented without that ELF symbol set.  And
there can also be pieces of the class that don't have a given virtual
function.

To handle this, the DWARF reader constructs one class from all its
pieces scattered around.  It adds each virtual member function to the
class as it comes across them while scanning the DWARF.

Then there is a pass at the end of the process that sets ELF symbols
to the (virtual) member functions that need it.

The problem with that pass is that it sometimes sets the same ELF
symbol to more than one virtual member function.  Those virtual member
functions all have the same mangled name that correspond to the ELF
symbol; but only one of them is meant to be associated with the ELF
symbol.  In essence, that one is the one that is exported by the ELF
binary.

This patch teaches the pass that sets the ELF symbols of function to
avoid setting the same ELF symbol to more than one function.

The patch also avoids build_function_decl to set symbol to a function
if that symbol was already set to an existing function.

This patch thus fixes a class of issues what arise when comparing a
binary against its own ABIXML representation.  Those several functions
having the same ELF symbol would cause spurious changes in that
context.

	* src/abg-dwarf-reader.cc
	(read_context::symbol_already_belongs_to_a_function): Define new
	member function.
	(read_context::fixup_functions_with_no_symbols): Use the new
	symbol_already_belongs_to_a_function function to avoid setting a
	symbol that already belongs to a function.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Adjust.
	* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
	* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
	* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
	Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-11-27 16:56:25 +01:00
..
PR26261 Bug 26769 - Fix missing types in abixml output 2020-11-23 13:02:34 +01:00
libtest23.so Support DW_TAG_type_unit 2016-07-26 20:07:03 +02:00
libtest23.so.abi ir: Introduce internal pretty representation for anonymous classes 2020-11-27 13:53:15 +01:00
libtest24-drop-fns-2.so.abi Bug 26769 - Fix missing types in abixml output 2020-11-23 13:02:34 +01:00
libtest24-drop-fns.so Drop suppressed ABI artifacts from the IR 2016-09-21 18:35:08 +02:00
libtest24-drop-fns.so.abi Bug 26769 - Fix missing types in abixml output 2020-11-23 13:02:34 +01:00
PR22015-libboost_iostreams.so Bug 22015 - Failing to return global scope of a DIE in certain cases 2017-08-28 12:13:32 +02:00
PR22015-libboost_iostreams.so.abi Bug 26769 - Fix missing types in abixml output 2020-11-23 13:02:34 +01:00
PR22122-libftdc.so Bug 22122 - Fail to represent 'const array' 2017-09-11 18:07:02 +02:00
PR22122-libftdc.so.abi dwarf-reader: Avoid having several functions with the same symbol 2020-11-27 16:56:25 +01:00
PR24378-fn-is-not-scope.abi Serialize canonical types to avoid testing if types have been emitted 2019-09-17 17:52:26 +02:00
PR24378-fn-is-not-scope.o Bug 24378 - DW_TAG_subroutine_type as a DIE scope causes infinite loop 2019-03-25 14:46:31 +01:00
PR25007-sdhci.ko Bug 25007 - Don't use section-relative symbol values on ET_REL binaries 2019-09-20 14:13:12 +02:00
PR25007-sdhci.ko.abi Improve enum synthetic type names 2020-11-02 17:37:42 +01:00
PR25042-libgdbm-clang-dwarf5.so.6.0.0 PR25042 - Support string form DW_FORM_strx{1,4} from DWARF 5 2019-10-01 14:14:41 +02:00
PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi Bug 26769 - Fix missing types in abixml output 2020-11-23 13:02:34 +01:00
test0 Tweak dwarf reading test to detect more namespace linking-fu 2014-01-13 17:36:20 +01:00
test0.abi Bug 26769 - Fix missing types in abixml output 2020-11-23 13:02:34 +01:00
test0.cc Tweak dwarf reading test to detect more namespace linking-fu 2014-01-13 17:36:20 +01:00
test0.hash.abi Bug 26769 - Fix missing types in abixml output 2020-11-23 13:02:34 +01:00
test1 Add regression tests for dwarf reading 2014-01-07 15:51:52 +01:00
test1.abi abg-writer.cc: Fix indentation of XML output 2020-07-28 17:07:03 +02:00
test1.cc Add regression tests for dwarf reading 2014-01-07 15:51:52 +01:00
test1.hash.abi abg-writer.cc: Fix indentation of XML output 2020-07-28 17:07:03 +02:00
test2-0.cc Initial support for DW_TAG_partial_unit 2014-05-19 17:26:40 +02:00
test2-1.cc Initial support for DW_TAG_partial_unit 2014-05-19 17:26:40 +02:00
test2.h Initial support for DW_TAG_partial_unit 2014-05-19 17:26:40 +02:00
test2.so Initial support for DW_TAG_partial_unit 2014-05-19 17:26:40 +02:00
test2.so.abi Serialize canonical types to avoid testing if types have been emitted 2019-09-17 17:52:26 +02:00
test2.so.hash.abi abg-writer: Add support for stable hash type ids. 2020-06-16 10:13:01 +02:00
test3.c Keep symbol's multiple aliases within single attribute separated by comma 2014-06-20 11:56:49 +02:00
test3.so Keep symbol's multiple aliases within single attribute separated by comma 2014-06-20 11:56:49 +02:00
test3.so.abi Bug 21627 - Libabigail doesn't consider translation unit compile dir 2017-07-04 16:35:35 +02:00
test3.so.hash.abi abg-writer: Add support for stable hash type ids. 2020-06-16 10:13:01 +02:00
test4.c Handle C99 restrict qualifier and DWARFv3 DW_TAG_restrict_type. 2014-06-23 15:55:37 +02:00
test4.so Handle C99 restrict qualifier and DWARFv3 DW_TAG_restrict_type. 2014-06-23 15:55:37 +02:00
test4.so.abi Serialize canonical types to avoid testing if types have been emitted 2019-09-17 17:52:26 +02:00
test4.so.hash.abi abg-writer: Add support for stable hash type ids. 2020-06-16 10:13:01 +02:00
test5.cc Support reading void* type from DWARF 2014-06-23 17:31:26 +02:00
test5.o Support reading void* type from DWARF 2014-06-23 17:31:26 +02:00
test5.o.abi Bug 21627 - Libabigail doesn't consider translation unit compile dir 2017-07-04 16:35:35 +02:00
test5.o.hash.abi abg-writer: Add support for stable hash type ids. 2020-06-16 10:13:01 +02:00
test6.cc Consider symbols with STB_GNU_UNIQUE binding as public 2014-07-08 14:18:36 +02:00
test6.so Consider symbols with STB_GNU_UNIQUE binding as public 2014-07-08 14:18:36 +02:00
test6.so.abi Serialize canonical types to avoid testing if types have been emitted 2019-09-17 17:52:26 +02:00
test6.so.hash.abi abg-writer: Add support for stable hash type ids. 2020-06-16 10:13:01 +02:00
test7.cc Support C and C++ array type. 2014-08-22 13:07:41 +02:00
test7.so Support C and C++ array type. 2014-08-22 13:07:41 +02:00
test7.so.abi abg-writer.cc: Clean up new line emission. 2020-07-09 19:10:12 +02:00
test7.so.hash.abi abg-writer.cc: Clean up new line emission. 2020-07-09 19:10:12 +02:00
test8-qualified-this-pointer.cc Yet another fix to the DWARF method "static-ness" detection heuristic 2014-10-16 23:49:41 +02:00
test8-qualified-this-pointer.so Yet another fix to the DWARF method "static-ness" detection heuristic 2014-10-16 23:49:41 +02:00
test8-qualified-this-pointer.so.abi Serialize canonical types to avoid testing if types have been emitted 2019-09-17 17:52:26 +02:00
test8-qualified-this-pointer.so.hash.abi abg-writer: Add support for stable hash type ids. 2020-06-16 10:13:01 +02:00
test9-pr18818-clang.so Bug 18818 - abidw aborts on a class with a non-complete base class 2015-08-14 16:22:14 +02:00
test9-pr18818-clang.so.abi ir: Introduce internal pretty representation for anonymous classes 2020-11-27 13:53:15 +01:00
test10-pr18818-gcc.so Bug 18818 - abidw aborts on a class with a non-complete base class 2015-08-14 16:22:14 +02:00
test10-pr18818-gcc.so.abi dwarf-reader: Avoid having several functions with the same symbol 2020-11-27 16:56:25 +01:00
test11-pr18828.so Bug 18828 - Handle force-resolving of multiple declarations-only of the same type 2015-08-15 00:26:39 +02:00
test11-pr18828.so.abi ir: Introduce internal pretty representation for anonymous classes 2020-11-27 13:53:15 +01:00
test12-pr18844.so Bug 18844 - assert failure in abidw at abg-dwarf-reader.cc:6537 2015-08-18 12:33:57 +02:00
test12-pr18844.so.abi ir: Introduce internal pretty representation for anonymous classes 2020-11-27 13:53:15 +01:00
test13-pr18894.so Bug 18894 - Fix representation of enumerators in abixml format 2015-08-29 17:17:48 +02:00
test13-pr18894.so.abi writer: Emit definitions of declarations when they are present 2020-11-27 13:53:15 +01:00
test14-pr18893.so Bug 18893 - type degradation from dwarf to abixml on libGLU.so 2015-08-30 17:11:36 +02:00
test14-pr18893.so.abi Bug 26769 - Fix missing types in abixml output 2020-11-23 13:02:34 +01:00
test15-pr18892.so Bug 18892 - type degradation from DWARF to abixml on libtsan.so 2015-08-30 17:56:19 +02:00
test15-pr18892.so.abi writer: Emit definitions of declarations when they are present 2020-11-27 13:53:15 +01:00
test16-pr18904.so More type degradation fixes (from DWARF to abixml) 2015-09-02 14:15:58 +02:00
test16-pr18904.so.abi dwarf-reader: Avoid having several functions with the same symbol 2020-11-27 16:56:25 +01:00
test17-pr19027.so Bug 19027 - ABI asymmetry with enums over INT_MAX 2015-10-01 11:40:52 +02:00
test17-pr19027.so.abi Bug 26769 - Fix missing types in abixml output 2020-11-23 13:02:34 +01:00
test18-pr19037-libvtkRenderingLIC-6.1.so Bug 19037 - Make ABI corpus support several functions with same symbol 2015-10-06 13:32:12 +02:00
test18-pr19037-libvtkRenderingLIC-6.1.so.abi Bug 26769 - Fix missing types in abixml output 2020-11-23 13:02:34 +01:00
test19-pr19023-libtcmalloc_and_profiler.so Bug 19023 - Type canonicalization is sensitive to struct-ness 2015-10-07 00:41:32 +02:00
test19-pr19023-libtcmalloc_and_profiler.so.abi Bug 26769 - Fix missing types in abixml output 2020-11-23 13:02:34 +01:00
test20-pr19025-libvtkParallelCore-6.1.so Bug 19025 - abixml writer forgets to emit some member types 2015-10-08 13:50:49 +02:00
test20-pr19025-libvtkParallelCore-6.1.so.abi Bug 26769 - Fix missing types in abixml output 2020-11-23 13:02:34 +01:00
test21-pr19092.so Bug 19092 - abidw aborts on types that violate the ODR 2015-10-15 16:22:14 +02:00
test21-pr19092.so.abi writer: Emit definitions of declarations when they are present 2020-11-27 13:53:15 +01:00
test22-pr19097-libstdc++.so.6.0.17.so Adjust regression tests reference output for the current patch set 2015-10-17 16:18:36 +02:00
test22-pr19097-libstdc++.so.6.0.17.so.abi dwarf-reader: Avoid having several functions with the same symbol 2020-11-27 16:56:25 +01:00
test23-first-tu.cc Support DW_TAG_type_unit 2016-07-26 20:07:03 +02:00
test23-second-tu.cc Support DW_TAG_type_unit 2016-07-26 20:07:03 +02:00
test24-drop-fns-0.suppr Drop suppressed ABI artifacts from the IR 2016-09-21 18:35:08 +02:00
test24-drop-fns.cc Drop suppressed ABI artifacts from the IR 2016-09-21 18:35:08 +02:00
test25-bogus-binary.elf dwarf-reader: handle symtab.section_header.sh_entsize == 0 2020-01-24 22:53:30 +00:00
test26-bogus-binary.elf dwarf-reader: handle binaries with missing symtab 2020-01-25 21:40:14 +00:00
test27-bogus-binary.elf dwarf-reader: remove superfluous ABG_ASSERT 2020-03-18 23:10:14 +01:00
test-libandroid.so dwarf-reader: Ignore zero length location expressions from DW_AT_location 2020-11-02 18:07:01 +01:00
test-libandroid.so.abi ir: Introduce internal pretty representation for anonymous classes 2020-11-27 13:53:15 +01:00
test-PR26568-1.c Bug 26568 - Union should support more than one anonymous member 2020-09-18 16:32:49 +02:00
test-PR26568-1.o Bug 26568 - Union should support more than one anonymous member 2020-09-18 16:32:49 +02:00
test-PR26568-1.o.abi Bug 26568 - Union should support more than one anonymous member 2020-09-18 16:32:49 +02:00
test-PR26568-2.c Bug 26568 - Union should support more than one anonymous member 2020-09-18 16:32:49 +02:00
test-PR26568-2.o Bug 26568 - Union should support more than one anonymous member 2020-09-18 16:32:49 +02:00
test-PR26568-2.o.abi Bug 26568 - Union should support more than one anonymous member 2020-09-18 16:32:49 +02:00