Bug 25095 - Apply symbol white lists to ELF symbols
authorDodji Seketeli <dodji@redhat.com>
Fri, 18 Oct 2019 09:16:38 +0000 (11:16 +0200)
committerDodji Seketeli <dodji@redhat.com>
Fri, 8 Nov 2019 10:04:11 +0000 (11:04 +0100)
Right now, the symbol names that are part of a Linux Kernel ABI
white list are matched against function and variable names that appear
in the DWARF information.

In other words, when Libabigail processes the Linux Kernel ABI
whitelist, it generates a suppression specifications which keeps
functions and variables (as described by DWARF) whose names match the
symbol names specified in the white list.  All other functions and
variables are dropped.  But that doesn't apply to ELF symbols.
Libabigail generates no suppression at all for ELF symbols.  It only
considers variables and functions described in the debug information.

With this patch, Libabiagil now generates a suppression specification
which keeps functions and variables whose ELF symbol name match the
symbol names specified in the whitelist.  The suppression
specification also drops ELF symbols whose name don't match the names
specified in the white list.

Note that this patch uses the previous commit which description is:
    "Support symbol_name_not_regexp in [suppress_{function, variable}]"

* src/abg-tools-utils.cc (gen_suppr_spec_from_kernel_abi_whitelist):
Generate a suppression specification which considers the name of
the symbol associated to a function/variable, rather than just the
name of said function/variable.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
src/abg-tools-utils.cc

index f7349ec82b7e10aa1bc5876515ae0522c28c2861..377f313cd77851c072e3a07078fd5e3e7ee96d59 100644 (file)
@@ -1943,9 +1943,14 @@ gen_suppr_spec_from_kernel_abi_whitelist(const string& abi_whitelist_path,
 
       if (!function_names_regexp.empty())
        {
+         // Build a suppression specification which *keeps* functions
+         // whose ELF symbols match the regular expression contained
+         // in function_names_regexp.  This will also keep the ELF
+         // symbols (not designated by any debug info) whose names
+         // match this regexp.
          fn_suppr.reset(new function_suppression);
          fn_suppr->set_label(section_name);
-         fn_suppr->set_name_not_regex_str(function_names_regexp);
+         fn_suppr->set_symbol_name_not_regex_str(function_names_regexp);
          fn_suppr->set_drops_artifact_from_ir(true);
          supprs.push_back(fn_suppr);
          created_a_suppr = true;
@@ -1953,9 +1958,14 @@ gen_suppr_spec_from_kernel_abi_whitelist(const string& abi_whitelist_path,
 
       if (!variable_names_regexp.empty())
        {
+         // Build a suppression specification which *keeps* variables
+         // whose ELF symbols match the regular expression contained
+         // in function_names_regexp.  This will also keep the ELF
+         // symbols (not designated by any debug info) whose names
+         // match this regexp.
          var_suppr.reset(new variable_suppression);
          var_suppr->set_label(section_name);
-         var_suppr->set_name_not_regex_str(variable_names_regexp);
+         var_suppr->set_symbol_name_not_regex_str(variable_names_regexp);
          var_suppr->set_drops_artifact_from_ir(true);
          supprs.push_back(var_suppr);
          created_a_suppr = true;