public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: libabigail@sourceware.org
Subject: [PATCH 3/8, applied] ir: Tighten type comparison optimization for Linux kernel binaries
Date: Wed, 11 Aug 2021 18:04:23 +0200	[thread overview]
Message-ID: <87y298c6ig.fsf@redhat.com> (raw)

Hello,

types_defined_same_linux_kernel_corpus_public() performs an
optimization while comparing two types in the context of the Linux
kernel.  If two types of the same kind and name are defined in the
same corpus and in the same file, then they ought to be equal.

For two anonymous classes that have naming typedefs, the function
forgets to ensure that the naming typedefs have the same name.

I have no binary that exhibits the potential issue, but I stumbled
upon the problem while looking at something else that uncovered
the problem.  This change doesn't impact any of the binaries of the
regression suite at the moment, though.

Fixed thus.

	* src/abg-ir.cc (types_defined_same_linux_kernel_corpus_public):
	Ensure that anonymous classes with naming typedefs have identical
	typedef names.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to master.
---
 src/abg-ir.cc | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index 8e00eabf..f7739186 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -13161,6 +13161,16 @@ types_defined_same_linux_kernel_corpus_public(const type_base& t1,
       || (c2 && c2->get_is_anonymous() && !c2->get_naming_typedef()))
     return false;
 
+  // Two anonymous classes with naming typedefs should have the same
+  // typedef name.
+  if (c1
+      && c2
+      && c1->get_is_anonymous() && c1->get_naming_typedef()
+      && c2->get_is_anonymous() && c2->get_naming_typedef())
+    if (c1->get_naming_typedef()->get_name()
+	!= c2->get_naming_typedef()->get_name())
+      return false;
+
   // Two anonymous enum types cannot be eligible to this optimization.
   if (const enum_type_decl *e1 = is_enum_type(&t1))
     if (const enum_type_decl *e2 = is_enum_type(&t2))
-- 
2.30.0


-- 
		Dodji


                 reply	other threads:[~2021-08-11 16:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y298c6ig.fsf@redhat.com \
    --to=dodji@redhat.com \
    --cc=libabigail@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).