From: Dodji Seketeli Date: Fri, 18 Oct 2019 09:16:38 +0000 (+0200) Subject: Bug 25095 - Apply symbol white lists to ELF symbols X-Git-Tag: upstream/1.7~40 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6148ec50101e54473975a02d504acf84cc100361;p=platform%2Fupstream%2Flibabigail.git Bug 25095 - Apply symbol white lists to ELF symbols 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 --- diff --git a/src/abg-tools-utils.cc b/src/abg-tools-utils.cc index f7349ec8..377f313c 100644 --- a/src/abg-tools-utils.cc +++ b/src/abg-tools-utils.cc @@ -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;