[applied] dwarf-reader: Fix support of suppression specifications

Message ID 87ed67o7bi.fsf@redhat.com
State New
Headers
Series [applied] dwarf-reader: Fix support of suppression specifications |

Commit Message

Dodji Seketeli Aug. 29, 2024, 12:13 p.m. UTC
  Hello,

While looking at something else, I realized that when functions and
variables are to be dropped on the floor by a suppression
specification, there are time where the function is suppressed but not
dropped from the ABI corpus.  This is due to some thinkos in the DWARF
reader code.  Fixed thus.

	* src/abg-dwarf-reader.cc (function_is_suppressed)
	(variable_is_suppressed): Do not return too early when the
	function doesn't seem suppressed, yet.
	* tests/data/test-diff-suppr/test31-report-0.txt: Adjust.
	* tests/data/test-diff-suppr/test32-report-1.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
 src/abg-dwarf-reader.cc                        | 16 ++++++++--------
 tests/data/test-diff-suppr/test31-report-0.txt |  3 ---
 tests/data/test-diff-suppr/test32-report-1.txt |  2 +-
 3 files changed, 9 insertions(+), 12 deletions(-)
  

Patch

diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index a95deafd..fae41ccb 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -15247,8 +15247,8 @@  function_is_suppressed(const reader& rdr,
 	rdr.function_symbol_is_exported(fn_addr);
       if (!symbol)
 	return true;
-      if (!symbol->is_suppressed())
-	return false;
+      if (symbol->is_suppressed())
+	return true;
 
       // Since there is only one symbol in DWARF associated with an elf_symbol,
       // we can assume this is the main symbol then. Otherwise the main hinting
@@ -15257,8 +15257,8 @@  function_is_suppressed(const reader& rdr,
       if (symbol->has_aliases())
 	for (elf_symbol_sptr a = symbol->get_next_alias();
 	     !a->is_main_symbol(); a = a->get_next_alias())
-	  if (!a->is_suppressed())
-	    return false;
+	  if (a->is_suppressed())
+	    return true;
     }
 
   return suppr::is_function_suppressed(rdr, qualified_name, flinkage_name,
@@ -15427,8 +15427,8 @@  variable_is_suppressed(const reader&		rdr,
 	rdr.variable_symbol_is_exported(var_addr);
       if (!symbol)
 	return true;
-      if (!symbol->is_suppressed())
-	return false;
+      if (symbol->is_suppressed())
+	return true;
 
       // Since there is only one symbol in DWARF associated with an elf_symbol,
       // we can assume this is the main symbol then. Otherwise the main hinting
@@ -15437,8 +15437,8 @@  variable_is_suppressed(const reader&		rdr,
       if (symbol->has_aliases())
 	for (elf_symbol_sptr a = symbol->get_next_alias();
 	     !a->is_main_symbol(); a = a->get_next_alias())
-	  if (!a->is_suppressed())
-	    return false;
+	  if (a->is_suppressed())
+	    return true;
     }
 
   return suppr::is_variable_suppressed(rdr,
diff --git a/tests/data/test-diff-suppr/test31-report-0.txt b/tests/data/test-diff-suppr/test31-report-0.txt
index 9666a8fd..e69de29b 100644
--- a/tests/data/test-diff-suppr/test31-report-0.txt
+++ b/tests/data/test-diff-suppr/test31-report-0.txt
@@ -1,3 +0,0 @@ 
-Functions changes summary: 0 Removed, 0 Changed (1 filtered out), 0 Added function
-Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
-
diff --git a/tests/data/test-diff-suppr/test32-report-1.txt b/tests/data/test-diff-suppr/test32-report-1.txt
index e416a088..7265951d 100644
--- a/tests/data/test-diff-suppr/test32-report-1.txt
+++ b/tests/data/test-diff-suppr/test32-report-1.txt
@@ -1,4 +1,4 @@ 
-Functions changes summary: 0 Removed, 1 Changed (1 filtered out), 0 Added functions
+Functions changes summary: 0 Removed, 1 Changed, 0 Added function
 Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
 
 1 function with some indirect sub-type change: