From patchwork Wed Jan 27 12:58:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Matthias_M=C3=A4nnich?= X-Patchwork-Id: 41852 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 47D09397282F; Wed, 27 Jan 2021 12:59:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47D09397282F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1611752395; bh=yslD7cs6nxPwp91DV1NQNTy50lCPs3G2eO50UZ9NJDY=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=t8uj8CbUSLGkiENcOoZGARoZO/lMfFDNzZCSwTZeXgyAH8lo/LdCfpXMFm+5p/6br DztyJCZdxCQ1Uxlw4R9u1tSKiIZLnoodI0zXI/fo1YsbmVT2KA/TM8AWPmyMCZHUK6 jIWGfpolJipXLnUeqyMd/oLYbtMdVlHj19K1r4Ak= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by sourceware.org (Postfix) with ESMTPS id 386513972827 for ; Wed, 27 Jan 2021 12:59:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 386513972827 Received: by mail-qv1-xf4a.google.com with SMTP id l3so1229995qvz.12 for ; Wed, 27 Jan 2021 04:59:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc:content-transfer-encoding; bh=yslD7cs6nxPwp91DV1NQNTy50lCPs3G2eO50UZ9NJDY=; b=f8Vhae/2sLWS14tT9mxWW4gNqKYgew3VAcCYh17EPrx2z7jBZiKhQYclNvdhseIhka zgItcLUHkDCt0E7jKPJYd4PYXbgBYJzdEEth0s45l7DZbRPrgXzR5vIRGLXZWApWjc1P HS/1NNjyf1UJVHQ9LKveLcqtq/X2kynrygMV9zMNQh6i9dFu6kwC3+lc9gUWjnpn9AJO pamVegU+f0ZqQuK0oG3e9RAfrCUumI/NI62DTgdPmyDtriOzO1mjmTqzjCZcxGol+iVW bf892Llm+CH+JmVE8I91AguF3bAErF1OjyaeI8Ari/uq4HYSOMEf5hz1KUmgtYiDfCf2 WPEA== X-Gm-Message-State: AOAM530q8mB6bGzQTafjMJYxS56yBBDwcLgCqS2QAZOTorcLT1ngrqUT DUojOTBTUmGFzChLI23GrKjeCJmTugUNZP2FnzRIRizIS6FVh0Vh4aZraBzxVYoR7KtvfcOgsNq yYV9g4jgm++xppN/x4O/1OS6RUNIWxVqI0sT4j2saZjXBYIMoP/XhYYfT20DwyJzOx0356+E= X-Google-Smtp-Source: ABdhPJw0FNviFvQFbqsooKA77/MoEBixaFwhs+BO2cKqmk12+7sLyaW27MU6NJdl+e4LVQ5DHnTpN1tgH+igMA== X-Received: from lux.lon.corp.google.com ([2a00:79e0:d:210:7220:84ff:fe09:a3aa]) (user=maennich job=sendgmr) by 2002:a0c:fe47:: with SMTP id u7mr10447611qvs.4.1611752387723; Wed, 27 Jan 2021 04:59:47 -0800 (PST) Date: Wed, 27 Jan 2021 12:58:51 +0000 In-Reply-To: <20210127125853.886677-1-maennich@google.com> Message-Id: <20210127125853.886677-19-maennich@google.com> Mime-Version: 1.0 References: <20200619214305.562-1-maennich@google.com> <20210127125853.886677-1-maennich@google.com> X-Mailer: git-send-email 2.30.0.280.ga3ce27912f-goog Subject: [PATCH 18/20] dwarf-reader/writer: consider aliases when dealing with suppressions To: libabigail@sourceware.org X-Spam-Status: No, score=-22.4 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Matthias Maennich via Libabigail From: =?utf-8?q?Matthias_M=C3=A4nnich?= Reply-To: Matthias Maennich Cc: maennich@google.com, kernel-team@android.com Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" When a symbol is suppressed and it happens to be the main symbol of a group of aliased symbols where another symbol is not suppressed, the dwarf reader discards the DWARF information upon reading and the writer will not be able to connect dwarf information to the aliased elf symbol. In order to address this, ensure we are not suppressing symbols (actually functions and variables) for which an alias is not suppressed. We therefore keep the DWARF information even if only a non-main symbol is asked for. Likewise, when the abg-writer is having to attach an elf-symbol-id to the DWARF collected information (for functions and variables), instead of omitting the symbol altogether, rather make use of the property of aliases and connect the dwarf information to an alias instead. This way the function dwarf information stays connected to the elf symbol that we want to track. When reading from XML with a symbol whitelist that leads to suppression of aliased symbols, abidiff would hit an assertion and crash when looking up the aliased symbol due to it being suppressed. In the new symtab reader we can still suppress a symbol without removing it from the lookup. Make use of that property to fix this bug. A test has been added for this as well. * src/abg-dwarf-reader.cc(function_is_suppressed): Do not suppress a function for which there is an alias that is not suppressed. (variable_is_suppressed): Likewise for variables. * src/abg-reader.cc (build_elf_symbol): Improve handling of suppressed aliased symbols when reading from XML. * src/abg-symtab-reader.cc (load): Likewise. * src/abg-writer.cc(write_elf_symbol_reference): Fall back to any aliased symbol if the main symbol is suppressed. * tests/data/Makefile.am: Add new test files. * tests/data/test-abidiff-exit/test-missing-alias-report.txt: New test file. * tests/data/test-abidiff-exit/test-missing-alias.abi: Likewise. * tests/data/test-abidiff-exit/test-missing-alias.suppr: Likewise. * tests/test-abidiff-exit.cc: Add support for whitelists and add new testcase. * tests/data/test-read-dwarf/test-suppressed-alias.c: New test file. * tests/data/test-read-dwarf/test-suppressed-alias.o: Likewise. * tests/data/test-read-dwarf/test-suppressed-alias.o.abi: Likewise. * tests/data/test-read-dwarf/test-suppressed-alias.suppr: Likewise. * tests/data/test-read-dwarf/test3-alias-1.so.hash.abi: Likewise. * tests/data/test-read-dwarf/test3-alias-1.suppr: Likewise. * tests/data/test-read-dwarf/test3-alias-2.so.hash.abi: Likewise. * tests/data/test-read-dwarf/test3-alias-2.suppr: Likewise. * tests/data/test-read-dwarf/test3-alias-3.so.hash.abi: Likewise. * tests/data/test-read-dwarf/test3-alias-3.suppr: Likewise. * tests/data/test-read-dwarf/test3-alias-4.so.hash.abi: Likewise. * tests/data/test-read-dwarf/test3-alias-4.suppr: Likewise. * tests/test-read-dwarf.cc: Add new test cases. Reviewed-by: Giuliano Procida Signed-off-by: Matthias Maennich --- src/abg-dwarf-reader.cc | 30 +- src/abg-reader.cc | 7 +- src/abg-symtab-reader.cc | 14 +- src/abg-writer.cc | 5 +- tests/data/Makefile.am | 15 + .../test-missing-alias-report.txt | 0 .../test-abidiff-exit/test-missing-alias.abi | 12 + .../test-missing-alias.suppr | 4 + .../data/test-diff-suppr/test31-report-0.txt | 3 + .../data/test-diff-suppr/test32-report-1.txt | 2 +- .../test-read-dwarf/libtest24-drop-fns.so.abi | 314 +++++++++--------- .../test-read-dwarf/test-suppressed-alias.c | 16 + .../test-read-dwarf/test-suppressed-alias.o | Bin 0 -> 2848 bytes .../test-suppressed-alias.o.abi | 16 + .../test-suppressed-alias.suppr | 7 + .../test-read-dwarf/test3-alias-1.so.hash.abi | 14 + .../data/test-read-dwarf/test3-alias-1.suppr | 3 + .../test-read-dwarf/test3-alias-2.so.hash.abi | 18 + .../data/test-read-dwarf/test3-alias-2.suppr | 3 + .../test-read-dwarf/test3-alias-3.so.hash.abi | 14 + .../data/test-read-dwarf/test3-alias-3.suppr | 3 + .../test-read-dwarf/test3-alias-4.so.hash.abi | 8 + .../data/test-read-dwarf/test3-alias-4.suppr | 3 + tests/test-abidiff-exit.cc | 11 + tests/test-read-dwarf.cc | 40 +++ 25 files changed, 399 insertions(+), 163 deletions(-) create mode 100644 tests/data/test-abidiff-exit/test-missing-alias-report.txt create mode 100644 tests/data/test-abidiff-exit/test-missing-alias.abi create mode 100644 tests/data/test-abidiff-exit/test-missing-alias.suppr create mode 100644 tests/data/test-read-dwarf/test-suppressed-alias.c create mode 100644 tests/data/test-read-dwarf/test-suppressed-alias.o create mode 100644 tests/data/test-read-dwarf/test-suppressed-alias.o.abi create mode 100644 tests/data/test-read-dwarf/test-suppressed-alias.suppr create mode 100644 tests/data/test-read-dwarf/test3-alias-1.so.hash.abi create mode 100644 tests/data/test-read-dwarf/test3-alias-1.suppr create mode 100644 tests/data/test-read-dwarf/test3-alias-2.so.hash.abi create mode 100644 tests/data/test-read-dwarf/test3-alias-2.suppr create mode 100644 tests/data/test-read-dwarf/test3-alias-3.so.hash.abi create mode 100644 tests/data/test-read-dwarf/test3-alias-3.suppr create mode 100644 tests/data/test-read-dwarf/test3-alias-4.so.hash.abi create mode 100644 tests/data/test-read-dwarf/test3-alias-4.suppr diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index 7d7ffbdc8ebe..37d63b262646 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -13490,8 +13490,21 @@ function_is_suppressed(const read_context& ctxt, if (!ctxt.get_function_address(function_die, fn_addr)) return true; - if (!ctxt.function_symbol_is_exported(fn_addr)) + elf_symbol_sptr symbol = ctxt.function_symbol_is_exported(fn_addr); + if (!symbol) return true; + if (!symbol->is_suppressed()) + return false; + + // 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 + // did not work as expected. + ABG_ASSERT(symbol->is_main_symbol()); + 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; } return suppr::function_is_suppressed(ctxt, qualified_name, @@ -13599,8 +13612,21 @@ variable_is_suppressed(const read_context& ctxt, if (!ctxt.get_variable_address(variable_die, var_addr)) return true; - if (!ctxt.variable_symbol_is_exported(var_addr)) + elf_symbol_sptr symbol = ctxt.variable_symbol_is_exported(var_addr); + if (!symbol) return true; + if (!symbol->is_suppressed()) + return false; + + // 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 + // did not work as expected. + ABG_ASSERT(symbol->is_main_symbol()); + 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; } return suppr::variable_is_suppressed(ctxt, qualified_name, diff --git a/src/abg-reader.cc b/src/abg-reader.cc index 296e1e2115d1..e0269436ee89 100644 --- a/src/abg-reader.cc +++ b/src/abg-reader.cc @@ -2780,7 +2780,8 @@ build_elf_symbol(read_context& ctxt, const xmlNodePtr node, elf_symbol::version version(version_string, is_default_version); - if (drop_if_suppressed && suppr::is_elf_symbol_suppressed(ctxt, name, type)) + const bool is_suppressed = suppr::is_elf_symbol_suppressed(ctxt, name, type); + if (drop_if_suppressed && is_suppressed) return elf_symbol_sptr(); const environment* env = ctxt.get_environment(); @@ -2789,6 +2790,8 @@ build_elf_symbol(read_context& ctxt, const xmlNodePtr node, is_defined, is_common, version, visibility, /*is_linux_string_cst=*/false); + + e->set_is_suppressed(is_suppressed); return e; } @@ -2875,7 +2878,7 @@ build_elf_symbol_db(read_context& ctxt, elf_symbol_sptr sym; for (xmlNodePtr n = node->children; n; n = n->next) { - if ((sym = build_elf_symbol(ctxt, n, /*drop_if_suppress=*/true))) + if ((sym = build_elf_symbol(ctxt, n, /*drop_if_suppress=*/false))) { id_sym_map[sym->get_id_string()] = sym; xml_node_ptr_elf_symbol_map[n] = sym; diff --git a/src/abg-symtab-reader.cc b/src/abg-symtab-reader.cc index a769934e5c05..512fbc20adc0 100644 --- a/src/abg-symtab-reader.cc +++ b/src/abg-symtab-reader.cc @@ -357,16 +357,22 @@ symtab::load_(string_elf_symbols_map_sptr function_symbol_map, if (function_symbol_map) for (const auto& symbol_map_entry : *function_symbol_map) { - symbols_.insert(symbols_.end(), symbol_map_entry.second.begin(), - symbol_map_entry.second.end()); + for (const auto& symbol : symbol_map_entry.second) + { + if (!symbol->is_suppressed()) + symbols_.push_back(symbol); + } ABG_ASSERT(name_symbol_map_.insert(symbol_map_entry).second); } if (variables_symbol_map) for (const auto& symbol_map_entry : *variables_symbol_map) { - symbols_.insert(symbols_.end(), symbol_map_entry.second.begin(), - symbol_map_entry.second.end()); + for (const auto& symbol : symbol_map_entry.second) + { + if (!symbol->is_suppressed()) + symbols_.push_back(symbol); + } ABG_ASSERT(name_symbol_map_.insert(symbol_map_entry).second); } diff --git a/src/abg-writer.cc b/src/abg-writer.cc index d4d5e5531894..c2fdd8f0a043 100644 --- a/src/abg-writer.cc +++ b/src/abg-writer.cc @@ -1728,7 +1728,10 @@ write_elf_symbol_aliases(const elf_symbol& sym, ostream& out) static bool write_elf_symbol_reference(const elf_symbol& sym, ostream& o) { - o << " elf-symbol-id='" << sym.get_id_string() << "'"; + auto actual_sym = &sym; + while (actual_sym->is_suppressed() && actual_sym->has_aliases()) + actual_sym = actual_sym->get_next_alias().get(); + o << " elf-symbol-id='" << actual_sym->get_id_string() << "'"; return true; } diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index d1358c9e9942..83e48cb8ebac 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -197,6 +197,9 @@ test-abidiff-exit/test-non-leaf-array-v0.o \ test-abidiff-exit/test-non-leaf-array-v1.c \ test-abidiff-exit/test-non-leaf-array-v1.o \ test-abidiff-exit/test-non-leaf-array-report.txt \ +test-abidiff-exit/test-missing-alias-report.txt \ +test-abidiff-exit/test-missing-alias.abi \ +test-abidiff-exit/test-missing-alias.suppr \ \ test-diff-dwarf/test0-v0.cc \ test-diff-dwarf/test0-v0.o \ @@ -450,6 +453,14 @@ test-read-dwarf/test3.c \ test-read-dwarf/test3.so \ test-read-dwarf/test3.so.abi \ test-read-dwarf/test3.so.hash.abi \ +test-read-dwarf/test3-alias-1.so.hash.abi \ +test-read-dwarf/test3-alias-1.suppr \ +test-read-dwarf/test3-alias-2.so.hash.abi \ +test-read-dwarf/test3-alias-2.suppr \ +test-read-dwarf/test3-alias-3.so.hash.abi \ +test-read-dwarf/test3-alias-3.suppr \ +test-read-dwarf/test3-alias-4.so.hash.abi \ +test-read-dwarf/test3-alias-4.suppr \ test-read-dwarf/test4.c \ test-read-dwarf/test4.so \ test-read-dwarf/test4.so.abi \ @@ -535,6 +546,10 @@ test-read-dwarf/test-PR26568-1.o.abi \ test-read-dwarf/test-PR26568-2.o.abi \ test-read-dwarf/test-libandroid.so \ test-read-dwarf/test-libandroid.so.abi \ +test-read-dwarf/test-suppressed-alias.c \ +test-read-dwarf/test-suppressed-alias.o \ +test-read-dwarf/test-suppressed-alias.o.abi \ +test-read-dwarf/test-suppressed-alias.suppr \ \ test-annotate/test0.abi \ test-annotate/test1.abi \ diff --git a/tests/data/test-abidiff-exit/test-missing-alias-report.txt b/tests/data/test-abidiff-exit/test-missing-alias-report.txt new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/data/test-abidiff-exit/test-missing-alias.abi b/tests/data/test-abidiff-exit/test-missing-alias.abi new file mode 100644 index 000000000000..07a13f5e6d15 --- /dev/null +++ b/tests/data/test-abidiff-exit/test-missing-alias.abi @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/tests/data/test-abidiff-exit/test-missing-alias.suppr b/tests/data/test-abidiff-exit/test-missing-alias.suppr new file mode 100644 index 000000000000..bcebae43a350 --- /dev/null +++ b/tests/data/test-abidiff-exit/test-missing-alias.suppr @@ -0,0 +1,4 @@ +[suppress_function] + symbol_name_not_regexp = ^__foo$ + drop = true + diff --git a/tests/data/test-diff-suppr/test31-report-0.txt b/tests/data/test-diff-suppr/test31-report-0.txt index e69de29bb2d1..9666a8fddad7 100644 --- a/tests/data/test-diff-suppr/test31-report-0.txt +++ b/tests/data/test-diff-suppr/test31-report-0.txt @@ -0,0 +1,3 @@ +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 2f785d0203dd..cffdf3a5aa4f 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, 0 Added function +Functions changes summary: 0 Removed, 1 Changed (1 filtered out), 0 Added functions Variables changes summary: 0 Removed, 0 Changed, 0 Added variable 1 function with some indirect sub-type change: diff --git a/tests/data/test-read-dwarf/libtest24-drop-fns.so.abi b/tests/data/test-read-dwarf/libtest24-drop-fns.so.abi index 98b691bb4eec..fac267b365e1 100644 --- a/tests/data/test-read-dwarf/libtest24-drop-fns.so.abi +++ b/tests/data/test-read-dwarf/libtest24-drop-fns.so.abi @@ -204,75 +204,78 @@ - + + - - - - - - - + + + + + - - + + + - + + + + - - + + - + - + - + - - + + - - + + - + - + - + - + - + - + - + - + - + - + - + @@ -280,10 +283,10 @@ - - + + - + @@ -294,29 +297,34 @@ - + - + - + - + - + - + - - - - - + + + + + + + + + + @@ -327,10 +335,10 @@ - + - + @@ -338,7 +346,7 @@ - + @@ -349,13 +357,13 @@ - + - + @@ -369,14 +377,14 @@ - + - + - + @@ -384,10 +392,10 @@ - + - + @@ -400,15 +408,15 @@ - + - + - - + + @@ -419,142 +427,142 @@ - - + + - - + + - + - - + + - - - + + + - - + + - - + + - + - - - + + + - - + + - - + + - - - + + + - - + + - + - - + + - + - - + + - + - - + + - - + + - + - + - + - - + + - - + + - - + + - - - - + + + + - - + + - - + + - - + + @@ -563,58 +571,58 @@ - - + + - - + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + @@ -628,12 +636,12 @@ - + - + - + @@ -642,7 +650,7 @@ - + @@ -656,7 +664,7 @@ - + @@ -670,7 +678,7 @@ - + @@ -684,23 +692,23 @@ - - + + - - + + - - + + - - + + @@ -710,7 +718,7 @@ - + @@ -731,12 +739,12 @@ - - + + - - + + diff --git a/tests/data/test-read-dwarf/test-suppressed-alias.c b/tests/data/test-read-dwarf/test-suppressed-alias.c new file mode 100644 index 000000000000..a7812736c44b --- /dev/null +++ b/tests/data/test-read-dwarf/test-suppressed-alias.c @@ -0,0 +1,16 @@ + +// function aliases + +void main_func(void); +void alias_func(void) __attribute__((weak, alias("main_func"))); + +void main_func(void) +{ + +} + +// variables aliases + +int main_var; +extern int alias_var __attribute__((weak, alias("main_var"))); + diff --git a/tests/data/test-read-dwarf/test-suppressed-alias.o b/tests/data/test-read-dwarf/test-suppressed-alias.o new file mode 100644 index 0000000000000000000000000000000000000000..10d4a94a18c9c249c5ed3b60ada8c4f8cc5393ae GIT binary patch literal 2848 zcmbtVPjA#l6o0c$NWvyd{A7GM3v~Y{LpH!|fa2|NZLzUob>$O5?NIeO}9@Wu_$8NEVIh4zf9i70%Rj z80SS4acrKH)1(tK2e~o-@fHftvU zoKsM*U#UB@Sly%+gZpr`$qr|l6s3LQ$7@YYc@7_4B%ou7IDZM!;ssnCcpq0G{%tJa zs#}Vk5Rj`Z_j}rGTEJWp7Prk?H3tocGK{;sqqqlJdLmQykWnbJE&;8lSxd(KGzt4H znPiV!k5n3~$O}ec)c5iviL#d3&k>YSD+&V{gaa8yu>Hktx3h7<-B|ZO^4DE&n2%z$ zHBhli!yayB+S}XOzqsjbo_D>0>+Qnt3(h6V*(xzaFA z!9V|1DY1Q3Fn)=HCQs-c)KrmUCfC+Ea4>iiDyMjZ35+%l%)NmXc>NH3;SjuW2>!;Y z((}1o>H|;cGDi5I0;d^WD)pf_vjC?NKUsnEFpkHx7|Y3t9giw^>?p=#8AagA38yaI zBM@n+V8Hl_*}rY!r_7#CClP)5@>gEdDCjuldGbp*<)u7CmkXxj95XVp&yCFWyleJ% zEZl72ff4L__}wXvzQv5);vx2Q;}F?#T#Xj*T7F;fvu8s*n#l9C;Cn3Pco%@*m$?K# z$TIL#6-mFZg3+KG#=8mXv@C-lRZk|=GL`WFPkY%V3S-4Cm;(G>G8`(rsr@*~m5-N< zm*uke$T+FJ?rtiF$`t-T*(&-|Pq?2Pu5ARKcgD%KOeb+en0@lM%SI*H_CJF + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-dwarf/test-suppressed-alias.suppr b/tests/data/test-read-dwarf/test-suppressed-alias.suppr new file mode 100644 index 000000000000..3f0790a23f8c --- /dev/null +++ b/tests/data/test-read-dwarf/test-suppressed-alias.suppr @@ -0,0 +1,7 @@ +[suppress_function] + symbol_name = main_func + drop = true + +[suppress_variable] + symbol_name = main_var + drop = true diff --git a/tests/data/test-read-dwarf/test3-alias-1.so.hash.abi b/tests/data/test-read-dwarf/test3-alias-1.so.hash.abi new file mode 100644 index 000000000000..1ed4b0612886 --- /dev/null +++ b/tests/data/test-read-dwarf/test3-alias-1.so.hash.abi @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/tests/data/test-read-dwarf/test3-alias-1.suppr b/tests/data/test-read-dwarf/test3-alias-1.suppr new file mode 100644 index 000000000000..b347500d4c4e --- /dev/null +++ b/tests/data/test-read-dwarf/test3-alias-1.suppr @@ -0,0 +1,3 @@ +[suppress_function] + symbol_name_not_regexp = ^__foo$ + drop = true diff --git a/tests/data/test-read-dwarf/test3-alias-2.so.hash.abi b/tests/data/test-read-dwarf/test3-alias-2.so.hash.abi new file mode 100644 index 000000000000..50a53f97bf84 --- /dev/null +++ b/tests/data/test-read-dwarf/test3-alias-2.so.hash.abi @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-dwarf/test3-alias-2.suppr b/tests/data/test-read-dwarf/test3-alias-2.suppr new file mode 100644 index 000000000000..b6d203d53c2b --- /dev/null +++ b/tests/data/test-read-dwarf/test3-alias-2.suppr @@ -0,0 +1,3 @@ +[suppress_function] + symbol_name_regexp = ^__foo$ + drop = true diff --git a/tests/data/test-read-dwarf/test3-alias-3.so.hash.abi b/tests/data/test-read-dwarf/test3-alias-3.so.hash.abi new file mode 100644 index 000000000000..6de4d59b13d5 --- /dev/null +++ b/tests/data/test-read-dwarf/test3-alias-3.so.hash.abi @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/tests/data/test-read-dwarf/test3-alias-3.suppr b/tests/data/test-read-dwarf/test3-alias-3.suppr new file mode 100644 index 000000000000..66cd33a8d353 --- /dev/null +++ b/tests/data/test-read-dwarf/test3-alias-3.suppr @@ -0,0 +1,3 @@ +[suppress_function] + symbol_name_not_regexp = ^foo$ + drop = true diff --git a/tests/data/test-read-dwarf/test3-alias-4.so.hash.abi b/tests/data/test-read-dwarf/test3-alias-4.so.hash.abi new file mode 100644 index 000000000000..b26d12f80e61 --- /dev/null +++ b/tests/data/test-read-dwarf/test3-alias-4.so.hash.abi @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/data/test-read-dwarf/test3-alias-4.suppr b/tests/data/test-read-dwarf/test3-alias-4.suppr new file mode 100644 index 000000000000..25a2c437f51e --- /dev/null +++ b/tests/data/test-read-dwarf/test3-alias-4.suppr @@ -0,0 +1,3 @@ +[suppress_function] + symbol_name_not_regexp = ^_init$ + drop = true diff --git a/tests/test-abidiff-exit.cc b/tests/test-abidiff-exit.cc index 4283e1455d67..38f1301eb924 100644 --- a/tests/test-abidiff-exit.cc +++ b/tests/test-abidiff-exit.cc @@ -392,6 +392,17 @@ InOutSpec in_out_specs[] = "data/test-abidiff-exit/test-non-leaf-array-report.txt", "output/test-abidiff-exit/test-non-leaf-array-report.txt" }, + { + "data/test-abidiff-exit/test-missing-alias.abi", + "data/test-abidiff-exit/test-missing-alias.abi", + "data/test-abidiff-exit/test-missing-alias.suppr", + "", + "", + "", + abigail::tools_utils::ABIDIFF_OK, + "data/test-abidiff-exit/test-missing-alias-report.txt", + "output/test-abidiff-exit/test-missing-alias-report.txt" + }, {0, 0, 0 ,0, 0, 0, abigail::tools_utils::ABIDIFF_OK, 0, 0} }; diff --git a/tests/test-read-dwarf.cc b/tests/test-read-dwarf.cc index 1212e11c0663..e327909fb803 100644 --- a/tests/test-read-dwarf.cc +++ b/tests/test-read-dwarf.cc @@ -110,6 +110,46 @@ InOutSpec in_out_specs[] = "data/test-read-dwarf/test3.so.hash.abi", "output/test-read-dwarf/test3.so.hash.abi" }, + // suppress all except the main symbol of a group of aliases + { + "data/test-read-dwarf/test3.so", + "data/test-read-dwarf/test3-alias-1.suppr", + HASH_TYPE_ID_STYLE, + "data/test-read-dwarf/test3-alias-1.so.hash.abi", + "output/test-read-dwarf/test3-alias-1.so.hash.abi" + }, + // suppress the main symbol of a group of aliases + { + "data/test-read-dwarf/test3.so", + "data/test-read-dwarf/test3-alias-2.suppr", + HASH_TYPE_ID_STYLE, + "data/test-read-dwarf/test3-alias-2.so.hash.abi", + "output/test-read-dwarf/test3-alias-2.so.hash.abi" + }, + // suppress all except one non main symbol of a group of aliases + { + "data/test-read-dwarf/test3.so", + "data/test-read-dwarf/test3-alias-3.suppr", + HASH_TYPE_ID_STYLE, + "data/test-read-dwarf/test3-alias-3.so.hash.abi", + "output/test-read-dwarf/test3-alias-3.so.hash.abi" + }, + // suppress all symbols of a group of aliases + { + "data/test-read-dwarf/test3.so", + "data/test-read-dwarf/test3-alias-4.suppr", + HASH_TYPE_ID_STYLE, + "data/test-read-dwarf/test3-alias-4.so.hash.abi", + "output/test-read-dwarf/test3-alias-4.so.hash.abi" + }, + // suppress the main symbols with alias (function+variable) in .o file + { + "data/test-read-dwarf/test-suppressed-alias.o", + "data/test-read-dwarf/test-suppressed-alias.suppr", + HASH_TYPE_ID_STYLE, + "data/test-read-dwarf/test-suppressed-alias.o.abi", + "output/test-read-dwarf/test-suppressed-alias.o.abi", + }, { "data/test-read-dwarf/test4.so", "",