public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 3/8, applied] ir: Tighten type comparison optimization for Linux kernel binaries
@ 2021-08-11 16:04 Dodji Seketeli
  0 siblings, 0 replies; only message in thread
From: Dodji Seketeli @ 2021-08-11 16:04 UTC (permalink / raw)
  To: libabigail

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-11 16:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11 16:04 [PATCH 3/8, applied] ir: Tighten type comparison optimization for Linux kernel binaries Dodji Seketeli

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).