]> sourceware.org Git - libabigail.git/commit
Bug 21627 - Libabigail doesn't consider translation unit compile dir
authorDodji Seketeli <dodji@redhat.com>
Thu, 22 Jun 2017 10:16:42 +0000 (12:16 +0200)
committerDodji Seketeli <dodji@redhat.com>
Tue, 4 Jul 2017 14:35:35 +0000 (16:35 +0200)
commit90919fceeb001c71ed7797138b5dffe5ec94be45
tree64c40521d8f5e792f749e67c97280e5dbcf4fd13
parent229bdba7e4db83a01095f27687893dff36d3d929
Bug 21627 - Libabigail doesn't consider translation unit compile dir

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>
53 files changed:
include/abg-ir.h
src/abg-corpus.cc
src/abg-dwarf-reader.cc
src/abg-ir-priv.h
src/abg-ir.cc
src/abg-reader.cc
src/abg-writer.cc
tests/data/test-annotate/libtest23.so.abi
tests/data/test-annotate/libtest24-drop-fns-2.so.abi
tests/data/test-annotate/libtest24-drop-fns.so.abi
tests/data/test-annotate/test0.abi
tests/data/test-annotate/test1.abi
tests/data/test-annotate/test13-pr18894.so.abi
tests/data/test-annotate/test14-pr18893.so.abi
tests/data/test-annotate/test15-pr18892.so.abi
tests/data/test-annotate/test17-pr19027.so.abi
tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi
tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi
tests/data/test-annotate/test2.so.abi
tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi
tests/data/test-annotate/test21-pr19092.so.abi
tests/data/test-annotate/test3.so.abi
tests/data/test-annotate/test4.so.abi
tests/data/test-annotate/test5.o.abi
tests/data/test-annotate/test6.so.abi
tests/data/test-annotate/test7.so.abi
tests/data/test-annotate/test8-qualified-this-pointer.so.abi
tests/data/test-read-dwarf/libtest23.so.abi
tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi
tests/data/test-read-dwarf/libtest24-drop-fns.so.abi
tests/data/test-read-dwarf/test0.abi
tests/data/test-read-dwarf/test1.abi
tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi
tests/data/test-read-dwarf/test11-pr18828.so.abi
tests/data/test-read-dwarf/test12-pr18844.so.abi
tests/data/test-read-dwarf/test13-pr18894.so.abi
tests/data/test-read-dwarf/test14-pr18893.so.abi
tests/data/test-read-dwarf/test15-pr18892.so.abi
tests/data/test-read-dwarf/test16-pr18904.so.abi
tests/data/test-read-dwarf/test17-pr19027.so.abi
tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi
tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi
tests/data/test-read-dwarf/test2.so.abi
tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi
tests/data/test-read-dwarf/test21-pr19092.so.abi
tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi
tests/data/test-read-dwarf/test3.so.abi
tests/data/test-read-dwarf/test4.so.abi
tests/data/test-read-dwarf/test5.o.abi
tests/data/test-read-dwarf/test6.so.abi
tests/data/test-read-dwarf/test7.so.abi
tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi
tests/data/test-read-dwarf/test9-pr18818-clang.so.abi
This page took 0.044926 seconds and 5 git commands to generate.