]> sourceware.org Git - libabigail.git/commitdiff
Bug 27165 - Better support multi-language binaries
authorDodji Seketeli <dodji@redhat.com>
Tue, 2 Feb 2021 11:35:54 +0000 (12:35 +0100)
committerDodji Seketeli <dodji@redhat.com>
Tue, 2 Feb 2021 15:15:29 +0000 (16:15 +0100)
In some binaries, a DIE named I originating from a compilation unit
written in the C++ language can be an implementation of a DIE named S
(linked through the DW_AT_specification attribute on I) originating
from a compilation unit written in, say, the C language.

In that case, when are we looking at I and try to get the scope of S
(which the DWARF reader considers as the logical scope of I)
get_scope_for_die needs to look at the DW_AT_language attribute
carried by the compilation unit DIE of S.  At the moment, we wrongly
look at the DW_AT_language carried by the compilation unit DIE of I
and we deduce the wrong language (C++ instead of C).

This patch fixes that.

* src/abg-dwarf-reader.cc (get_scope_for_die): Get the language of
the DIE from the compilation unit of the DIE itself.
* tests/data/test-types-stability/PR27165-libzmq.so.5.2.3: New
test input.
* tests/data/test-types-stability/PR27165-libzmq.so.5.2.3.debug:
Debug information for the new test input.
* tests/data/Makefile.am: Add the test inputs above to the source
distribution.
* tests/test-types-stability.cc (elf_paths): Add the new test
inputs to this test harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
src/abg-dwarf-reader.cc
tests/data/Makefile.am
tests/data/test-types-stability/PR27165-libzmq.so.5.2.3 [new file with mode: 0755]
tests/data/test-types-stability/PR27165-libzmq.so.5.2.3.debug [new file with mode: 0755]
tests/test-types-stability.cc

index 761af3ec8ab64cd83840d998182dc20bfbcf6209..13f1fe61cd95ccaf129f13eb62fe69f2a2abb6c9 100644 (file)
@@ -12777,7 +12777,9 @@ get_scope_for_die(read_context& ctxt,
 {
   const die_source source_of_die = ctxt.get_die_source(die);
 
-  if (is_c_language(ctxt.cur_transl_unit()->get_language()))
+  translation_unit::language die_lang = translation_unit::LANG_UNKNOWN;
+  ctxt.get_die_language(die, die_lang);
+  if (is_c_language(die_lang))
     {
       ABG_ASSERT(dwarf_tag(die) != DW_TAG_member);
       return ctxt.global_scope();
index e1354534c544b5b40d71e7fbf3deb57f989bca4c..40ad0e44a3b30280dd497bdb9b82b068e83a8bc4 100644 (file)
@@ -569,6 +569,8 @@ test-types-stability/pr19433-custom0 \
 test-types-stability/pr19141-get5d.o \
 test-types-stability/pr19142-topo.o \
 test-types-stability/pr19204-libtcmalloc.so.4.2.6-xlc \
+test-types-stability/PR27165-libzmq.so.5.2.3 \
+test-types-stability/PR27165-libzmq.so.5.2.3.debug \
 \
 test-diff-filter/test0-v0.cc           \
 test-diff-filter/test0-v1.cc           \
diff --git a/tests/data/test-types-stability/PR27165-libzmq.so.5.2.3 b/tests/data/test-types-stability/PR27165-libzmq.so.5.2.3
new file mode 100755 (executable)
index 0000000..9e942da
Binary files /dev/null and b/tests/data/test-types-stability/PR27165-libzmq.so.5.2.3 differ
diff --git a/tests/data/test-types-stability/PR27165-libzmq.so.5.2.3.debug b/tests/data/test-types-stability/PR27165-libzmq.so.5.2.3.debug
new file mode 100755 (executable)
index 0000000..d8a5f7a
Binary files /dev/null and b/tests/data/test-types-stability/PR27165-libzmq.so.5.2.3.debug differ
index 22a85e646de918b866c4ce98290b8de793e473dc..1d173ade3441a24be2becd075e07a4ac2d7bd1e7 100644 (file)
@@ -48,6 +48,7 @@ const char* elf_paths[] =
   "data/test-types-stability/pr19141-get5d.o",
   "data/test-types-stability/pr19142-topo.o",
   "data/test-types-stability/pr19204-libtcmalloc.so.4.2.6-xlc",
+  "data/test-types-stability/PR27165-libzmq.so.5.2.3",
   // The below should always be the last element of array.
   0
 };
This page took 0.106978 seconds and 5 git commands to generate.