mirror of
git://sourceware.org/git/libabigail.git
synced 2025-03-11 09:08:04 +00:00
The path of a translation unit is relative to the directory where that translation unit was compiled. So there can be several different translation units (in the same binary) that have the same (relative) paths. To tell them apart, one needs to consider the compile directory of those translation units. But then Libabigail ignores the compilation directory of translation units. It just considers their (relative) path. That leads to different translation units having the same path. Furthermore, there can be a translation unit with full path (one that takes into account the file name and its compile directory) named "P" that contains function definitions f1 and f2, as described by the debug info. Further down the road, there can be *another* translation unit which also has "P" as its full path, and that cotnains function definitions f3 and f4. A way to understand is to consider that the translation unit of full path "P" contains f1, f2, f3 and f4. This patch introduces the concept of the compile dir of a given translation unit, and the concept of the absolute path of the translation unit which would then be a concatenation of the compile dir and relative paths of the translation unit. The patch also tries to reuse a translation unit with a given path, *if* that translation unit has already been seen in the current binary, instead of creating a new one altogether. This patch doesn't carry a regression test as the problem was found while running the https://pagure.io/libabigail-selfcheck/blob/master/f/selfcheck.py script over the Fedora 25 critpath packages. The patch does however update existing reference outputs of existings tests where appropriate. * include/abg-ir.h (translation_unit::{get_compilation_dir_path, set_compilation_dir_path, get_absolute_path}): * src/abg-corpus.cc (corpus::add): Use the new translation_unit::get_absolute_path() as the key for the tu path -> tu map. * src/abg-dwarf-reader.cc (read_context::resolve_declaration_only_classes): Use the new translation_unit::get_absolute_path(). (build_translation_unit_and_add_to_ir): Set the compilation directory of the translation unit. * src/abg-ir-priv.h (translation_unit::priv::{comp_dir_path_, abs_path_}): * src/abg-ir.cc (translation_unit::set_path): Update comment. (translation_unit::{get_compilation_dir_path, set_compilation_dir_path, get_absolute_path}): Define new member functions. * src/abg-reader.cc (read_translation_unit): Take the new 'comp-dir-path' attribute into account. * src/abg-writer.cc (write_translation_unit): Emit the new 'comp-dir-path' attribute. * tests/data/test-annotate/libtest23.so.abi: Adjust. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Adjust. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Adjust. * tests/data/test-annotate/test0.abi: Adjust. * tests/data/test-annotate/test1.abi: Adjust. * tests/data/test-annotate/test13-pr18894.so.abi: Adjust. * tests/data/test-annotate/test14-pr18893.so.abi: Adjust. * tests/data/test-annotate/test15-pr18892.so.abi: Adjust. * tests/data/test-annotate/test17-pr19027.so.abi: Adjust. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Adjust. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Adjust. * tests/data/test-annotate/test2.so.abi: Adjust. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Adjust. * tests/data/test-annotate/test21-pr19092.so.abi: Adjust. * tests/data/test-annotate/test3.so.abi: Adjust. * tests/data/test-annotate/test4.so.abi: Adjust. * tests/data/test-annotate/test5.o.abi: Adjust. * tests/data/test-annotate/test6.so.abi: Adjust. * tests/data/test-annotate/test7.so.abi: Adjust. * tests/data/test-annotate/test8-qualified-this-pointer.so.abi: Adjust. * tests/data/test-read-dwarf/libtest23.so.abi: Adjust. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Adjust. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Adjust. * tests/data/test-read-dwarf/test0.abi: Adjust. * tests/data/test-read-dwarf/test1.abi: Adjust. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Adjust. * tests/data/test-read-dwarf/test11-pr18828.so.abi: Adjust. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Adjust. * tests/data/test-read-dwarf/test13-pr18894.so.abi: Adjust. * tests/data/test-read-dwarf/test14-pr18893.so.abi: Adjust. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Adjust. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Adjust. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Adjust. * tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Adjust. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Adjust. * tests/data/test-read-dwarf/test2.so.abi: Adjust. * tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Adjust. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Adjust. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Adjust. * tests/data/test-read-dwarf/test3.so.abi: Adjust. * tests/data/test-read-dwarf/test4.so.abi: Adjust. * tests/data/test-read-dwarf/test5.o.abi: Adjust. * tests/data/test-read-dwarf/test6.so.abi: Adjust. * tests/data/test-read-dwarf/test7.so.abi: Adjust. * tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi: Adjust. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
29 lines
1.6 KiB
Plaintext
29 lines
1.6 KiB
Plaintext
<abi-corpus architecture='elf-amd-x86_64' soname='test3.so.1'>
|
|
<elf-needed>
|
|
<dependency name='libc.so.6'/>
|
|
</elf-needed>
|
|
<elf-function-symbols>
|
|
<!-- __foo -->
|
|
<elf-symbol name='__foo' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
|
<!-- __foo__ -->
|
|
<elf-symbol name='__foo__' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
|
<!-- _fini -->
|
|
<elf-symbol name='_fini' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
|
<!-- _init -->
|
|
<elf-symbol name='_init' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
|
<!-- foo -->
|
|
<elf-symbol name='foo' type='func-type' binding='weak-binding' visibility='default-visibility' alias='foo__,__foo__,__foo' is-defined='yes'/>
|
|
<!-- foo__ -->
|
|
<elf-symbol name='foo__' type='func-type' binding='weak-binding' visibility='default-visibility' is-defined='yes'/>
|
|
</elf-function-symbols>
|
|
<abi-instr version='1.0' address-size='64' path='test3.c' comp-dir-path='/home/skumari/Tasks/source_repo/dodji/libabigail/tests/data/test-read-dwarf' language='LANG_C89'>
|
|
<!-- void -->
|
|
<type-decl name='void' id='type-id-1'/>
|
|
<!-- void __foo() -->
|
|
<function-decl name='__foo' mangled-name='foo' filepath='/home/skumari/Tasks/source_repo/dodji/libabigail/tests/data/test-read-dwarf/test3.c' line='8' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='foo'>
|
|
<!-- void -->
|
|
<return type-id='type-id-1'/>
|
|
</function-decl>
|
|
</abi-instr>
|
|
</abi-corpus>
|