From patchwork Wed Jan 27 12:58:36 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: 41837 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 8C9CC3971830; Wed, 27 Jan 2021 12:59:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8C9CC3971830 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1611752355; bh=284iQNR8hS3qvWB1uODjpQ+ZEyfRumfCSXRi94FHAzM=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=jvoYZ5rgIjHe5osNlBEqEu9BL5GMqtd4EqXSr9xM13XHorlC7eU//wVhcyllC8Vxi I41oUh1IwpH3QmFU3gvUrEJ01U1+uwYW/UkXMC3eCIrqvE3i2jX5Vz3Y+HN3PFiHGc NRj+6wlpfWmpC68GVd67uzkJmtju4NpSG+pZKtoE= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) by sourceware.org (Postfix) with ESMTPS id 651443972827 for ; Wed, 27 Jan 2021 12:59:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 651443972827 Received: by mail-qk1-x749.google.com with SMTP id l124so1378841qke.7 for ; Wed, 27 Jan 2021 04:59:13 -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; bh=284iQNR8hS3qvWB1uODjpQ+ZEyfRumfCSXRi94FHAzM=; b=NsIm6tgq1lwynTtoTsXkQ/XRZYc7KfZ3QDRdOkL53UGLrYjfNPewFdfUXb9pA/Zgwj IKmjPYtyUxthc0bD90oRphOArFN4zbcq94yJdkmr7QF9r0KFEEcHmI52jn4WVtIa9DB5 QUaSTqkRfAuBiwe7XAK2dlkl5xOpnX9SYjoamYvD4k9g8tDczcR9H/iD8NQIMzjDdeBT ndccarLZOsMtj1RKVk1LUSojeZ+outd2gmw5QkZAEnwG3/UWT4n2ZVdnTxrQs6qeVlX9 IXToq1Mn01/Y5Fyw0cFuNTli+NNVpv6WTwdohY6hJ6knWJRRFldwUveaPC9CVzoSVjBS 1XaA== X-Gm-Message-State: AOAM531EBaC/FScl+wUTnXNmp9asjtAtKUE/gb/SNtRsE6n5Z3x0Eloe 7rRQICWmCyOEIOJ1tO1DcsV6ugaem8pngRNnQyrGVM5gwFu9YJKw07ZUWomgxOgu/4oFAyV1eEK T5zU5Rl6I//jqn5Otqe5PlGSXW/q+KXxC2Q9Y7mcUvcuNjyrm/zQJqvHkX9uYepxlnPlvGiU= X-Google-Smtp-Source: ABdhPJwEJoNYFLkkRTS8se/4uDf65sj4bZL6vTsFHZRZmAmZWsxg9bB/awhWPaAZEW+JhhMuT2xSLhj9hXwUqw== X-Received: from lux.lon.corp.google.com ([2a00:79e0:d:210:7220:84ff:fe09:a3aa]) (user=maennich job=sendgmr) by 2002:a0c:8365:: with SMTP id j92mr10365042qva.19.1611752352954; Wed, 27 Jan 2021 04:59:12 -0800 (PST) Date: Wed, 27 Jan 2021 12:58:36 +0000 In-Reply-To: <20210127125853.886677-1-maennich@google.com> Message-Id: <20210127125853.886677-4-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 03/20] abg-ir: elf_symbol: add is_suppressed field To: libabigail@sourceware.org X-Spam-Status: No, score=-22.7 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" In the context of libabigail and a single library run (when reading from dwarf or from xml), a symbol is either suppressed or it is not. While one could argue that this is a property of the read_context, the read_context might not be around anymore when the symbol still is. Hence, persist the 'is_suppressed' state along with the symbol itself. * include/abg-ir.h (elf_symbol::elf_symbol): Add is_suppressed parameter. (elf_symbol::create): Likewise. (elf_symbol::is_suppressed): New getter declaration. (elf_symbol::set_is_suppressed): New setter declaration. * src/abg-ir.cc (elf_symbol::priv::priv): Add is_suppressed parameter. (elf_symbol::priv::is_suppressed_): New field. (elf_symbol::elf_symbol): Add is_suppressed parameter. (elf_symbol::create): Likewise. (elf_symbol::is_suppressed): New getter implementation. (elf_symbol::set_is_suppressed): New setter implementation. Reviewed-by: Giuliano Procida Signed-off-by: Matthias Maennich --- include/abg-ir.h | 12 ++++++++++-- src/abg-ir.cc | 29 ++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/include/abg-ir.h b/include/abg-ir.h index d82c83592f82..23ba16bd327b 100644 --- a/include/abg-ir.h +++ b/include/abg-ir.h @@ -839,7 +839,8 @@ private: const version& ve, visibility vi, bool is_linux_string_cst = false, - bool is_in_ksymtab = false); + bool is_in_ksymtab = false, + bool is_suppressed = false); elf_symbol(const elf_symbol&); @@ -863,7 +864,8 @@ public: const version& ve, visibility vi, bool is_linux_string_cst = false, - bool is_in_ksymtab = false); + bool is_in_ksymtab = false, + bool is_suppressed = false); const environment* get_environment() const; @@ -937,6 +939,12 @@ public: void set_is_in_ksymtab(bool is_in_ksymtab); + bool + is_suppressed() const; + + void + set_is_suppressed(bool is_suppressed); + const elf_symbol_sptr get_main_symbol() const; diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 22532cc87dfd..1ba95dd6c14f 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -1311,6 +1311,7 @@ struct elf_symbol::priv bool is_common_; bool is_linux_string_cst_; bool is_in_ksymtab_; + bool is_suppressed_; elf_symbol_wptr main_symbol_; elf_symbol_wptr next_alias_; elf_symbol_wptr next_common_instance_; @@ -1326,7 +1327,8 @@ struct elf_symbol::priv is_defined_(false), is_common_(false), is_linux_string_cst_(false), - is_in_ksymtab_(false) + is_in_ksymtab_(false), + is_suppressed_(false) {} priv(const environment* e, @@ -1340,7 +1342,8 @@ struct elf_symbol::priv const elf_symbol::version& ve, elf_symbol::visibility vi, bool is_linux_string_cst, - bool is_in_ksymtab) + bool is_in_ksymtab, + bool is_suppressed) : env_(e), index_(i), size_(s), @@ -1352,7 +1355,8 @@ struct elf_symbol::priv is_defined_(d), is_common_(c), is_linux_string_cst_(is_linux_string_cst), - is_in_ksymtab_(is_in_ksymtab) + is_in_ksymtab_(is_in_ksymtab), + is_suppressed_(is_suppressed) { if (!is_common_) is_common_ = type_ == COMMON_TYPE; @@ -1409,7 +1413,8 @@ elf_symbol::elf_symbol(const environment* e, const version& ve, visibility vi, bool is_linux_string_cst, - bool is_in_ksymtab) + bool is_in_ksymtab, + bool is_suppressed) : priv_(new priv(e, i, s, @@ -1421,7 +1426,8 @@ elf_symbol::elf_symbol(const environment* e, ve, vi, is_linux_string_cst, - is_in_ksymtab)) + is_in_ksymtab, + is_suppressed)) {} /// Factory of instances of @ref elf_symbol. @@ -1479,11 +1485,12 @@ elf_symbol::create(const environment* e, const version& ve, visibility vi, bool is_linux_string_cst, - bool is_in_ksymtab) + bool is_in_ksymtab, + bool is_suppressed) { elf_symbol_sptr sym(new elf_symbol(e, i, s, n, t, b, d, c, ve, vi, is_linux_string_cst, - is_in_ksymtab)); + is_in_ksymtab, is_suppressed)); sym->priv_->main_symbol_ = sym; return sym; } @@ -1711,6 +1718,14 @@ void elf_symbol::set_is_in_ksymtab(bool is_in_ksymtab) {priv_->is_in_ksymtab_ = is_in_ksymtab;} +bool +elf_symbol::is_suppressed() const +{return priv_->is_suppressed_;} + +void +elf_symbol::set_is_suppressed(bool is_suppressed) +{priv_->is_suppressed_ = is_suppressed;} + /// @name Elf symbol aliases /// /// An alias A for an elf symbol S is a symbol that is defined at the