From patchwork Sun May 1 22:16:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 53380 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 0FC243857C4A for ; Sun, 1 May 2022 22:17:02 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 21D783858D33 for ; Sun, 1 May 2022 22:16:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 21D783858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=wildebeest.org Received: by gnu.wildebeest.org (Postfix, from userid 1000) id 104F330230A5; Mon, 2 May 2022 00:16:57 +0200 (CEST) From: Mark Wielaard To: libabigail@sourceware.org Subject: [PATCH] symtab-reader: Setup aliases before checking ppc64 opd function entries Date: Mon, 2 May 2022 00:16:47 +0200 Message-Id: <1651443407-13798-1-git-send-email-mark@klomp.org> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: , Cc: Mark Wielaard Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" The update_function_entry_address_symbol_map function checks whether the given symbol is an alias of another symbol or a special ppc64 ELFv1 function entry symbol. This requires the symbol aliases to already been setup. But the alias entries were only setup after calling update_function_entry_address_symbol_map. Make sure that the symbol aliases have been setup and only then call the special ppc64 update_function_entry_address_symbol_map function. But make sure the arm32 function symbol entry address cleanup is done before checking for aliases. This fixes runtestslowselfcompare.sh on ppc64 (ELFv1) with ENABLE_SLOW_TEST=yes * src/abg-symtab-reader.cc (symtab::load_): Call update_function_entry_address_symbol_map after setting up aliases. Signed-off-by: Mark Wielaard --- src/abg-symtab-reader.cc | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/abg-symtab-reader.cc b/src/abg-symtab-reader.cc index b42ce87..0f7ace9 100644 --- a/src/abg-symtab-reader.cc +++ b/src/abg-symtab-reader.cc @@ -352,16 +352,13 @@ symtab::load_(Elf* elf_handle, sym); // See also symtab::add_alternative_address_lookups. - if (symbol_sptr->is_function()) + // Note, do this before setting up aliases + if (symbol_sptr->is_function() && is_arm32) { - if (is_arm32) - // Clear bit zero of ARM32 addresses as per "ELF for the Arm - // Architecture" section 5.5.3. - // https://static.docs.arm.com/ihi0044/g/aaelf32.pdf - symbol_value &= ~1; - else if (is_ppc64) - update_function_entry_address_symbol_map(elf_handle, sym, - symbol_sptr); + // Clear bit zero of ARM32 addresses as per "ELF for the Arm + // Architecture" section 5.5.3. + // https://static.docs.arm.com/ihi0044/g/aaelf32.pdf + symbol_value &= ~1; } const auto result = @@ -371,6 +368,14 @@ symtab::load_(Elf* elf_handle, // means this symbol is an alias of the main symbol with // that address. So let's register this new alias as such. result.first->second->get_main_symbol()->add_alias(symbol_sptr); + + // See also symtab::add_alternative_address_lookups. + // Note, do this after setting up aliases. + if (symbol_sptr->is_function() && is_ppc64) + { + update_function_entry_address_symbol_map(elf_handle, sym, + symbol_sptr); + } } }