From patchwork Tue Jul 16 14:55:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 93994 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 93869386D61A for ; Tue, 16 Jul 2024 14:55:52 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) by sourceware.org (Postfix) with ESMTPS id 9603C384A438 for ; Tue, 16 Jul 2024 14:55:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9603C384A438 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9603C384A438 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4b98:dc4:8::228 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141747; cv=none; b=H2L5oM1m6kOI4RbjwDOxfemaxAjY+FCG+O6IdJRYxceJLJsn+AtZLiALBkImDAq2cP/+oawy4ds8IYs1Og9rdC5eBpnqYCj7VwibkaesOMYjo8NrCc94swMrmmVcQG8Ym7Yzszv5zCN+Kvam5DRNEUUX0jZjRmie9mE2tMprW9w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141747; c=relaxed/simple; bh=ie7g+mxhK1j2rAk1ixtQOlDlel0guFUMhTxd8r6C1Iw=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=cllIcmeqgthqtRw64EvNrltI+L0tzj1wGidgQx0B/TechmzWDGjNaHGVZbE4krhPIs15pYehdB8IC63Uavb7MvqBDUGbPR0xyZFi1uvd09rJ1YwMPgOWPED7hvc3bGWc7u5biS1GrsxS7IQy1/nAliXQdLlutgMG9IC8LdTa9TU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id 1E6C31BF207; Tue, 16 Jul 2024 14:55:41 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 345DDC1B76BB; Tue, 16 Jul 2024 16:55:41 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 01/17] ir: Fix a potential crash in canonicalize_types Date: Tue, 16 Jul 2024 16:55:12 +0200 Message-ID: <20240716145541.473065-2-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240716145541.473065-1-dodji@redhat.com> References: <20240716145541.473065-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli I noticed crashes in canonicalize_types when it deals with nullptr types. Fixed thus. * src/abg-ir-priv.h (canonicalize_types): Avoid crashing when de-referencing an iterator to a nullptr type. Signed-off-by: Dodji Seketeli --- src/abg-ir-priv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/abg-ir-priv.h b/src/abg-ir-priv.h index 78a05e72..a9002561 100644 --- a/src/abg-ir-priv.h +++ b/src/abg-ir-priv.h @@ -1620,7 +1620,7 @@ canonicalize_types(const input_iterator& begin, // First, let's compute the canonical type of this type. for (t = begin,i = 0; t != end; ++t, ++i) { - if (deref(t)->get_environment().priv_->do_log()) + if (deref(t) && deref(t)->get_environment().priv_->do_log()) std::cerr << "#" << std::dec << i << " "; canonicalize(deref(t)); From patchwork Tue Jul 16 14:55:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 93993 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 7DF15387088C for ; Tue, 16 Jul 2024 14:55:51 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by sourceware.org (Postfix) with ESMTPS id 8892B384A475 for ; Tue, 16 Jul 2024 14:55:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8892B384A475 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8892B384A475 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.70.183.195 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141747; cv=none; b=OkzW0Ydb0Q3HA6ubIvA++6jmG0yWCNhUHa07khrQGs6k9MAEHgLGlfjeIvmb3S1JKlApB7ZhVRszp77OM8YYZlEBIYFN6uZsy1nVXrKFqFvoeqwO53QeAgkvNJFuKf+YiY3hj6qBgFZbLDgRCVA609wbAs1w+ALGwV1HkLYb+Sk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141747; c=relaxed/simple; bh=W+bUVIqhWRUqlJsnAzDVjYY61adXXrFP6XQ/7b/vw+Q=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=CyOq3C4efdu0X5Fq+eSFzmVhqpqxuBaIGxyhvndHw9gJGSdAX2yUlO4PQaGVg8h+DtKxvBjM47PnXs+CTI7xL5oSy8dsK/EspQt5uueuvb9fDb/zO/D0JF3VmItV4SV16Q3gvcOOJZeXHHouX1jejvXsp0irRO2tqMbjzs71BSE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id E4D6760005; Tue, 16 Jul 2024 14:55:41 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 35D63C1B7753; Tue, 16 Jul 2024 16:55:41 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 02/17] elf-based-reader: Clean up logic of elf_based_reader::read_and_add_corpus_to_group Date: Tue, 16 Jul 2024 16:55:13 +0200 Message-ID: <20240716145541.473065-3-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240716145541.473065-1-dodji@redhat.com> References: <20240716145541.473065-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli While looking at something else, I noticed the logic of elf_based_reader::read_and_add_corpus_to_group wasn't clear. The corpus should be read (thus created) first, then added to the reader. Fixed thus. * src/abg-elf-based-reader.cc (elf_based_reader::read_and_add_corpus_to_group): Fix logic. Signed-off-by: Dodji Seketeli --- src/abg-elf-based-reader.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/abg-elf-based-reader.cc b/src/abg-elf-based-reader.cc index 123e5fec..32c0699e 100644 --- a/src/abg-elf-based-reader.cc +++ b/src/abg-elf-based-reader.cc @@ -107,8 +107,8 @@ ir::corpus_sptr elf_based_reader::read_and_add_corpus_to_group(ir::corpus_group& group, fe_iface::status& status) { - group.add_corpus(corpus()); ir::corpus_sptr corp = read_corpus(status); + group.add_corpus(corp); return corp; } From patchwork Tue Jul 16 14:55:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 93996 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 0E23E384514B for ; Tue, 16 Jul 2024 14:56:12 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by sourceware.org (Postfix) with ESMTPS id 888E9384A4A1 for ; Tue, 16 Jul 2024 14:55:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 888E9384A4A1 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 888E9384A4A1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141748; cv=none; b=ryfml24lDKxnd6SWnCgceJ3M42Hlrrv/sc3XrBS2MaFNk1ohkqmrF2nyqTiDWBh1VqBadfPUO1XLfUUQeZXXgw3gTFJEgV5c3PoTB9bwaldjonUxFXI3wRBs/4WXj71IeivnQjbAu3e9FI00hUFNO2Kt8AC8g3HS17942EF0OyA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141748; c=relaxed/simple; bh=MjRZxiZfwyou1CZsKEQth7YzhJfzrErrFlTHyDvEHI4=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=ccxPKO2Yu2lFIHJPrDgVTQG2gNR3JDFY7FvajHpDKP4YMhkErNOXdDdzbTa+lgPImQOK+MJ6YIq+uQBXv03lPmRYxZ31o64chz3zwrhATY30iXzHeUmy/Iukg6bdHO81FNpqdwDZrQu7lfkcujtYydVgG91s9Agyl09iC/t93+M= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id 19F241BF205; Tue, 16 Jul 2024 14:55:41 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 380C2C1B7764; Tue, 16 Jul 2024 16:55:41 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 03/17] tools-utils, btf-reader: Take modules into account for corpus group Date: Tue, 16 Jul 2024 16:55:14 +0200 Message-ID: <20240716145541.473065-4-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240716145541.473065-1-dodji@redhat.com> References: <20240716145541.473065-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli It turns out the BTF front-end won't take kernel modules into account when analyzing a linux kernel build tree. This is because it doesn't support split and base BTF objects. Please note that the BTF API is not yet documented in https://docs.kernel.org/bpf/btf.html, so my understanding of how it works comes the source code of the bpftool program available at https://github.com/libbpf/bpftool and https://github.com/libbpf/libbpf. When analyzing the vmlinux binary, the btf__parse function returns a "base BTF object" which contains the type information contained in the .BTF section of that binary. The memory of the BTF types describing the types of vmlinux lives in the base BTF object. So the base BTF object must be kept around for the entire time of the analysis of the Linux kernel tree (vmlinux + modules). When analyzing a kernel module however, it's the btf__parse_split function that is used. That function takes into parameter the "base BTF object" representing the type information of the corresponding vmlinux binary and returns a "split BTF object" which contains the type information contained in the .BTF section of the kernel module. Please note that the split BTF object does reference the base BTF object as well. The memory of the BTF types describing the types the kernel module lives in the split BTF object. Because some types and decls might be exported by a kernel module and used by another one, the memory of a given split BTF object might be needed to be kept alive for the entire time of the analysis of the Linux kernel tree as well. It's this base/split model of BTF that is not supported by the BTF front-end. This patch introduces support for that model. At any point in time, the BTF front-end now has one handle to the base BTF object and one handle to the current split BTF object if we are looking at kernel module. The base and split BTF objects are kept around for the entire lifetime of the front-end. For a given binary, each type is identified by a type ID. The validity of a given type ID is effective only for that binary. The same type ID in another binary might designate another type. So rather than maintaining a map that associates a type ID with a libabigail IR artifact, the front-end now maintains a map that associates a *type* with libabigail IR artifact. With this changes, abidw can now analyze and emit the ABIXML for a linux kernel tree in 28 seconds, using BTF. It can self-compare a kernel tree in 36 seconds. * src/abg-btf-reader.cc (btf_type_to_abi_artifact_map_type): Rename btf_type_id_to_abi_artifact_map_type into this. Make it associate a btf_type* to a libabigail IR, rather than a type ID to a libabigail IR. (reader::{base_btf_handle_, base_btf_file_name_, split_btf_handle_, split_btf_file_name_, split_btfs_to_free_}): Define new data members. (reader::{btf_handle_}): Remove. (reader::base_btf_handle): Renamed btf_handle into this. Create the BTF object using btf__parse. Store the name of the binary into reader::base_btf_file_name_. (reader::read_split_btf): Define new member function. (reader::btf_handle): This is new code for an existing member function name. Return the current split BTF object handle if applicable, otherwise create the base BTF object handle. (reader::btf_type_to_artifacts_): Renamed btf_type_id_to_artifacts into this. (reader::associate_artifact_to_btf_type): Renamed associate_artifact_to_btf_type_id into this. (reader::schedule_type_for_canonicalization): Do not schedule a type that has already been canonicalized. (reader::nr_btf_types): Take a BTF* parameter. (reader::~reader): Free all the allocated split BTF objects. (reader::read_debug_info_into_corpus): If we are looking at a split BTF, then set the first type ID as the one right after the last type ID of the base BTF. (reader::build_ir_node_from_btf_type): Clean-up the logic for building type void type. (reader::{build_ir_node_for_void_type, build_ir_node_for_void_pointer_type, build_ir_node_for_variadic_parameter_type, build_enum_underlying_type, build_array_type}): Schedule type for canonicalization at the end of the IR construction, not right away. * src/abg-tools-utils.cc (create_best_elf_based_reader): Pass show_all_types and linux_kernel_mode arguments to btf::create_reader. Signed-off-by: Dodji Seketeli --- src/abg-btf-reader.cc | 275 +++++++++++++++++++++++++++++++---------- src/abg-tools-utils.cc | 6 +- 2 files changed, 213 insertions(+), 68 deletions(-) diff --git a/src/abg-btf-reader.cc b/src/abg-btf-reader.cc index e4aca24f..ec13d267 100644 --- a/src/abg-btf-reader.cc +++ b/src/abg-btf-reader.cc @@ -53,33 +53,139 @@ btf_offset_to_string(const ::btf* btf, uint32_t offset) return btf__name_by_offset(btf, offset) ?: "(invalid string offset)"; } -/// A convenience typedef of a map that associates a btf type id to a -/// libabigail ABI artifact. -typedef std::unordered_map -btf_type_id_to_abi_artifact_map_type; +/// A convenience typedef of a map that associates a btf type to a +/// libabigail ABI artifact. The type is allocated inside a given btf +/// handle (of type ::btf*). All handles (one for each kernel binary) +/// should be kept around until a complete corpus group is built. +typedef std::unordered_map +btf_type_to_abi_artifact_map_type; /// The BTF front-end abstraction type. +/// +/// Note that one instance of front-end is meant to analyze one +/// vmlinux file and all its associated modules. For now, the +/// front-end doesn't know how to analyze a module without having +/// analyzed a vmlinux first. +/// +/// The BTF information of a vmlinux is parsed with the btf__parse +/// function. The result is called a "base BTF" handle. +/// +/// The BTF information of a kernel module is parsed with the function +/// btf__parse_split. The result is called a "split BTF" handle. A +/// split BTF handle references information that are in the base BTF +/// handle. The base BTF handle can be retrieved from a split BTF +/// handle using btf__base_btf. class reader : public elf_based_reader { - ::btf* btf_handle_ = nullptr; + ::btf* base_btf_handle_ = nullptr; + // The path to the binary that contains the base BTF information + // held in base_btf_handle_ + string base_btf_file_name_; + ::btf* split_btf_handle_ = nullptr; + // The path to the binary that contains the split BTF information + // held in split_btf_handle_ + string split_btf_file_name_; + // A vector of (split) BTF objects that are to be freed once the + // corpus group is built for an entire kernel (vmliunx + modules). + vector<::btf*> split_btfs_to_free_; translation_unit_sptr cur_tu_; vector types_to_canonicalize_; - btf_type_id_to_abi_artifact_map_type btf_type_id_to_artifacts_; + btf_type_to_abi_artifact_map_type btf_type_to_artifacts_; - /// Getter of the handle to the BTF data as returned by libbpf. + /// Getter of the handle to the base BTF object of the current + /// binary being analyzed. + /// + /// The base BTF object ALWAYS represents the BTF information of the + /// vmlinux binary, even if the current binary being analyzed is a + /// kernel module. /// - /// @return the handle to the BTF data as returned by libbpf. + /// @return handle to the base BTF object of the current binary + /// being analyzed. ::btf* - btf_handle() + base_btf_handle() { - if (btf_handle_ == nullptr) + if (base_btf_handle_ == nullptr) { - btf_handle_ = btf__parse(corpus_path().c_str(), nullptr); - if (!btf_handle_) - std::cerr << "Could not parse BTF information from file '" - << corpus_path().c_str() << "'" << std::endl; + base_btf_handle_ = btf__parse(corpus_path().c_str(), nullptr); + if (!base_btf_handle_) + { + std::cerr << "Could not parse base BTF information from file '" + << corpus_path().c_str() << "'" << std::endl; + return nullptr; + } + base_btf_file_name_ = corpus_path(); } - return btf_handle_; + return base_btf_handle_; + } + + /// Read the BTF information of the current binary which path is + /// @ref fe_iface::corpus_path() and return its associated object + /// handle. This is called the split BTF object. + /// + /// Note that this function expects the base BTF object (the one for + /// the vmlinux binary) to be already present, otherwise, it returns + /// nullptr. + /// + /// @return the split BTF object for the file designed by + /// fe_iface::corpus_path(). + ::btf* + read_split_btf() + { + if (!base_btf_handle_) + { + std::cerr << "Base BTF information not present. " + << "Not attempting to parse split BTF information" + << std::endl; + return nullptr; + } + + if (corpus_path().empty() || corpus_path() == base_btf_file_name_) + { + std::cerr << "BTF reader not initialized with split file name. " + << "Not attending to read split BTF information" + << std::endl; + return nullptr; + } + + split_btf_handle_ = btf__parse_split(corpus_path().c_str(), + base_btf_handle()); + if (!split_btf_handle_) + { + std::cerr << "Could not read split BTF information from file " + << corpus_path() << std::endl; + return nullptr; + } + split_btf_file_name_ = corpus_path(); + + return split_btf_handle_; + } + + /// Getter of the handle to the BTF object as returned by libbpf. + /// + /// This returns the handle to the current BTF object. If the + /// current BTF object is for a vmlinux binary, then it's the base + /// BTF object that is returned. Otherwise, if the current BTF + /// object if for a kernel module then it's the split BTF object + /// that is returned. + /// + /// @return the handle to the BTF object of the current binary being + /// analyeed by this front-end. + ::btf* + btf_handle() + { + if (split_btf_handle_) + return split_btf_handle_; + + if (!base_btf_handle_) + return base_btf_handle(); + + if (corpus_path() != base_btf_file_name_) + // The reader was re-initialized with a corpus_path that is + // different from the the BTF base file. That means we are + // instructed to read a split BTF file information. + return read_split_btf(); + + return base_btf_handle(); } /// Getter of the environment of the current front-end. @@ -129,57 +235,60 @@ class reader : public elf_based_reader cur_tu(const translation_unit_sptr& tu) {cur_tu_ = tu;} - /// Getter of the map that associates a BTF type ID to an ABI - /// artifact. + /// Getter of the map that associates a BTF type to the internal + /// representation of an ABI artifact. /// - /// @return The map that associates a BTF type ID to an ABI + /// @return The map that associates a BTF type to the IR of an ABI /// artifact. - btf_type_id_to_abi_artifact_map_type& - btf_type_id_to_artifacts() - {return btf_type_id_to_artifacts_;} + btf_type_to_abi_artifact_map_type& + btf_type_to_artifacts() + {return btf_type_to_artifacts_;} - /// Getter of the map that associates a BTF type ID to an ABI + /// Getter of the map that associates a BTF type to the IR of an ABI /// artifact. /// - /// @return The map that associates a BTF type ID to an ABI + /// @return The map that associates a BTF type to the IR of an ABI /// artifact. - const btf_type_id_to_abi_artifact_map_type& - btf_type_id_to_artifacts() const - {return btf_type_id_to_artifacts_;} + const btf_type_to_abi_artifact_map_type& + btf_type_to_artifacts() const + {return btf_type_to_artifacts_;} - /// Get the ABI artifact that is associated to a given BTF type ID. + /// Get the IR of the ABI artifact that is associated to a given BTF + /// type. /// - /// If no ABI artifact is associated to the BTF type id, then return - /// nil. + /// If no ABI artifact is associated to the BTF type, then return + /// nullptr. /// - /// @return the ABI artifact that is associated to a given BTF type - /// id. + /// @return the ABI artifact that is associated to a given BTF type. type_or_decl_base_sptr - lookup_artifact_from_btf_id(int btf_id) + lookup_artifact_from_btf_type(const btf_type* t) { - auto i = btf_type_id_to_artifacts().find(btf_id); - if (i != btf_type_id_to_artifacts().end()) + auto i = btf_type_to_artifacts().find(t); + if (i != btf_type_to_artifacts().end()) return i->second; return type_or_decl_base_sptr(); } - /// Associate an ABI artifact to a given BTF type ID. + /// Associate an ABI artifact to a given BTF type. /// /// @param artifact the ABI artifact to consider. /// - /// @param btf_type_id the BTF type ID to associate to @p artifact. + /// @param btf_type_id the BTF type to associate to @p artifact. void - associate_artifact_to_btf_type_id(const type_or_decl_base_sptr& artifact, - int btf_type_id) - {btf_type_id_to_artifacts()[btf_type_id] = artifact;} + associate_artifact_to_btf_type(const type_or_decl_base_sptr& artifact, + const btf_type* t) + {btf_type_to_artifacts()[t] = artifact;} /// Schecule a type for canonicalization at the end of the debug /// info loading. /// /// @param t the type to schedule. void - schedule_type_for_canonocalization(const type_base_sptr& t) - {types_to_canonicalize_.push_back(t);} + schedule_type_for_canonicalization(const type_base_sptr& t) + { + if (t && !t->get_naked_canonical_type()) + types_to_canonicalize_.push_back(t); + } /// Canonicalize all the types scheduled for canonicalization using /// abigail::ir::canonicalize_types() which performs some sanity @@ -193,8 +302,13 @@ class reader : public elf_based_reader {return *i;}); } + /// Getter of the number of types carried by a given BTF object. + /// + /// @param handle the BTF object to consider. + /// + /// @return the number of types carried by a given BTF object. uint64_t - nr_btf_types() const + nr_btf_types(const ::btf* handle) const { #ifdef WITH_BTF__GET_NR_TYPES #define GET_NB_TYPES btf__get_nr_types @@ -210,7 +324,7 @@ class reader : public elf_based_reader return 0; #endif - return GET_NB_TYPES(const_cast(this)->btf_handle()); + return GET_NB_TYPES(handle); } protected: @@ -238,12 +352,21 @@ protected: bool load_all_types, bool linux_kernel_mode) { - btf__free(btf_handle_); - btf_handle_ = nullptr; + if (split_btf_handle_) + { + // We need to keep this split_btf_handle_ on the side so that + // we can free it when we are done analyzing all the kernel + // modules. We cannot free it right now because the memory of + // all btf types lives in it. + split_btfs_to_free_.push_back(split_btf_handle_); + split_btf_handle_ = nullptr; + } + + split_btf_file_name_.clear(); types_to_canonicalize_.clear(); - btf_type_id_to_artifacts_.clear(); cur_tu_.reset(); elf_based_reader::initialize(elf_path, debug_info_root_paths); + corpus_path(elf_path); options().load_all_types = load_all_types; options().load_in_linux_kernel_mode = linux_kernel_mode; } @@ -308,8 +431,12 @@ public: /// Destructor of the btf::reader type. ~reader() { - btf__free(btf_handle_); - btf_handle_ = nullptr; + for (auto b : split_btfs_to_free_) + btf__free(b); + btf__free(split_btf_handle_); + btf__free(base_btf_handle_); + split_btf_handle_ = nullptr; + base_btf_handle_ = nullptr; } /// Read the ELF information as well as the BTF type information to @@ -359,8 +486,24 @@ public: corpus()->add(artificial_tu); cur_tu(artificial_tu); - int number_of_types = nr_btf_types(); + int number_of_types = nr_btf_types(btf_handle()); int first_type_id = 1; + // Are we looking at the BTF for a kernel module? + const ::btf* base = btf__base_btf(btf_handle()); + if (base) + { + // So, base is non-nil. This means we are looking at the BTF + // for a kernel module and base points to the BTF for the + // corresponding vmlinux. That base BTF should be the same as + // base_btf_handle(). + ABG_ASSERT(base == base_btf_handle()); + + // The ID of the first type that is contained in this BTF + // representing a kernel module is the number of types + // contained in the base BTF (i.e, the BTF for the vmlinux + // binary). + first_type_id = nr_btf_types(base); + } // Let's cycle through whatever is described in the BTF section // and emit libabigail IR for it. @@ -421,13 +564,10 @@ public: type_or_decl_base_sptr result; const btf_type *t = nullptr; - if ((result = lookup_artifact_from_btf_id(type_id))) - return result; + t = btf__type_by_id(btf_handle(), type_id); - if (type_id == 0) - result = build_ir_node_for_void_type(); - else - t = btf__type_by_id(btf_handle(), type_id); + if ((result = lookup_artifact_from_btf_type(t))) + return result; if (!result) { @@ -436,6 +576,11 @@ public: switch(type_kind) { + case BTF_KIND_UNKN/* Unknown: This is really for the void + type. */: + result = build_ir_node_for_void_type(); + break; + case BTF_KIND_INT/* Integer */: result = build_int_type(type_id); break; @@ -500,8 +645,6 @@ public: #endif case BTF_KIND_DATASEC/* Section */: break; - case BTF_KIND_UNKN/* Unknown */: - break; default: ABG_ASSERT_NOT_REACHED; break; @@ -511,9 +654,9 @@ public: add_decl_to_scope(is_decl(result), cur_tu()->get_global_scope()); if (type_base_sptr type = is_type(result)) - schedule_type_for_canonocalization(type); + schedule_type_for_canonicalization(type); - associate_artifact_to_btf_type_id(result, type_id); + associate_artifact_to_btf_type(result, t); if (function_decl_sptr fn = is_function_decl(result)) add_fn_to_exported_or_undefined_decls(fn.get()); @@ -531,7 +674,7 @@ public: { type_base_sptr t = env().get_void_type(); add_decl_to_scope(is_decl(t), cur_tu()->get_global_scope()); - canonicalize(t); + schedule_type_for_canonicalization(t); return t; } @@ -543,7 +686,7 @@ public: { type_base_sptr t = env().get_void_pointer_type(); add_decl_to_scope(is_decl(t), cur_tu()->get_global_scope()); - canonicalize(t); + schedule_type_for_canonicalization(t); return t; } @@ -556,7 +699,7 @@ public: type_base_sptr t = env().get_variadic_parameter_type(); add_decl_to_scope(is_decl(t), cur_tu()->get_global_scope()); decl_base_sptr t_decl = get_type_declaration(t); - canonicalize(t); + schedule_type_for_canonicalization(t); return t; } @@ -649,7 +792,7 @@ public: result->set_is_anonymous(is_anonymous); result->set_is_artificial(true); add_decl_to_scope(result, cur_tu()->get_global_scope()); - canonicalize(result); + schedule_type_for_canonicalization(result); return result; } @@ -806,7 +949,7 @@ public: subrange->is_non_finite(!arr->nelems); subrange->set_size_in_bits(cur_tu()->get_address_size()); add_decl_to_scope(subrange, cur_tu()->get_global_scope()); - canonicalize(subrange); + schedule_type_for_canonicalization(subrange); array_type_def::subranges_type subranges = {subrange}; array_type_def_sptr result(new array_type_def(underlying_type, subranges, location())); @@ -900,7 +1043,7 @@ public: add_decl_to_scope(result, cur_tu()->get_global_scope()); - associate_artifact_to_btf_type_id(result, type_id); + associate_artifact_to_btf_type(result, t); // For defined classes and unions, add data members to the type // being built. @@ -963,7 +1106,7 @@ public: /*alignment=*/0)); result->set_return_type(return_type); - associate_artifact_to_btf_type_id(result, type_id); + associate_artifact_to_btf_type(result, t); uint16_t nb_parms = btf_vlen(t); const struct btf_param* parm = diff --git a/src/abg-tools-utils.cc b/src/abg-tools-utils.cc index d24fdc61..c42073cb 100644 --- a/src/abg-tools-utils.cc +++ b/src/abg-tools-utils.cc @@ -3230,7 +3230,8 @@ create_best_elf_based_reader(const string& elf_file_path, { #ifdef WITH_BTF if (file_has_btf_debug_info(elf_file_path, debug_info_root_paths)) - result = btf::create_reader(elf_file_path, debug_info_root_paths, env); + result = btf::create_reader(elf_file_path, debug_info_root_paths, env, + show_all_types, linux_kernel_mode); #endif } else @@ -3249,7 +3250,8 @@ create_best_elf_based_reader(const string& elf_file_path, && file_has_btf_debug_info(elf_file_path, debug_info_root_paths)) // The file has BTF debug info and no BTF, let's use the BTF // front-end even if it wasn't formally requested by the user. - result = btf::create_reader(elf_file_path, debug_info_root_paths, env); + result = btf::create_reader(elf_file_path, debug_info_root_paths, env, + show_all_types, linux_kernel_mode); #endif } From patchwork Tue Jul 16 14:55:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 93995 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 AC9DA3849ACB for ; Tue, 16 Jul 2024 14:55:57 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by sourceware.org (Postfix) with ESMTPS id 8FF5B384A432 for ; Tue, 16 Jul 2024 14:55:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8FF5B384A432 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8FF5B384A432 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4b98:dc4:8::226 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141748; cv=none; b=dGxBwJvAETVDOap37Eh/BTHnI4MBZ34UDNQVN45RYKH5NEvjHv6nw9BGVp4KUHiqhOTetv8pdZTKCWakfasvz2imYcYPhMYj+YJSspWnriA4xinvEnJw26/FjsJzuTS4PSkPvP6RNW+A6lURkywrhmuQWGRLX/SEB2CE7vNmNWI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141748; c=relaxed/simple; bh=Bz43rcvLf212Wu9a/toaLR7m/LMwMdVjNMJ9SQvT0uo=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=gOuD9uSHhY4el28L4CADGSO2aL9+5vXKZYZAJd0KaKveOBAznTJgEX+CwxByIZQcahPi21/XxkQBJFxl0hVMuZ/191ugOUoV4qO2OQhvccJOE1fXBemK7G8GUNt+IDJVHGoNLJaNTJSWG+zF0nNiy79XZbQBEg/uWadrzQDp0Dg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id E43BBC000A; Tue, 16 Jul 2024 14:55:41 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 3A415C1B791F; Tue, 16 Jul 2024 16:55:41 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 04/17] corpus: Support adding translation units with empty path Date: Tue, 16 Jul 2024 16:55:15 +0200 Message-ID: <20240716145541.473065-5-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240716145541.473065-1-dodji@redhat.com> References: <20240716145541.473065-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli The CTF front-end produces an artificial translation unit with an empty path for all the types in a given ABI corpus. Adding such a translation unit to its corpus is conditioned on it having a non-empty path. Oops. Fixed thus. * src/abg-corpus.cc (corpus::add): Do not require that the path of the translation unit be non-empty. Signed-off-by: Dodji Seketeli --- src/abg-corpus.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/abg-corpus.cc b/src/abg-corpus.cc index 1239deb0..994307fb 100644 --- a/src/abg-corpus.cc +++ b/src/abg-corpus.cc @@ -14,6 +14,7 @@ #include #include #include +#include #include "abg-internal.h" @@ -724,14 +725,11 @@ corpus::add(const translation_unit_sptr& tu) { ABG_ASSERT(priv_->members.insert(tu).second); - if (!tu->get_absolute_path().empty()) - { - // Update the path -> translation_unit map. - string_tu_map_type::const_iterator i = - priv_->path_tu_map.find(tu->get_absolute_path()); - ABG_ASSERT(i == priv_->path_tu_map.end()); - priv_->path_tu_map[tu->get_absolute_path()] = tu; - } + // Update the path -> translation_unit map. + string_tu_map_type::const_iterator i = + priv_->path_tu_map.find(tu->get_absolute_path()); + ABG_ASSERT(i == priv_->path_tu_map.end()); + priv_->path_tu_map[tu->get_absolute_path()] = tu; tu->set_corpus(this); } From patchwork Tue Jul 16 14:55:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 93997 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 5237D384403E for ; Tue, 16 Jul 2024 14:56:19 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by sourceware.org (Postfix) with ESMTPS id D50C6384A056 for ; Tue, 16 Jul 2024 14:55:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D50C6384A056 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D50C6384A056 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4b98:dc4:8::226 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141749; cv=none; b=Mdn1RCXlypIa2WSsNJZ7zt8JGj3rAzw9w+Ih5Ro0IOj5IKPE0+dg01TlFMRPOgvWGnI+aWDmzlSY6VGWj5dsz6LxESlYmzwbZ9UssfQyjpv3a3/WSBEgRob+OoWP22UOrVqp808YoalilRBemHPcaflVqEPvm9WFeoMgw9Ol4Wg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141749; c=relaxed/simple; bh=nw9ZqHNpCMoP1I8wMIRk6sdEzu5dczULyhdxQqSlB6o=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=eaFVKnbdguV6KE+CoXHpanbRPK9WM1uvxHe79lM/g5NenMfLtqnr49vV1LsQUxrdDFjnXwlhF3IsQAfQmN0REwDpMYzmCw3nKztAIR5c5rv4mKdB2Ihx+I5JCgndz9ctdfrNO/CKIfuYwrbUjVxGruXWgNdn58/Y01PG8uTzdVI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id DB210C0008; Tue, 16 Jul 2024 14:55:42 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 3C2D7C1B792C; Tue, 16 Jul 2024 16:55:41 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 05/17] ctf-reader: Do not set data member offsets for unions Date: Tue, 16 Jul 2024 16:55:16 +0200 Message-ID: <20240716145541.473065-6-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240716145541.473065-1-dodji@redhat.com> References: <20240716145541.473065-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli All union data members should have an offset set to 0. It turns out the CTF reader unnecessarily sets the data member offset. This patch fixes that. * src/abg-ctf-reader.cc (process_ctf_sou_members): Do not set any union data member offset. Signed-off-by: Dodji Seketeli --- src/abg-ctf-reader.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/abg-ctf-reader.cc b/src/abg-ctf-reader.cc index 4b6c6cd8..3dc09b29 100644 --- a/src/abg-ctf-reader.cc +++ b/src/abg-ctf-reader.cc @@ -1087,7 +1087,7 @@ process_ctf_sou_members(reader *rdr, public_access, true /* is_laid_out */, false /* is_static */, - membinfo.ctm_offset); + is_union_type(sou) ? 0 : membinfo.ctm_offset); } if (ctf_errno(ctf_dictionary) != ECTF_NEXT_END) fprintf(stderr, "ERROR from ctf_member_next\n"); From patchwork Tue Jul 16 14:55:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 94006 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 360E0384A05B for ; Tue, 16 Jul 2024 14:57:06 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by sourceware.org (Postfix) with ESMTPS id 665313846068 for ; Tue, 16 Jul 2024 14:55:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 665313846068 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 665313846068 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4b98:dc4:8::227 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141751; cv=none; b=PyHjG3cMqhFT+RNxqABPoVSPUp4uqSTwdqmEcbhZmtz4+taBuXUNsp1BiGM/o3YsnGHMVIP3dGYHxrDeJF1biXsbMLsTVWfc4Ni/Hesotgo3QV1R3kpwo8bhfVcK6yRSV67AUV8SJ93NlqEMz0PsRtR8w0Urq6ohr0D7tQCkQIg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141751; c=relaxed/simple; bh=V0Bk7xxg44FKOF+/fJMxQsTyJhYDl3SjQcUI1k9xnAs=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=sCxR6AQnF+4Y29/QbdOhMBN64O8rXA/evZkcJ/14M73DfEGHhNsQ8l2QRev5S2xTMBTo3ObuPT01kml1pQVQTPRA7s2rIMdnxiE5wEQwxyHHK5OY0YY3rX/QEanlJA/Zi90r/OH6dyyI605Tnh/x03XTkRIkYCY+/DBoI92HFrk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id 12B7A2000E; Tue, 16 Jul 2024 14:55:42 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 3E1A2C1B7B48; Tue, 16 Jul 2024 16:55:41 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 06/17] ctf-reader: During re-initialization, only clear canonicalize-able types Date: Tue, 16 Jul 2024 16:55:17 +0200 Message-ID: <20240716145541.473065-7-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240716145541.473065-1-dodji@redhat.com> References: <20240716145541.473065-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli The patch https://sourceware.org/git/?p=libabigail.git;a=commit;h=666555665cc4fcfc8ae19661c489822e0df00ae3 introduced a mistake: It frees the CTF archive object during the re-initialization of the reader between each binary (kernel or module). The archive contains CTF type information for a kernel and all its modules. So it should be kept around until all those binaries are analyzed. Instead, that patch frees the CTF archive object after handling each binary. Oops. This patch fixes that problem by free-ing the CTF archive only when the reader itself is freed, presumably, after analyzing all binaries. Similarly, the type map maintained by the reader contains types for the kernel and all its modules. So it should not be freed at re-initialization time. Rather, what should be freed is only the types that are to be canonicalized at the end of processing of a given binary. So the patch makes the reader maintain types to be canonicalized in a vector and clears that vector at each re-initialization. At re-initialization time, the patch also avoids resetting the corpus group that the current reader feeds. * src/abg-ctf-reader.cc (reader::types_to_canonicalize): Add data member. (reader::add_type): Add the new type to the vector of types to be canonicalized. Update comment. (reader::canonicalize_all_types): Now that the reader maintains the vector of types to be canonicalized, just pass that vector to canonicalize_types. reader::types_map contains all the types that have been created in all the binaries processed by this reader so far. Many of these types have already been canonicalized at the end of the analysis of binaries that have already been processed. Only the types created during the processing of the current binary have not yet be canonicalized and reader::types_to_canonicalize is where they are maintained. So reader::types_map should be left alone by this function. (reader::initialize): Do not close the CTF archive here. Do not clear reader::{types_map, corpus_group} either. (reader::read_corpus): Use nullptr, not NULL. Make sure to not re-open an archive that has already been opened. (reader::~reader): Mark a closed archive. This is more cosmetic than anything else. Signed-off-by: Dodji Seketeli --- src/abg-ctf-reader.cc | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/abg-ctf-reader.cc b/src/abg-ctf-reader.cc index 3dc09b29..c93608ca 100644 --- a/src/abg-ctf-reader.cc +++ b/src/abg-ctf-reader.cc @@ -145,6 +145,7 @@ class reader : public elf_based_reader /// A map associating CTF type ids with libabigail IR types. This /// is used to reuse already generated types. string_type_base_sptr_map_type types_map; + vector types_to_canonicalize; /// A set associating unknown CTF type ids std::set unknown_types_set; @@ -167,6 +168,10 @@ public: /// Associate a given CTF type ID with a given libabigail IR type. /// + /// The IR type is a newly created type that needs to be + /// canonicalized at the end of the processing of the current + /// corpus. + /// /// @param dic the dictionnary the type belongs to. /// /// @param ctf_type the type ID. @@ -176,7 +181,8 @@ public: add_type(ctf_dict_t *dic, ctf_id_t ctf_type, type_base_sptr type) { string key = dic_type_key(dic, ctf_type); - types_map.insert(std::make_pair(key, type)); + if (types_map.insert(std::make_pair(key, type)).second) + types_to_canonicalize.push_back(type); } /// Insert a given CTF unknown type ID. @@ -216,12 +222,8 @@ public: void canonicalize_all_types(void) { - vector types; - for (const auto& entry : types_map) - types.push_back(entry.second); - canonicalize_types - (types.begin(), types.end(), + (types_to_canonicalize.begin(), types_to_canonicalize.end(), [](vector::iterator& i) {return *i;}); } @@ -262,14 +264,8 @@ public: void initialize() { - if (ctfa) - { - ctf_close(ctfa); - ctfa = nullptr; - } - types_map.clear(); + types_to_canonicalize.clear(); cur_tu_.reset(); - corpus_group().reset(); } /// Initializer of the reader. @@ -697,7 +693,7 @@ public: if ((corp->get_origin() & corpus::LINUX_KERNEL_BINARY_ORIGIN) && corpus_group()) { - if (ctfa == NULL) + if (ctfa == nullptr) { std::string ctfa_filename; if (find_ctfa_file(ctfa_filename)) @@ -709,8 +705,9 @@ public: and process the CTF archive in the read context, if any. Information about the types, variables, functions, etc contained in the archive are added to the given corpus. */ - ctfa = ctf_arc_bufopen(&ctf_sect, &symtab_sect, - &strtab_sect, &errp); + if (ctfa == nullptr) + ctfa = ctf_arc_bufopen(&ctf_sect, &symtab_sect, + &strtab_sect, &errp); if (do_log()) { @@ -749,6 +746,7 @@ public: ~reader() { ctf_close(ctfa); + ctfa = nullptr; } }; // end class reader. From patchwork Tue Jul 16 14:55:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 93999 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 47609384477B for ; Tue, 16 Jul 2024 14:56:35 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by sourceware.org (Postfix) with ESMTPS id 5DABA3846425 for ; Tue, 16 Jul 2024 14:55:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5DABA3846425 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5DABA3846425 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.70.183.197 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141750; cv=none; b=DG8ehgOGYHZpah3QxY+gJHJDbEqp4ySN3gArHf95yh3gZsH34cVAkv2np7f0AvcwxElTBMmSYEHOwqic9pchMJ4F2jHgqTD7f8ymvk2ACbETxurSdvzzHYWDxQKC0c4jsLFX8t8izzT3haxsgNhAuuFT09iyvci7lRjgWNJCD9w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141750; c=relaxed/simple; bh=FlPKcopuWeazEXjnHAb9tDOpmBxdoRCR5WGXSlVBnEo=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=bhU77zH5kkqSOZc2iPWaN5VLMbB7XRzNEvwHsWWDoNGD1jSac+jCjoWq1meoWSQM9F7alV7mCr6AY8X4OVpuFcKeFDBBBKKr4kK4JlgtvaOFGJpiXdh3t5OWrqkXYLWZ+cWIFZEAQ0+ksLkfTylrru/AvaTnPyc/beURSvijbxA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id 1893C1C0008; Tue, 16 Jul 2024 14:55:42 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 400FCC1B7B49; Tue, 16 Jul 2024 16:55:41 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 07/17] ctf-reader: Fix analyzing single kernel binaries Date: Tue, 16 Jul 2024 16:55:18 +0200 Message-ID: <20240716145541.473065-8-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240716145541.473065-1-dodji@redhat.com> References: <20240716145541.473065-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli Analyzing a single kernel binary has been broken for a long time, it seems. For the record, I mean this: $ abidw --ctf vmlinux > vmlinux.ctf.abi Doesn't work. This patch fixes ctf::reader::slurp_elf_info to make it not crash on binaries that have no CTF sections because there is a .ctfa file in the same directory. Also, it fixes ctf::reader::read_corpus to support loading the CTF archive for individual kernel binaries and not just for entire trees (corpus groups). In the case of individual kernel binaries, the archive can be built from the CTF sections of the binary. * src/abg-ctf-reader.cc (reader::slurp_elf_info): Do not crash on a kernel binary that has no CTF section because the CTF information is in a .ctfa file in the same directory. (reader::read_corpus): Support loading a CTF archive for a single kernel binary. Also, support loading the CTF archive from the CTF sections in the binary itself not necessarily from a .ctfa file in the same directory. Signed-off-by: Dodji Seketeli --- src/abg-ctf-reader.cc | 51 ++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/src/abg-ctf-reader.cc b/src/abg-ctf-reader.cc index c93608ca..fd5a8a58 100644 --- a/src/abg-ctf-reader.cc +++ b/src/abg-ctf-reader.cc @@ -383,15 +383,6 @@ public: elf::reader::read_corpus(status); corpus_sptr corp = corpus(); - if ((corp->get_origin() & corpus::LINUX_KERNEL_BINARY_ORIGIN) - && corpus_group()) - { - // Not finding any debug info so far is expected if we are - // building a kABI. - status &= static_cast - (~STATUS_DEBUG_INFO_NOT_FOUND); - return; - } if ((status & STATUS_NO_SYMBOLS_FOUND) || !(status & STATUS_OK)) @@ -415,17 +406,29 @@ public: } const Elf_Scn* ctf_scn = find_ctf_section(); - fill_ctf_section(ctf_scn, &ctf_sect); + if (ctf_scn) + fill_ctf_section(ctf_scn, &ctf_sect); const Elf_Scn* symtab_scn = elf_helpers::find_section_by_name(elf_handle(), symtab_name); - fill_ctf_section(symtab_scn, &symtab_sect); + if (symtab_scn) + fill_ctf_section(symtab_scn, &symtab_sect); const Elf_Scn* strtab_scn = elf_helpers::find_section_by_name(elf_handle(), strtab_name); - fill_ctf_section(strtab_scn, &strtab_sect); + if (strtab_scn) + fill_ctf_section(strtab_scn, &strtab_sect); - status |= fe_iface::STATUS_OK; + if (ctf_scn && symtab_scn && strtab_scn) + status |= fe_iface::STATUS_OK; + else if (corp->get_origin() & corpus::LINUX_KERNEL_BINARY_ORIGIN) + { + // Not finding any debug info so far is expected if we are + // building a kABI. + status &= static_cast + (~STATUS_DEBUG_INFO_NOT_FOUND); + return; + } } /// Process a CTF archive and create libabigail IR for the types, @@ -690,8 +693,7 @@ public: t.start(); int errp; - if ((corp->get_origin() & corpus::LINUX_KERNEL_BINARY_ORIGIN) - && corpus_group()) + if (corp->get_origin() & corpus::LINUX_KERNEL_BINARY_ORIGIN) { if (ctfa == nullptr) { @@ -700,14 +702,17 @@ public: ctfa = ctf_arc_open(ctfa_filename.c_str(), &errp); } } - else - /* Build the ctfa from the contents of the relevant ELF sections, - and process the CTF archive in the read context, if any. - Information about the types, variables, functions, etc contained - in the archive are added to the given corpus. */ - if (ctfa == nullptr) - ctfa = ctf_arc_bufopen(&ctf_sect, &symtab_sect, - &strtab_sect, &errp); + + /* Build the ctfa from the contents of the relevant ELF sections, + and process the CTF archive in the read context, if any. + Information about the types, variables, functions, etc contained + in the archive are added to the given corpus. */ + if (ctfa == nullptr + && ctf_sect.cts_data + && symtab_sect.cts_data + && strtab_sect.cts_data) + ctfa = ctf_arc_bufopen(&ctf_sect, &symtab_sect, + &strtab_sect, &errp); if (do_log()) { From patchwork Tue Jul 16 14:55:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 94001 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 48F75386D61A for ; Tue, 16 Jul 2024 14:56:40 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::229]) by sourceware.org (Postfix) with ESMTPS id 60A473846086 for ; Tue, 16 Jul 2024 14:55:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 60A473846086 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 60A473846086 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4b98:dc4:8::229 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141750; cv=none; b=X5JSdT0JJNGbOofeLWIi+O0KyFrpws/yHNRYXjSRXPX56F0XWEP7GFuI/p0WfPFItHMOCRzaYPw9hH4MS67V72xyRXl1Xm7b+SxLoZ6qtycmky4xIuesCKVweyZ1HEG6g2uZW8TFdGYmesFi9p/hUW+NC320j09kW4Assa69JmQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141750; c=relaxed/simple; bh=pGYeazs3Woqq5uSLFgFEwO64KmmtKGf9ZhXVq4I6vLM=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=BHU8j5EnFqY/owxnMoH/MSv9/nH0b/BiYQgkYYP7thQn7YXaw0RTj7ry8vUMWJ3UKSA+WhXDLM4wP2o7TB7V+rM8kDJlp4vM9i3Q8N74957f9VKtk2BZqUwacsu+Tm0B1FZlomEKA2br2o1Yn3tBxKSLqa5CmDqtbXNvUXsAxaI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id 08900FF803; Tue, 16 Jul 2024 14:55:42 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 4225BC1B7B4B; Tue, 16 Jul 2024 16:55:41 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 08/17] reader: Fix corpus group reading Date: Tue, 16 Jul 2024 16:55:19 +0200 Message-ID: <20240716145541.473065-9-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240716145541.473065-1-dodji@redhat.com> References: <20240716145541.473065-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli Reading of corpus group is broken in the ABIXML reader. Only the main corpus is read and then, abixml::reader::read_corpus_group_from_input fails to read subsequent corpora. This patch fixes abixml::reader::read_corpus_group_from_input and makes it call a new abixml::reader::initialize function, much like what the ELF based readers are doing. * src/abg-fe-iface.cc (fe_iface::priv::initialize): Do not clear the corpus group upon initialization. * src/abg-reader.cc (reader::initialize): Define new function. Make it call fe_iface::initialize. (reader::clear_per_corpus_data): Remove. (reader::read_corpus): Remove call to clear_per_corpus_data. (reader::read_corpus_group_from_input): After calling reader::read_corpus and adding the resulting corpus to the group, get the next sibling XML element node. If it's an "abi-corpus" node then re-initialize the reader by invoking the new reader::initialize and move on to read it by invoking reader::read_corpus again. * tests/data/test-diff-suppr/test45-abi-report-1.txt: Adjust. Signed-off-by: Dodji Seketeli --- src/abg-fe-iface.cc | 1 - src/abg-reader.cc | 43 +++++++++++-------- .../test-diff-suppr/test45-abi-report-1.txt | 4 +- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/abg-fe-iface.cc b/src/abg-fe-iface.cc index caf81dc0..e44d1126 100644 --- a/src/abg-fe-iface.cc +++ b/src/abg-fe-iface.cc @@ -46,7 +46,6 @@ struct fe_iface::priv corpus_path.clear(); dt_soname.clear(); suppressions.clear(); - corpus_group.reset(); corpus.reset(); } }; //end struct fe_iface::priv diff --git a/src/abg-reader.cc b/src/abg-reader.cc index ee578639..f64dd86d 100644 --- a/src/abg-reader.cc +++ b/src/abg-reader.cc @@ -187,6 +187,22 @@ public: { } + /// The initializer of the reader. + /// + /// Resets the reader so that it can be re-used to read another + /// binary and build a corpus that is part of the same corpus group. + /// + /// In other words, the same reader is used to analyse all the + /// binaries that are part of the same corpus group. + /// + /// @param corpus_path the new corpus path. + void + initialize(const string& corpus_path) + { + fe_iface::initialize(corpus_path); + clear_types_to_canonicalize(); + } + /// Test if logging was requested. /// /// @return true iff logging was requested. @@ -888,18 +904,6 @@ public: { } - /// Clear all the data that must absolutely be cleared at the end of - /// the parsing of an ABI corpus. - void - clear_per_corpus_data() - { - clear_type_map(); - clear_types_to_canonicalize(); - clear_xml_node_decl_map(); - clear_id_xml_node_map(); - clear_decls_stack(); - } - #ifdef WITH_DEBUG_SELF_COMPARISON /// Perform a debugging routine for the "self-comparison" mode. /// @@ -1177,9 +1181,6 @@ public: get_environment().set_self_comparison_debug_input(corpus()); #endif - if (!corpus_group()) - clear_per_corpus_data(); - ir::corpus& corp = *corpus(); corp.set_origin(corpus::NATIVE_XML_ORIGIN); @@ -1237,9 +1238,6 @@ public: get_environment().set_self_comparison_debug_input(corpus()); #endif - if (!corpus_group()) - clear_per_corpus_data(); - ir::corpus& corp = *corpus(); corp.set_origin(corpus::NATIVE_XML_ORIGIN); @@ -2310,7 +2308,14 @@ read_corpus_group_from_input(fe_iface& iface) corpus_sptr corp; fe_iface::status sts; while ((corp = rdr.read_corpus(sts))) - rdr.corpus_group()->add_corpus(corp); + { + rdr.corpus_group()->add_corpus(corp); + node = xmlNextElementSibling(node); + if (!node || !xmlStrEqual(node->name, BAD_CAST("abi-corpus"))) + break; + rdr.initialize(""); + rdr.set_corpus_node(node); + } xmlTextReaderNext(reader.get()); diff --git a/tests/data/test-diff-suppr/test45-abi-report-1.txt b/tests/data/test-diff-suppr/test45-abi-report-1.txt index 9666a8fd..1c743c6d 100644 --- a/tests/data/test-diff-suppr/test45-abi-report-1.txt +++ b/tests/data/test-diff-suppr/test45-abi-report-1.txt @@ -1,3 +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 +Functions changes summary: 0 Removed (142 filtered out), 0 Changed (1 filtered out), 0 Added functions +Variables changes summary: 0 Removed (1 filtered out), 0 Changed, 0 Added variable From patchwork Tue Jul 16 14:55:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 94002 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 8692A3846086 for ; Tue, 16 Jul 2024 14:56:42 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::222]) by sourceware.org (Postfix) with ESMTPS id 6441B3846099 for ; Tue, 16 Jul 2024 14:55:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6441B3846099 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6441B3846099 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4b98:dc4:8::222 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141751; cv=none; b=a92GyM6/66+el8jOppLPu0vAVRSLS0gBPOcyvqI+u/rYLPIF1NbNeM064TZkRt6h7cgwx3a1nbgR+VGpHWGaI3AxGXDYKFenq5P2lbmp0KxShVVgN1j/y5JlQqpSjqkCUtRFXCNiyrZW83URGkezEK4sg4xda1NZSmWfdKL648s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141751; c=relaxed/simple; bh=78w63Ci1q4XDcSph640+n1ejacEiZyo+MGJxTz11XLA=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=IpIjP0GAagBtxXMBElY99hKlKtPqlSlRNPchuNAw5SMoFHx5BhTK/+rFnB3rA/XuJarm6HCG0CAsyyukmw0QOAIwQ6S6r7o3LPymN1pL/CvlN88H6+4X2LJMn+1iBp1zE74vpFI8rHOaDR3KdRmkVUvqYNQwyrrX3/FH5EoEH94= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id 05BD540009; Tue, 16 Jul 2024 14:55:42 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 443E9C1B7B5D; Tue, 16 Jul 2024 16:55:41 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 09/17] reader: Simplify type canonicalization invocation Date: Tue, 16 Jul 2024 16:55:20 +0200 Message-ID: <20240716145541.473065-10-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240716145541.473065-1-dodji@redhat.com> References: <20240716145541.473065-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli The ABIXML reader currently canonicalizes some (simple) types directly and schedules canonicalization of other types for after the corpus has been built. This dual mode of operation was used back then when ABIXML types were not aggressively de-duplicated as they are now. Today, type canonicalization needs to happen in the same way for all readers. This patch thus schedules type canonicalization for after the creation of the corpus, in the ABIXML reader. * src/abg-reader.cc (reader::maybe_canonicalize_type): Remove. (reader::schedule_type_for_canonicalization): Do not schedule nullptr types for canonicalization. (reader::perform_type_canonicalization): Rename perform_late_type_canonicalizing into this. (reader::{read_corpus, build_or_get_type_decl}): Adjust call to maybe_canonicalize_type into schedule_type_for_canonicalization. (read_translation_unit_from_file) (read_translation_unit_from_buffer, read_translation_unit) (build_function_decl, build_ir_node_for_void_type) (build_array_type_def, build_ir_node_for_void_pointer_type) (build_class_decl, build_union_decl) (build_class_tdecl, build_type_tparameter, build_type_composition) (build_template_tparameter, build_type, handle_type_decl) (handle_qualified_type_decl, handle_pointer_type_def) (handle_reference_type_def, handle_function_type) (handle_array_type_def, handle_enum_type_decl) (handle_typedef_decl, handle_class_decl, handle_union_decl): Likewise. Signed-off-by: Dodji Seketeli --- src/abg-reader.cc | 125 ++++++++++++---------------------------------- 1 file changed, 32 insertions(+), 93 deletions(-) diff --git a/src/abg-reader.cc b/src/abg-reader.cc index f64dd86d..a65d62ec 100644 --- a/src/abg-reader.cc +++ b/src/abg-reader.cc @@ -973,82 +973,22 @@ public: } #endif - /// Test if a type should be canonicalized early. If so, - /// canonicalize it right away. Otherwise, schedule it for late - /// canonicalizing; that is, schedule it so that it's going to be - /// canonicalized when the translation unit is fully read. - /// - /// @param t the type to consider for canonicalizing. - void - maybe_canonicalize_type(type_base_sptr t, - bool force_delay = false) - { - if (!t) - return; - - if (t->get_canonical_type()) - return; - - // If this class has some non-canonicalized sub type, then wait - // for the when we've read all the translation unit to - // canonicalize all of its non-canonicalized sub types and then we - // can canonicalize this one. - // - // Also, if this is a declaration-only class, wait for the end of - // the translation unit reading so that we have its definition and - // then we'll use that for canonicalizing it. - if (!force_delay - && !type_has_non_canonicalized_subtype(t) - && !is_class_type(t) - && !is_union_type(t) - // Below are types that *must* be canonicalized only after - // they are added to their context; but then this function - // might be called to early, before they are actually added to - // their context. - // - // TODO: make sure this function is called after types are - // added to their context, so that we can try to - // early-canonicalize some of these types, reducing the size - // of the set of types to put on the side, waiting for being - // canonicalized. - && !is_method_type(t) - && !is_reference_type(t) - && !is_pointer_type(t) - && !is_array_type(t) - && !is_qualified_type(t) - && !is_typedef(t) - && !is_enum_type(t) - && !is_function_type(t)) - { - canonicalize(t); -#ifdef WITH_DEBUG_SELF_COMPARISON - maybe_check_abixml_canonical_type_stability(t); -#endif - } - else - { - // We do not want to try to canonicalize a class type that - // hasn't been properly added to its context. - if (class_decl_sptr c = is_class_type(t)) - ABG_ASSERT(c->get_scope()); - - schedule_type_for_late_canonicalizing(t); - } - } - /// Schedule a type for being canonicalized after the current /// translation unit is read. /// /// @param t the type to consider for canonicalization. void - schedule_type_for_late_canonicalizing(type_base_sptr t) - {m_types_to_canonicalize.push_back(t);} + schedule_type_for_canonicalization(type_base_sptr t) + { + if (t) + m_types_to_canonicalize.push_back(t); + } /// Perform the canonicalizing of types that ought to be done after /// the current translation unit is read. This function is called /// when the current corpus is fully built. void - perform_late_type_canonicalizing() + perform_type_canonicalization() { canonicalize_types(m_types_to_canonicalize.begin(), m_types_to_canonicalize.end(), @@ -1316,7 +1256,7 @@ public: t.start(); } - perform_late_type_canonicalizing(); + perform_type_canonicalization(); if (do_log()) { @@ -1686,7 +1626,7 @@ reader::build_or_get_type_decl(const string& id, bool add_decl_to_scope) if (add_decl_to_scope) pop_scope_or_abort(scope); - maybe_canonicalize_type(t, !add_decl_to_scope); + schedule_type_for_canonicalization(t); } return t; } @@ -2381,7 +2321,7 @@ read_translation_unit_from_file(const string& input_file, reader rdr(xml::new_reader_from_file(input_file), env); translation_unit_sptr tu = read_translation_unit_from_input(rdr); env.canonicalization_is_done(false); - rdr.perform_late_type_canonicalizing(); + rdr.perform_type_canonicalization(); env.canonicalization_is_done(true); return tu; } @@ -2403,7 +2343,7 @@ read_translation_unit_from_buffer(const string& buffer, reader rdr(xml::new_reader_from_buffer(buffer), env); translation_unit_sptr tu = read_translation_unit_from_input(rdr); env.canonicalization_is_done(false); - rdr.perform_late_type_canonicalizing(); + rdr.perform_type_canonicalization(); env.canonicalization_is_done(true); return tu; } @@ -2421,7 +2361,7 @@ read_translation_unit(fe_iface& iface) abixml::reader& rdr = dynamic_cast(iface); translation_unit_sptr tu = read_translation_unit_from_input(rdr); rdr.options().env.canonicalization_is_done(false); - rdr.perform_late_type_canonicalizing(); + rdr.perform_type_canonicalization(); rdr.options().env.canonicalization_is_done(true); return tu; } @@ -3761,7 +3701,7 @@ build_function_decl(reader& rdr, rdr.get_translation_unit()->bind_function_type_life_time(fn_type); - rdr.maybe_canonicalize_type(fn_type, !add_to_current_scope); + rdr.schedule_type_for_canonicalization(fn_type); if (add_to_exported_decls) rdr.add_fn_to_exported_or_undefined_decls(fn_decl.get()); @@ -4025,7 +3965,7 @@ build_ir_node_for_void_type(reader& rdr) type_base_sptr t = env.get_void_type(); add_decl_to_scope(is_decl(t), rdr.get_translation_unit()->get_global_scope()); decl_base_sptr type_declaration = get_type_declaration(t); - canonicalize(t); + rdr.schedule_type_for_canonicalization(t); return type_declaration; } @@ -4048,7 +3988,7 @@ build_ir_node_for_void_pointer_type(reader& rdr) type_base_sptr t = env.get_void_pointer_type(); add_decl_to_scope(is_decl(t), rdr.get_translation_unit()->get_global_scope()); decl_base_sptr type_declaration = get_type_declaration(t); - canonicalize(t); + rdr.schedule_type_for_canonicalization(t); return type_declaration; } @@ -4792,7 +4732,7 @@ build_array_type_def(reader& rdr, if (add_to_current_scope) { add_decl_to_scope(s, rdr.get_cur_scope()); - rdr.maybe_canonicalize_type(s); + rdr.schedule_type_for_canonicalization(s); } subranges.push_back(s); } @@ -5352,7 +5292,7 @@ build_class_decl(reader& rdr, decl_base_sptr td = get_type_declaration(t); ABG_ASSERT(td); set_member_access_specifier(td, access); - rdr.maybe_canonicalize_type(t, !add_to_current_scope); + rdr.schedule_type_for_canonicalization(t); xml_char_sptr i= XML_NODE_GET_ATTRIBUTE(p, "id"); string id = CHAR_STR(i); ABG_ASSERT(!id.empty()); @@ -5729,7 +5669,7 @@ build_union_decl(reader& rdr, decl_base_sptr td = get_type_declaration(t); ABG_ASSERT(td); set_member_access_specifier(td, access); - rdr.maybe_canonicalize_type(t, !add_to_current_scope); + rdr.schedule_type_for_canonicalization(t); xml_char_sptr i= XML_NODE_GET_ATTRIBUTE(p, "id"); string id = CHAR_STR(i); ABG_ASSERT(!id.empty()); @@ -6007,7 +5947,7 @@ build_class_tdecl(reader& rdr, add_to_current_scope)) { if (c->get_scope()) - rdr.maybe_canonicalize_type(c, /*force_delay=*/false); + rdr.schedule_type_for_canonicalization(c); class_tmpl->set_pattern(c); } } @@ -6072,7 +6012,7 @@ build_type_tparameter(reader& rdr, else rdr.push_and_key_type_decl(result, node, /*add_to_current_scope=*/true); - rdr.maybe_canonicalize_type(result, /*force_delay=*/false); + rdr.schedule_type_for_canonicalization(result); return result; } @@ -6123,8 +6063,7 @@ build_type_composition(reader& rdr, build_qualified_type_decl(rdr, n, /*add_to_current_scope=*/true))) { - rdr.maybe_canonicalize_type(composed_type, - /*force_delay=*/true); + rdr.schedule_type_for_canonicalization(composed_type); result->set_composed_type(composed_type); break; } @@ -6248,7 +6187,7 @@ build_template_tparameter(reader& rdr, if (result) { rdr.key_type_decl(result, id); - rdr.maybe_canonicalize_type(result, /*force_delay=*/false); + rdr.schedule_type_for_canonicalization(result); } return result; @@ -6328,7 +6267,7 @@ build_type(reader& rdr, MAYBE_MAP_TYPE_WITH_TYPE_ID(t, node); if (t) - rdr.maybe_canonicalize_type(t,/*force_delay=*/false ); + rdr.schedule_type_for_canonicalization(t); return t; } @@ -6345,7 +6284,7 @@ handle_type_decl(reader& rdr, type_decl_sptr decl = build_type_decl(rdr, node, add_to_current_scope); MAYBE_MAP_TYPE_WITH_TYPE_ID(decl, node); if (decl && decl->get_scope()) - rdr.maybe_canonicalize_type(decl, /*force_delay=*/false); + rdr.schedule_type_for_canonicalization(decl); return decl; } @@ -6379,7 +6318,7 @@ handle_qualified_type_decl(reader& rdr, add_to_current_scope); MAYBE_MAP_TYPE_WITH_TYPE_ID(decl, node); if (decl && decl->get_scope()) - rdr.maybe_canonicalize_type(decl, /*force_delay=*/false); + rdr.schedule_type_for_canonicalization(decl); return decl; } @@ -6397,7 +6336,7 @@ handle_pointer_type_def(reader& rdr, add_to_current_scope); MAYBE_MAP_TYPE_WITH_TYPE_ID(decl, node); if (decl && decl->get_scope()) - rdr.maybe_canonicalize_type(decl, /*force_delay=*/false); + rdr.schedule_type_for_canonicalization(decl); return decl; } @@ -6415,7 +6354,7 @@ handle_reference_type_def(reader& rdr, add_to_current_scope); MAYBE_MAP_TYPE_WITH_TYPE_ID(decl, node); if (decl && decl->get_scope()) - rdr.maybe_canonicalize_type(decl, /*force_delay=*/false); + rdr.schedule_type_for_canonicalization(decl); return decl; } @@ -6432,7 +6371,7 @@ handle_function_type(reader& rdr, function_type_sptr type = build_function_type(rdr, node, add_to_current_scope); MAYBE_MAP_TYPE_WITH_TYPE_ID(type, node); - rdr.maybe_canonicalize_type(type, /*force_delay=*/true); + rdr.schedule_type_for_canonicalization(type); return type; } @@ -6449,7 +6388,7 @@ handle_array_type_def(reader& rdr, array_type_def_sptr decl = build_array_type_def(rdr, node, add_to_current_scope); MAYBE_MAP_TYPE_WITH_TYPE_ID(decl, node); - rdr.maybe_canonicalize_type(decl, /*force_delay=*/false); + rdr.schedule_type_for_canonicalization(decl); return decl; } @@ -6466,7 +6405,7 @@ handle_enum_type_decl(reader& rdr, add_to_current_scope); MAYBE_MAP_TYPE_WITH_TYPE_ID(decl, node); if (decl && decl->get_scope()) - rdr.maybe_canonicalize_type(decl, /*force_delay=*/false); + rdr.schedule_type_for_canonicalization(decl); return decl; } @@ -6482,7 +6421,7 @@ handle_typedef_decl(reader& rdr, add_to_current_scope); MAYBE_MAP_TYPE_WITH_TYPE_ID(decl, node); if (decl && decl->get_scope()) - rdr.maybe_canonicalize_type(decl, /*force_delay=*/false); + rdr.schedule_type_for_canonicalization(decl); return decl; } @@ -6536,7 +6475,7 @@ handle_class_decl(reader& rdr, build_class_decl_if_not_suppressed(rdr, node, add_to_current_scope); MAYBE_MAP_TYPE_WITH_TYPE_ID(is_type(decl), node); if (decl && decl->get_scope()) - rdr.maybe_canonicalize_type(decl, /*force_delay=*/false); + rdr.schedule_type_for_canonicalization(decl); return decl; } @@ -6555,7 +6494,7 @@ handle_union_decl(reader& rdr, build_union_decl_if_not_suppressed(rdr, node, add_to_current_scope); MAYBE_MAP_TYPE_WITH_TYPE_ID(is_type(decl), node); if (decl && decl->get_scope()) - rdr.maybe_canonicalize_type(decl, /*force_delay=*/false); + rdr.schedule_type_for_canonicalization(decl); return decl; } From patchwork Tue Jul 16 14:55:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 93998 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 ADC4A386C5B0 for ; Tue, 16 Jul 2024 14:56:32 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by sourceware.org (Postfix) with ESMTPS id 554E1384A43C for ; Tue, 16 Jul 2024 14:55:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 554E1384A43C Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 554E1384A43C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.70.183.194 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141749; cv=none; b=eTOysTky05qeaf0qbjftZ8QUzQNPljiR7raE14WRRsO5bH+GLP+P05vKDl6r1KvKMRWPsRym2iY7UTDkYvA5xYweEfM5cMxeRfSiEIWSck0WcqG0c9ibFoQ0XgvwPsiWdiDKupR7R2c8IPoGA9n1+S2NRDehh6YeAFg/SyulCbE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141749; c=relaxed/simple; bh=0A2Hu2GqrGFJrxv2IfPs0OtxC9z5ubVfzQgQDZtZSDs=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Y2Rfz/SW4g3KgUULmQZiJsmPCWx93YbFDPXHEQn0Y0hu0+dsT5q9hfnl1H6+PIRr60jl5jqoFJRhykyBr6ODMhBY0Roh7RM4a99Q6KrXvEnGiQ++CDf3tYYFQlDhTrSBXBPk/OZzVKk+3Y9EbWhbAjhJRIlCoDG0qo7l1F8sfK8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id 03C3440007; Tue, 16 Jul 2024 14:55:42 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 460EEC1B7B60; Tue, 16 Jul 2024 16:55:41 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 10/17] reader: Simplify logic of get_or_read_and_add_translation_unit Date: Tue, 16 Jul 2024 16:55:21 +0200 Message-ID: <20240716145541.473065-11-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240716145541.473065-1-dodji@redhat.com> References: <20240716145541.473065-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli * src/abg-reader.cc (get_or_read_and_add_translation_unit): Simplify logic. Signed-off-by: Dodji Seketeli --- src/abg-reader.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/abg-reader.cc b/src/abg-reader.cc index a65d62ec..8b4007f5 100644 --- a/src/abg-reader.cc +++ b/src/abg-reader.cc @@ -1750,14 +1750,11 @@ get_or_read_and_add_translation_unit(reader& rdr, xmlNodePtr node) string tu_path; xml::xml_char_sptr path_str = XML_NODE_GET_ATTRIBUTE(node, "path"); - if (path_str) + if (corp && !corp->is_empty()) { - tu_path = reinterpret_cast(path_str.get()); - ABG_ASSERT(!tu_path.empty()); - - if (corp && !corp->is_empty()) - tu = corp->find_translation_unit(tu_path); - + if (path_str.get()) + tu_path = reinterpret_cast(path_str.get()); + tu = corp->find_translation_unit(tu_path); if (tu) return tu; } From patchwork Tue Jul 16 14:55:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 94000 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 287873849AC6 for ; Tue, 16 Jul 2024 14:56:36 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by sourceware.org (Postfix) with ESMTPS id 748B8386C595 for ; Tue, 16 Jul 2024 14:55:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 748B8386C595 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 748B8386C595 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.70.183.200 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141750; cv=none; b=NsjFrV57FdFLvbhqI9zX+L9g4c3EjrSDXkJfNKmiokx1h0FSB+rXIohU8O2cS38md8QR9osTUM+mDARxDcmxtb752GMfPEHtMN/j7oOFwM7FItBFBGgKqaoKevAGvzSsItNT8BBmdTXzoL8wp1FQ8hW3oLlC5bbdoAn0c3U/pUY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141750; c=relaxed/simple; bh=RReMnoUBDksjNZTJFwoDzoBJB1jpyKL/oA72Yz8cs9U=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Sk4O3htxgx4qYsZZOIEuNPoC0b9ZY+ReCN7hMd6Nkr11nAqyTp1k3qyT4Sb7pJt3CLh8zcCyUpgE/2igiMgelzOCnkxAoInoDLZTSFEAC3G7qhVIOJYFL72AfqNXEJQsHzV/BXhnxkKUC19MpzUCHVvl6w1QyrLQbNh39XY+kpM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id 13DAF20010; Tue, 16 Jul 2024 14:55:42 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 4813EC1B7B61; Tue, 16 Jul 2024 16:55:41 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 11/17] reader: Fix building of void and void pointer types Date: Tue, 16 Jul 2024 16:55:22 +0200 Message-ID: <20240716145541.473065-12-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240716145541.473065-1-dodji@redhat.com> References: <20240716145541.473065-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli build_ir_node_for_void_pointer_type and build_ir_node_for_void_type get the type IR from the environment, add it to the global scope of the current translation unit and schedule it for type canonicalization. This patch change the code of these functions so that the adding to the scope and the canonicalization are done only on the first invocation of these functions. Subsequent invocations just return the type IR. Otherwise, subsequent invocations were unnecessarily trying to add the type IR to yet another global scope and were trying to canonicalize it again. * src/abg-reader.cc (build_ir_node_for_void_pointer_type) (build_ir_node_for_void_type): Add the type to its scope and schedule it for canonicalization just once. Signed-off-by: Dodji Seketeli --- src/abg-reader.cc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/abg-reader.cc b/src/abg-reader.cc index 8b4007f5..9ae4cac2 100644 --- a/src/abg-reader.cc +++ b/src/abg-reader.cc @@ -3960,9 +3960,13 @@ build_ir_node_for_void_type(reader& rdr) const environment& env = rdr.get_environment(); type_base_sptr t = env.get_void_type(); - add_decl_to_scope(is_decl(t), rdr.get_translation_unit()->get_global_scope()); + if (!get_type_scope(t)) + { + add_decl_to_scope(is_decl(t), + rdr.get_translation_unit()->get_global_scope()); + rdr.schedule_type_for_canonicalization(t); + } decl_base_sptr type_declaration = get_type_declaration(t); - rdr.schedule_type_for_canonicalization(t); return type_declaration; } @@ -3980,12 +3984,16 @@ build_ir_node_for_void_type(reader& rdr) static decl_base_sptr build_ir_node_for_void_pointer_type(reader& rdr) { - const environment& env = rdr.get_environment(); + const environment& env = rdr.get_environment(); type_base_sptr t = env.get_void_pointer_type(); - add_decl_to_scope(is_decl(t), rdr.get_translation_unit()->get_global_scope()); + if (!get_type_scope(t)) + { + add_decl_to_scope(is_decl(t), + rdr.get_translation_unit()->get_global_scope()); + rdr.schedule_type_for_canonicalization(t); + } decl_base_sptr type_declaration = get_type_declaration(t); - rdr.schedule_type_for_canonicalization(t); return type_declaration; } From patchwork Tue Jul 16 14:55:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 94007 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 912E63846425 for ; Tue, 16 Jul 2024 14:57:16 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by sourceware.org (Postfix) with ESMTPS id 5A44B384A050 for ; Tue, 16 Jul 2024 14:55:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5A44B384A050 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5A44B384A050 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141756; cv=none; b=Fik2Ry7NFnyhJmmm6vxDMyAxOyQExSLO4ayQ+8y4ojoO0CPAbMMHRh7vNEk3rnIzZzvqQhtWgHUuKrFRoPxYZQWf6yE1m3zOvXx7JMm4l9L8GBTVxLGQbUqx96NOL2SFZiCQRloe8KPDWi+ytCo/6INxYQ1T+zwjfjbit3+DUFg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721141756; c=relaxed/simple; bh=PtGjEjk4ozOPUgYlpHNI51AMsRfqOO5qQIz03Gj03To=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=vr5eTy5V213b31GhHUITGtUT697dVQaNW0Wxpn0ah05mAhr01vvdz71MpJhXILOQaO/NggJPDRsiNz89DnvkYtOxuCC8HfNBTRL8PyoqrOUx0yqVdu5od1Qo18zDRp+HQW95A423jonMeRn07BHyxgdEfZLQHp2zvvoX4cow1sw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id 1ED15C0009; Tue, 16 Jul 2024 14:55:43 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 4CB94C1B7B62; Tue, 16 Jul 2024 16:55:41 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 12/17] reader: Fix building of variadic parameter type Date: Tue, 16 Jul 2024 16:55:23 +0200 Message-ID: <20240716145541.473065-13-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240716145541.473065-1-dodji@redhat.com> References: <20240716145541.473065-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SCC_5_SHORT_WORD_LINES, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli variadic parameter type is not added to its proper scope, leading to issues down the road. Fixed thus. * src/abg-ir-priv.h (type_topo_comp::operator()): Do not compare types using their location anymore. It's unnecessary (now that types are sorted before canonicalization) and it wreaks havoc with the new properly constructed variadic parameter types. * src/abg-reader.cc (build_ir_node_for_variadic_parameter_type): Define new function. Add variadic parameter type to the global scope of the current translation unit. (build_function_parameter, build_type_decl): Use the new build_ir_node_for_variadic_parameter_type. * tests/data/test-read-write/test17.xml: Adjust. * tests/data/test-read-write/test19.xml: Likewise. * tests/data/test-read-write/test20.xml: Likewise. * tests/data/test-read-write/test21.xml: Likewise. * tests/data/test-read-write/test22.xml: Likewise. * tests/data/test-read-write/test23.xml: Likewise. * tests/data/test-read-write/test25.xml: Likewise. * tests/data/test-read-write/test26.xml: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. Signed-off-by: Dodji Seketeli --- src/abg-ir-priv.h | 9 - src/abg-reader.cc | 28 +- tests/data/test-read-write/test17.xml | 44 +- tests/data/test-read-write/test19.xml | 12 +- tests/data/test-read-write/test20.xml | 68 +- tests/data/test-read-write/test21.xml | 14 +- tests/data/test-read-write/test22.xml | 1 + tests/data/test-read-write/test23.xml | 1 + tests/data/test-read-write/test25.xml | 46 +- tests/data/test-read-write/test26.xml | 16 +- .../test28-without-std-fns-ref.xml | 937 +++++++++--------- .../test28-without-std-vars-ref.xml | 865 ++++++++-------- 12 files changed, 1030 insertions(+), 1011 deletions(-) diff --git a/src/abg-ir-priv.h b/src/abg-ir-priv.h index a9002561..bf8cf36f 100644 --- a/src/abg-ir-priv.h +++ b/src/abg-ir-priv.h @@ -1435,15 +1435,6 @@ struct type_topo_comp if (f == s || !f || !s) return false; - // If both decls come from an abixml file, keep the order they - // have from that abixml file. - if (is_decl(f) && is_decl(s) - && ((!f->get_corpus() && !s->get_corpus()) - || (f->get_corpus()->get_origin() == corpus::NATIVE_XML_ORIGIN - && (s->get_corpus()->get_origin() - == corpus::NATIVE_XML_ORIGIN)))) - return compare_using_locations(is_decl(f), is_decl(s)); - bool f_is_ptr_ref_or_qual = is_ptr_ref_or_qual_type(f); bool s_is_ptr_ref_or_qual = is_ptr_ref_or_qual_type(s); diff --git a/src/abg-reader.cc b/src/abg-reader.cc index 9ae4cac2..2d06302e 100644 --- a/src/abg-reader.cc +++ b/src/abg-reader.cc @@ -111,6 +111,9 @@ build_ir_node_for_void_type(reader& rdr); static decl_base_sptr build_ir_node_for_void_pointer_type(reader& rdr); +static decl_base_sptr +build_ir_node_for_variadic_parameter_type(reader& rdr); + static void resolve_symbol_aliases(string_elf_symbols_map_sptr& fn_syms, string_elf_symbols_map_sptr& var_syms, @@ -3545,7 +3548,7 @@ build_function_parameter(reader& rdr, const xmlNodePtr node) type_base_sptr type; if (is_variadic) - type = rdr.get_environment().get_variadic_parameter_type(); + type = is_type(build_ir_node_for_variadic_parameter_type(rdr)); else { ABG_ASSERT(!type_id.empty()); @@ -3997,6 +4000,27 @@ build_ir_node_for_void_pointer_type(reader& rdr) return type_declaration; } +/// Build the IR node for a variadic parameter type. +/// +/// @param rdr the ABIXML reader to use. +/// +/// @return the variadic parameter type. +static decl_base_sptr +build_ir_node_for_variadic_parameter_type(reader& rdr) +{ + const environment& env = rdr.get_environment(); + + type_base_sptr t = env.get_variadic_parameter_type(); + if (!get_type_scope(t)) + { + add_decl_to_scope(is_decl(t), + rdr.get_translation_unit()->get_global_scope()); + rdr.schedule_type_for_canonicalization(t); + } + decl_base_sptr type_declaration = get_type_declaration(t); + return type_declaration; +} + /// Build a type_decl from a "type-decl" XML Node. /// /// @param rdr the context of the parsing. @@ -4067,7 +4091,7 @@ build_type_decl(reader& rdr, const environment& env = rdr.get_environment(); type_decl_sptr decl; if (name == env.get_variadic_parameter_type_name()) - decl = is_type_decl(env.get_variadic_parameter_type()); + decl = is_type_decl(build_ir_node_for_variadic_parameter_type(rdr)); else if (name == "void") decl = is_type_decl(build_ir_node_for_void_type(rdr)); else diff --git a/tests/data/test-read-write/test17.xml b/tests/data/test-read-write/test17.xml index 739f7cfd..9442f0a3 100644 --- a/tests/data/test-read-write/test17.xml +++ b/tests/data/test-read-write/test17.xml @@ -1,15 +1,8 @@ - - - - - - - - + - + @@ -19,32 +12,39 @@ - - + + - - + + - - + + - - - + + + - - - - + + + + + + + + + + + diff --git a/tests/data/test-read-write/test19.xml b/tests/data/test-read-write/test19.xml index 619076db..255db9f8 100644 --- a/tests/data/test-read-write/test19.xml +++ b/tests/data/test-read-write/test19.xml @@ -1,22 +1,22 @@ - - + - + - + - + - + + diff --git a/tests/data/test-read-write/test20.xml b/tests/data/test-read-write/test20.xml index 8439bf90..ebdaf005 100644 --- a/tests/data/test-read-write/test20.xml +++ b/tests/data/test-read-write/test20.xml @@ -1,84 +1,84 @@ - - - - + - + - - + + - - + + - + - + - - + + - - + + - + - + - - + + - - + + - - - - + + + + - + - - + + - + + + + + - - - + + - + - + diff --git a/tests/data/test-read-write/test21.xml b/tests/data/test-read-write/test21.xml index 5dada1d2..c9170a5f 100644 --- a/tests/data/test-read-write/test21.xml +++ b/tests/data/test-read-write/test21.xml @@ -1,11 +1,10 @@ - - + - + - + @@ -34,9 +33,10 @@ - - - + + + + diff --git a/tests/data/test-read-write/test22.xml b/tests/data/test-read-write/test22.xml index e40c4666..bd707d0e 100644 --- a/tests/data/test-read-write/test22.xml +++ b/tests/data/test-read-write/test22.xml @@ -16,5 +16,6 @@ + diff --git a/tests/data/test-read-write/test23.xml b/tests/data/test-read-write/test23.xml index 5c44d203..e36dda7e 100644 --- a/tests/data/test-read-write/test23.xml +++ b/tests/data/test-read-write/test23.xml @@ -16,5 +16,6 @@ + diff --git a/tests/data/test-read-write/test25.xml b/tests/data/test-read-write/test25.xml index f8b0abbb..4d37bec5 100644 --- a/tests/data/test-read-write/test25.xml +++ b/tests/data/test-read-write/test25.xml @@ -6,45 +6,45 @@ - + + + + + + + + + + + + + + + + - + - + - + - - - - - - - - - - - - - - - - + - - + + - + diff --git a/tests/data/test-read-write/test26.xml b/tests/data/test-read-write/test26.xml index 975c1c68..f715c48c 100644 --- a/tests/data/test-read-write/test26.xml +++ b/tests/data/test-read-write/test26.xml @@ -6,24 +6,24 @@ - + - + - + - + - + - - - + + + diff --git a/tests/data/test-read-write/test28-without-std-fns-ref.xml b/tests/data/test-read-write/test28-without-std-fns-ref.xml index cbcba4c1..51bd5fff 100644 --- a/tests/data/test-read-write/test28-without-std-fns-ref.xml +++ b/tests/data/test-read-write/test28-without-std-fns-ref.xml @@ -12,147 +12,45 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + - + - + - + - + - + - + @@ -197,629 +95,732 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + - + + + + - - + + - + - - - - - - - - - - - + + + + + + + + + + - + - + - + - + - - - - - - - - - - + + - + - + - + - + - - - - - - - - - - + - + - + + + + + + + - - + - + - + - - + + - + + + + - + - + + + + + + + - + - - + + - - + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - + + - - - + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - + + + + + + + - + - + - - - - + + + + - - - - - + + + + + - - + + - - - - - + + + + + - + - + - - + + - - - + + + - + - - + + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - + + + + + - - + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - + - + - + - + - - - + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - - + + + + - - + + - + - - - + + + - - - + + + - - + + - - + + - - + + - + - - + + - + diff --git a/tests/data/test-read-write/test28-without-std-vars-ref.xml b/tests/data/test-read-write/test28-without-std-vars-ref.xml index 8e0c84b2..52a220a9 100644 --- a/tests/data/test-read-write/test28-without-std-vars-ref.xml +++ b/tests/data/test-read-write/test28-without-std-vars-ref.xml @@ -12,147 +12,45 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + - + - + - + - + - + - + @@ -197,538 +95,641 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + - + + + + - - + + - - - - - - - - - - - - - + + + - - - + - + - + - + - + - - - - + - + - + + + + - - + - + - + - - + + - + + + + + + + - + - + + + + - + - - + + - - + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - + + - - - + + + - - + + - - - - - - - + + + + + + + - - + + - + + + + + + + - + - + - - - - + + + + - - - - - + + + + + - - + + - - - - - + + + + + - + - + - - + + - - - + + + - + - - + + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - + + + + + - - + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - + - + - + - + - - - + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - - + + + + - - + + - + - - - + + + - - - + + + - - + + - - + + - - + + - + - - + + - + From patchwork Tue Jul 16 14:55:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 94010 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 F2EDC384A43C for ; Tue, 16 Jul 2024 15:14:55 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mslow1.mail.gandi.net (mslow1.mail.gandi.net [217.70.178.240]) by sourceware.org (Postfix) with ESMTPS id 118293861808 for ; Tue, 16 Jul 2024 15:06:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 118293861808 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 118293861808 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.70.178.240 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721142400; cv=none; b=a8hQID8sChaI712xpu0+LzemclrhrBFdBJg8Zpp5LyhWw+fpErI/CgTALpUbWGVWHD/mpPeqH/05zkHaOAKZIhbofSeWg3eu5yZvyM1mN6qIEFPNBnUF68EUD0cg+Bj9ILLiOEXDYlF9B4TV1XSZMBJ0n2KChFqYiZMDENIuofU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721142400; c=relaxed/simple; bh=lF8UGuMdkCo8ksrJsPbao4zt7tFOWTsEXXBgXeLxhag=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Yv4AK4yUTbvtrWt0tptZkfhxWK5zHZwXgW/+LLEzBsH5xVEq/rVIwm9R/JxJa3EKNbROLUsevIhC08u+qP1IcRf/bpsGuVnZTKOMnY3kJ/54/aYvFFNfOrCu8H4jUP+vt6huy66Bk6pRDmeWcRSpyExzrDhdcLfWxhuLgkBkCXo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from relay3-d.mail.gandi.net (unknown [217.70.183.195]) by mslow1.mail.gandi.net (Postfix) with ESMTP id 5C294C2379 for ; Tue, 16 Jul 2024 14:59:57 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 2EEF560003; Tue, 16 Jul 2024 14:55:43 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 82D0DC1B7B65; Tue, 16 Jul 2024 16:55:41 +0200 (CEST) From: dodji@redhat.com To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 13/17] ir: Don't strip typedefs from parms and return type when comparing fns Date: Tue, 16 Jul 2024 16:55:24 +0200 Message-ID: <20240716145541.473065-14-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240716145541.473065-1-dodji@redhat.com> References: <20240716145541.473065-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Mailman-Approved-At: Tue, 16 Jul 2024 15:11:51 +0000 X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org From: Dodji Seketeli As we are now sorting types so that they are always compared in the same order during canonicalization, irrespective of the front-end, I believe stripping typedefs from function parameteres and return types during comparison is no more necessary. And also, that removes so spurious changes reports. * src/abg-ir.cc (equals): In the overloads from function_type and function_decl::parameter, do not strip typedefs off of types becore comparing them. * tests/data/test-abidiff-exit/PR30329/PR30329-report-1.txt: Adjust. * tests/data/test-abidiff-exit/PR30503/libsdl/libsdl-1.2.60-1.2.64-report.txt: Adjust. * tests/data/test-abidiff-exit/PR31513/reported/PR31513-reported-report-1.txt: Adjust. * tests/data/test-abidiff-exit/PR31513/reported/PR31513-reported-report-2.txt: Adjust. * tests/data/test-annotate/test14-pr18893.so.abi: Adjust. * tests/data/test-annotate/test15-pr18892.so.abi: Adjust. * tests/data/test-annotate/test17-pr19027.so.abi: Adjust. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Adjust. * tests/data/test-diff-dwarf/test2-report.txt: Adjust. * tests/data/test-diff-filter/test3-report.txt: Adjust. * tests/data/test-diff-pkg-ctf/gmp-6.x.x86_64-report-0.txt: Adjust. * tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Adjust. * tests/data/test-read-dwarf/test-libandroid.so.abi: Adjust. * tests/data/test-read-dwarf/test14-pr18893.so.abi: Adjust. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Adjust. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Adjust. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Adjust. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Adjust. Signed-off-by: Dodji Seketeli --- src/abg-ir.cc | 9 +- .../PR30329/PR30329-report-1.txt | 4 +- .../libsdl/libsdl-1.2.60-1.2.64-report.txt | 2 +- .../reported/PR31513-reported-report-1.txt | 2 +- .../reported/PR31513-reported-report-2.txt | 2 +- .../data/test-annotate/test14-pr18893.so.abi | 267 +- .../data/test-annotate/test15-pr18892.so.abi | 4703 +++--- .../data/test-annotate/test17-pr19027.so.abi | 7401 ++++----- ...19-pr19023-libtcmalloc_and_profiler.so.abi | 5197 +++--- tests/data/test-diff-dwarf/test2-report.txt | 11 + tests/data/test-diff-filter/test3-report.txt | 2 +- .../gmp-6.x.x86_64-report-0.txt | 2 +- .../data/test-read-dwarf/PR25007-sdhci.ko.abi | 4202 ++--- .../test-read-dwarf/test-libandroid.so.abi | 26 +- .../test-read-dwarf/test14-pr18893.so.abi | 262 +- .../test-read-dwarf/test15-pr18892.so.abi | 4497 ++--- .../test-read-dwarf/test17-pr19027.so.abi | 7133 ++++---- ...19-pr19023-libtcmalloc_and_profiler.so.abi | 5173 +++--- .../test22-pr19097-libstdc++.so.6.0.17.so.abi | 13659 ++++++++-------- 19 files changed, 26591 insertions(+), 25963 deletions(-) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index d62addda..81476a00 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -21384,9 +21384,7 @@ equals(const function_type& l, const function_type& r, change_kind* k) // TODO: We should also do this for parameter types, or rather, // we should teach the equality operators in the IR, at some // point, to peel typedefs off. - if (peel_typedef_type(l.get_return_type()) - != - peel_typedef_type(r.get_return_type())) + if (l.get_return_type() != r.get_return_type()) { result = false; if (k) @@ -22757,8 +22755,9 @@ equals(const function_decl::parameter& l, ABG_RETURN_FALSE; } - type_base_sptr l_type = peel_typedef_type(l.get_type()); - type_base_sptr r_type = peel_typedef_type(r.get_type()); + type_base_sptr l_type = l.get_type(); + type_base_sptr r_type = r.get_type(); + if (l_type != r_type) { result = false; diff --git a/tests/data/test-abidiff-exit/PR30329/PR30329-report-1.txt b/tests/data/test-abidiff-exit/PR30329/PR30329-report-1.txt index f83d9a11..7efe452f 100644 --- a/tests/data/test-abidiff-exit/PR30329/PR30329-report-1.txt +++ b/tests/data/test-abidiff-exit/PR30329/PR30329-report-1.txt @@ -1,4 +1,4 @@ -Functions changes summary: 0 Removed, 1 Changed (145 filtered out), 1 Added functions +Functions changes summary: 0 Removed, 1 Changed (148 filtered out), 1 Added functions Variables changes summary: 0 Removed, 0 Changed, 0 Added variable 1 Added function: @@ -22,7 +22,7 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable in pointed to type 'typedef sqlite3' at sqlite3.c:578:1: underlying type 'struct sqlite3' at sqlite3.c:16840:1 changed: type size changed from 6464 to 6528 (in bits) - 29 data member changes (6 filtered): + 29 data member changes (7 filtered): type of 'Vdbe* pVdbe' changed: in pointed to type 'struct Vdbe' at sqlite3.c:22731:1: type size hasn't changed diff --git a/tests/data/test-abidiff-exit/PR30503/libsdl/libsdl-1.2.60-1.2.64-report.txt b/tests/data/test-abidiff-exit/PR30503/libsdl/libsdl-1.2.60-1.2.64-report.txt index 73a38f9f..6d7dd686 100644 --- a/tests/data/test-abidiff-exit/PR30503/libsdl/libsdl-1.2.60-1.2.64-report.txt +++ b/tests/data/test-abidiff-exit/PR30503/libsdl/libsdl-1.2.60-1.2.64-report.txt @@ -12,7 +12,7 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable type of 'void (* filters[10])(SDL_AudioCVT*, Uint16)' changed: array element type 'void (*)(SDL_AudioCVT*, Uint16)' changed: entity changed from 'void (*)(SDL_AudioCVT*, Uint16)' to compatible type 'typedef SDL12_AudioCVTFilter' at SDL12_compat.c:903:1 - in pointed to type 'function type void (SDL_AudioCVT*, SDL_AudioFormat)': + in pointed to type 'function type void (SDL_AudioCVT*, unsigned short int)': parameter 1 of type 'SDL_AudioCVT*' changed: in pointed to type 'struct SDL_AudioCVT' at SDL12_compat.c:907:1: type name changed from 'SDL_AudioCVT' to 'SDL12_AudioCVT' diff --git a/tests/data/test-abidiff-exit/PR31513/reported/PR31513-reported-report-1.txt b/tests/data/test-abidiff-exit/PR31513/reported/PR31513-reported-report-1.txt index 152ade89..97a60244 100644 --- a/tests/data/test-abidiff-exit/PR31513/reported/PR31513-reported-report-1.txt +++ b/tests/data/test-abidiff-exit/PR31513/reported/PR31513-reported-report-1.txt @@ -1,4 +1,4 @@ -Functions changes summary: 16 Removed, 0 Changed (20 filtered out), 21 Added functions +Functions changes summary: 16 Removed, 0 Changed (22 filtered out), 21 Added functions Variables changes summary: 0 Removed, 0 Changed, 0 Added variable Function symbols changes summary: 2 Removed, 2 Added function symbols not referenced by debug info Variable symbols changes summary: 0 Removed, 0 Added variable symbol not referenced by debug info diff --git a/tests/data/test-abidiff-exit/PR31513/reported/PR31513-reported-report-2.txt b/tests/data/test-abidiff-exit/PR31513/reported/PR31513-reported-report-2.txt index b8e9599b..783108f0 100644 --- a/tests/data/test-abidiff-exit/PR31513/reported/PR31513-reported-report-2.txt +++ b/tests/data/test-abidiff-exit/PR31513/reported/PR31513-reported-report-2.txt @@ -1,4 +1,4 @@ -Functions changes summary: 0 Removed (16 filtered out), 0 Changed (20 filtered out), 0 Added (21 filtered out) functions +Functions changes summary: 0 Removed (16 filtered out), 0 Changed (22 filtered out), 0 Added (21 filtered out) functions Variables changes summary: 0 Removed, 0 Changed, 0 Added variable Function symbols changes summary: 0 Removed (2 filtered out), 0 Added (2 filtered out) function symbols not referenced by debug info Variable symbols changes summary: 0 Removed, 0 Added variable symbol not referenced by debug info diff --git a/tests/data/test-annotate/test14-pr18893.so.abi b/tests/data/test-annotate/test14-pr18893.so.abi index 7a63b4e4..36467e24 100644 --- a/tests/data/test-annotate/test14-pr18893.so.abi +++ b/tests/data/test-annotate/test14-pr18893.so.abi @@ -6673,7 +6673,7 @@ - + @@ -6688,22 +6688,22 @@ - + - + - + - + - + @@ -6711,9 +6711,9 @@ - + - + @@ -6727,13 +6727,13 @@ - + - + - + @@ -6741,14 +6741,14 @@ - + - + - + - + @@ -6756,15 +6756,15 @@ - + - + - + @@ -6772,23 +6772,25 @@ - + - + - + + + - + - + - + - + - + - + @@ -6796,7 +6798,7 @@ - + @@ -6804,23 +6806,23 @@ - + - + - + - + @@ -6831,18 +6833,18 @@ - + - + - + @@ -6855,7 +6857,7 @@ - + @@ -6866,9 +6868,9 @@ - + - + @@ -6877,7 +6879,7 @@ - + @@ -6886,35 +6888,35 @@ - + - + - + - + - + @@ -6923,12 +6925,12 @@ - + - + @@ -6936,8 +6938,17 @@ + + + + + + + + + - + @@ -6948,21 +6959,21 @@ - + - + - + @@ -6971,9 +6982,9 @@ - + - + @@ -6984,9 +6995,9 @@ - + - + @@ -6999,7 +7010,7 @@ - + @@ -7008,7 +7019,7 @@ - + @@ -7017,21 +7028,21 @@ - + - + - + - + - + @@ -7040,23 +7051,23 @@ - + - + - + - + - + @@ -7071,7 +7082,7 @@ - + @@ -7094,7 +7105,7 @@ - + @@ -7111,9 +7122,9 @@ - + - + @@ -7136,9 +7147,9 @@ - + - + @@ -7155,11 +7166,11 @@ - + - + - + @@ -7182,11 +7193,11 @@ - + - + - + @@ -7203,23 +7214,23 @@ - + - + - + - + - + - + - + - + - + @@ -7278,17 +7289,17 @@ - + - + - + - + - + @@ -7301,17 +7312,17 @@ - + - + - + - + - + @@ -7326,23 +7337,23 @@ - + - + - + - + - + - + - + - + @@ -7357,14 +7368,14 @@ - + - + @@ -7383,37 +7394,37 @@ - + - + - + - + - + - + - + - + - + @@ -7424,7 +7435,7 @@ - + @@ -7433,7 +7444,7 @@ - + @@ -7442,7 +7453,7 @@ - + @@ -7451,7 +7462,7 @@ - + @@ -7460,7 +7471,7 @@ - + @@ -7477,7 +7488,7 @@ - + @@ -7492,7 +7503,7 @@ - + @@ -7511,7 +7522,7 @@ - + @@ -7522,7 +7533,7 @@ - + @@ -7535,14 +7546,14 @@ - + - + - + diff --git a/tests/data/test-annotate/test15-pr18892.so.abi b/tests/data/test-annotate/test15-pr18892.so.abi index 626c584e..baba0ef8 100644 --- a/tests/data/test-annotate/test15-pr18892.so.abi +++ b/tests/data/test-annotate/test15-pr18892.so.abi @@ -7699,356 +7699,356 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -8056,614 +8056,620 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + - + - + - + - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -8671,33 +8677,33 @@ - + - + - + - + - + - + - + - + - + - + - + - + @@ -8715,13 +8721,13 @@ - + - + - + - + @@ -8729,11 +8735,11 @@ - + - + @@ -8751,17 +8757,17 @@ - + - + - + - + - + - + @@ -8769,7 +8775,7 @@ - + @@ -8801,31 +8807,31 @@ - + - + - + - + - + - + - + - + - + - + @@ -8833,31 +8839,31 @@ - + - + - + - + - + - + - + - + - + - + @@ -8865,21 +8871,21 @@ - + - + - + - + - + - + - + - + @@ -8887,35 +8893,35 @@ - + - + - + - + - + - + - + - + - + - + @@ -8935,47 +8941,47 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -8999,11 +9005,11 @@ - + - + - + @@ -9017,17 +9023,17 @@ - + - + - + @@ -9035,7 +9041,7 @@ - + @@ -9043,7 +9049,7 @@ - + @@ -9057,19 +9063,19 @@ - + - + - + - + - + - + - + @@ -9079,87 +9085,87 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -9193,15 +9199,15 @@ - + - + - + @@ -9223,13 +9229,13 @@ - + - + - + - + @@ -9245,9 +9251,9 @@ - + - + @@ -9255,17 +9261,17 @@ - + - + - + - + - + @@ -9397,7 +9403,7 @@ - + @@ -9408,7 +9414,7 @@ - + @@ -9421,7 +9427,7 @@ - + @@ -9471,7 +9477,7 @@ - + @@ -9482,7 +9488,7 @@ - + @@ -9495,7 +9501,7 @@ - + @@ -9530,7 +9536,7 @@ - + @@ -9539,14 +9545,14 @@ - + - + @@ -9555,7 +9561,7 @@ - + @@ -9576,14 +9582,14 @@ - + - + @@ -9596,7 +9602,7 @@ - + @@ -9605,7 +9611,7 @@ - + @@ -9616,7 +9622,7 @@ - + @@ -9627,7 +9633,7 @@ - + @@ -9636,7 +9642,7 @@ - + @@ -9647,7 +9653,7 @@ - + @@ -9658,7 +9664,7 @@ - + @@ -9891,7 +9897,7 @@ - + @@ -9902,14 +9908,14 @@ - + - + @@ -9918,18 +9924,18 @@ - + - + - + @@ -9944,13 +9950,13 @@ - + - + @@ -9961,13 +9967,13 @@ - + - + @@ -9980,13 +9986,13 @@ - + - + @@ -10036,7 +10042,7 @@ - + @@ -10045,7 +10051,7 @@ - + @@ -10054,7 +10060,7 @@ - + @@ -10063,7 +10069,7 @@ - + @@ -10092,16 +10098,16 @@ - + - + - + @@ -10110,16 +10116,16 @@ - + - + - + @@ -10166,7 +10172,7 @@ - + @@ -10177,7 +10183,7 @@ - + @@ -10186,7 +10192,7 @@ - + @@ -10197,7 +10203,7 @@ - + @@ -10210,7 +10216,7 @@ - + @@ -10227,7 +10233,7 @@ - + @@ -10238,7 +10244,7 @@ - + @@ -10251,7 +10257,7 @@ - + @@ -10342,11 +10348,11 @@ - + - + - + @@ -10355,11 +10361,11 @@ - + - + - + @@ -10368,16 +10374,16 @@ - + - + - + @@ -10386,13 +10392,13 @@ - + - + - + @@ -10401,7 +10407,7 @@ - + @@ -10410,7 +10416,7 @@ - + @@ -10419,7 +10425,7 @@ - + @@ -10428,7 +10434,7 @@ - + @@ -10439,21 +10445,21 @@ - + - + - + @@ -10462,16 +10468,16 @@ - + - + - + @@ -10480,11 +10486,11 @@ - + - + @@ -10544,20 +10550,20 @@ - + - + - + @@ -10643,7 +10649,7 @@ - + @@ -10652,14 +10658,14 @@ - + - + @@ -10668,7 +10674,7 @@ - + @@ -10677,7 +10683,7 @@ - + @@ -10686,7 +10692,7 @@ - + @@ -10697,9 +10703,9 @@ - + - + @@ -10717,7 +10723,7 @@ - + @@ -10780,9 +10786,9 @@ - + - + @@ -10843,9 +10849,9 @@ - + - + @@ -10854,9 +10860,9 @@ - + - + @@ -10865,9 +10871,9 @@ - + - + @@ -10957,7 +10963,7 @@ - + @@ -10966,16 +10972,16 @@ - + - + - + @@ -10984,9 +10990,9 @@ - + - + @@ -10999,13 +11005,13 @@ - + - + - + - + @@ -11014,14 +11020,14 @@ - + - + @@ -11034,7 +11040,7 @@ - + @@ -11045,7 +11051,7 @@ - + @@ -11062,7 +11068,7 @@ - + @@ -11428,7 +11434,7 @@ - + @@ -11621,7 +11627,7 @@ - + @@ -11632,7 +11638,7 @@ - + @@ -12540,9 +12546,9 @@ - + - + @@ -12562,7 +12568,7 @@ - + @@ -12571,7 +12577,7 @@ - + @@ -14201,7 +14207,7 @@ - + @@ -14212,7 +14218,7 @@ - + @@ -14241,7 +14247,7 @@ - + @@ -14258,7 +14264,7 @@ - + @@ -14271,7 +14277,7 @@ - + @@ -14284,7 +14290,7 @@ - + @@ -14293,9 +14299,9 @@ - + - + @@ -14306,9 +14312,9 @@ - + - + @@ -14334,7 +14340,7 @@ - + @@ -14362,7 +14368,7 @@ - + @@ -14740,11 +14746,11 @@ - + - + - + @@ -14788,11 +14794,11 @@ - + - + - + @@ -14833,7 +14839,7 @@ - + @@ -14844,7 +14850,7 @@ - + @@ -14853,7 +14859,7 @@ - + @@ -14864,7 +14870,7 @@ - + @@ -15017,7 +15023,7 @@ - + @@ -15030,7 +15036,7 @@ - + @@ -15065,7 +15071,7 @@ - + @@ -15078,7 +15084,7 @@ - + @@ -15145,7 +15151,7 @@ - + @@ -15162,7 +15168,7 @@ - + @@ -15177,7 +15183,7 @@ - + @@ -15194,7 +15200,7 @@ - + @@ -15461,7 +15467,7 @@ - + @@ -15474,7 +15480,7 @@ - + @@ -15485,7 +15491,7 @@ - + @@ -15498,7 +15504,7 @@ - + @@ -15509,7 +15515,7 @@ - + @@ -15522,7 +15528,7 @@ - + @@ -15533,7 +15539,7 @@ - + @@ -15548,7 +15554,7 @@ - + @@ -15561,7 +15567,7 @@ - + @@ -15574,7 +15580,7 @@ - + @@ -15585,7 +15591,7 @@ - + @@ -15598,7 +15604,7 @@ - + @@ -15643,7 +15649,7 @@ - + @@ -15662,7 +15668,7 @@ - + @@ -15757,7 +15763,7 @@ - + @@ -15776,7 +15782,7 @@ - + @@ -15890,7 +15896,7 @@ - + @@ -15903,11 +15909,11 @@ - + - + - + @@ -15920,11 +15926,11 @@ - + - + - + @@ -16045,7 +16051,7 @@ - + @@ -16913,7 +16919,7 @@ - + @@ -16922,7 +16928,7 @@ - + @@ -17241,9 +17247,9 @@ - + - + @@ -17260,9 +17266,9 @@ - + - + @@ -17923,7 +17929,7 @@ - + @@ -17938,7 +17944,7 @@ - + @@ -18060,7 +18066,7 @@ - + @@ -18086,7 +18092,7 @@ - + @@ -18227,11 +18233,11 @@ - + - + - + @@ -18246,11 +18252,11 @@ - + - + - + @@ -18261,13 +18267,13 @@ - + - + @@ -18278,7 +18284,7 @@ - + @@ -18309,7 +18315,7 @@ - + @@ -18326,7 +18332,7 @@ - + @@ -18471,7 +18477,7 @@ - + @@ -18490,7 +18496,7 @@ - + @@ -18507,7 +18513,7 @@ - + @@ -18526,7 +18532,7 @@ - + @@ -18565,10 +18571,10 @@ - + - + @@ -18580,7 +18586,7 @@ - + @@ -18621,7 +18627,7 @@ - + @@ -18641,10 +18647,10 @@ - + - + @@ -18652,14 +18658,14 @@ - + - + - + @@ -18674,7 +18680,7 @@ - + @@ -18686,11 +18692,11 @@ - + - + @@ -18705,7 +18711,7 @@ - + @@ -18720,21 +18726,21 @@ - + - + - + - + @@ -18746,11 +18752,11 @@ - + - + @@ -18769,7 +18775,7 @@ - + @@ -18784,11 +18790,11 @@ - + - + @@ -18816,7 +18822,7 @@ - + @@ -18830,11 +18836,11 @@ - + - + @@ -18861,7 +18867,7 @@ - + @@ -18872,7 +18878,7 @@ - + @@ -18892,7 +18898,7 @@ - + @@ -18903,7 +18909,7 @@ - + @@ -18921,11 +18927,11 @@ - + - + @@ -18972,14 +18978,14 @@ - + - + @@ -18987,43 +18993,43 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -19039,11 +19045,11 @@ - + - + @@ -19123,7 +19129,7 @@ - + @@ -19176,9 +19182,9 @@ - + - + @@ -19277,7 +19283,7 @@ - + @@ -19325,7 +19331,7 @@ - + @@ -19334,7 +19340,7 @@ - + @@ -19414,7 +19420,7 @@ - + @@ -19423,7 +19429,7 @@ - + @@ -19446,7 +19452,7 @@ - + @@ -19455,7 +19461,7 @@ - + @@ -19664,7 +19670,7 @@ - + @@ -19675,21 +19681,21 @@ - + - + - + @@ -19700,7 +19706,7 @@ - + @@ -19711,7 +19717,7 @@ - + @@ -20461,9 +20467,9 @@ - + - + @@ -20479,7 +20485,7 @@ - + @@ -20570,7 +20576,7 @@ - + @@ -20608,9 +20614,9 @@ - + - + @@ -20635,7 +20641,7 @@ - + @@ -20644,7 +20650,7 @@ - + @@ -20655,7 +20661,7 @@ - + @@ -20664,7 +20670,7 @@ - + @@ -20675,7 +20681,7 @@ - + @@ -20686,14 +20692,14 @@ - + - + @@ -20709,7 +20715,7 @@ - + @@ -20720,7 +20726,7 @@ - + @@ -21164,22 +21170,22 @@ - + - + - + - + @@ -21190,11 +21196,11 @@ - + - + @@ -21203,18 +21209,18 @@ - + - + - + @@ -21225,24 +21231,24 @@ - + - + - + - + - + - + - + @@ -21255,9 +21261,9 @@ - + - + @@ -21268,9 +21274,9 @@ - + - + @@ -21279,11 +21285,11 @@ - + - + - + @@ -21292,33 +21298,33 @@ - + - + - + - + - + - + - + @@ -21326,19 +21332,32 @@ + + + + + + + + + + + + + - + - + - + @@ -21351,7 +21370,7 @@ - + @@ -21362,7 +21381,7 @@ - + @@ -21374,68 +21393,81 @@ + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -21443,46 +21475,46 @@ - + - + - + - + - + - + - + - + - + - + - + @@ -21495,14 +21527,14 @@ - + - + @@ -21515,46 +21547,46 @@ - + - + - + - + - + - + - + - + - + - + @@ -21563,7 +21595,7 @@ - + @@ -21572,18 +21604,18 @@ - + - + - + @@ -21594,7 +21626,7 @@ - + @@ -21603,7 +21635,7 @@ - + @@ -21612,7 +21644,7 @@ - + @@ -21621,14 +21653,14 @@ - + - + @@ -21637,7 +21669,7 @@ - + @@ -21648,7 +21680,7 @@ - + @@ -21661,14 +21693,14 @@ - + - + @@ -21677,16 +21709,16 @@ - + - + - + - + @@ -21695,23 +21727,23 @@ - + - + - + - + @@ -21722,7 +21754,7 @@ - + @@ -21731,23 +21763,23 @@ - + - + - + - + @@ -21758,7 +21790,7 @@ - + @@ -21767,73 +21799,73 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -21842,7 +21874,7 @@ - + @@ -21851,7 +21883,7 @@ - + @@ -21860,7 +21892,7 @@ - + @@ -21871,88 +21903,88 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -21961,26 +21993,26 @@ - + - + - + - + @@ -21989,53 +22021,53 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -22043,7 +22075,7 @@ - + @@ -22052,7 +22084,7 @@ - + @@ -22062,7 +22094,7 @@ - + @@ -22072,19 +22104,30 @@ + + + + + + + + + + + - + - + - + @@ -22093,7 +22136,7 @@ - + @@ -22104,16 +22147,16 @@ - + - + - + @@ -22121,15 +22164,22 @@ + + + + + + + - + - + @@ -22138,7 +22188,7 @@ - + @@ -22149,7 +22199,7 @@ - + @@ -22160,27 +22210,27 @@ - + - + - + - + - + - + @@ -22191,7 +22241,7 @@ - + @@ -22202,7 +22252,7 @@ - + @@ -22210,8 +22260,19 @@ + + + + + + + + + + + - + @@ -22224,7 +22285,7 @@ - + @@ -22235,7 +22296,7 @@ - + @@ -22248,7 +22309,7 @@ - + @@ -22261,7 +22322,7 @@ - + @@ -22276,7 +22337,7 @@ - + @@ -22287,7 +22348,7 @@ - + @@ -22300,18 +22361,18 @@ - + - + - + - + @@ -22322,7 +22383,7 @@ - + @@ -22337,7 +22398,7 @@ - + @@ -22346,7 +22407,7 @@ - + @@ -22357,7 +22418,7 @@ - + @@ -22368,7 +22429,7 @@ - + @@ -22381,7 +22442,7 @@ - + @@ -22392,7 +22453,7 @@ - + @@ -22403,7 +22464,7 @@ - + @@ -22416,7 +22477,7 @@ - + @@ -22427,14 +22488,14 @@ - + - + @@ -22443,23 +22504,23 @@ - + - + - + - + @@ -22469,10 +22530,15 @@ + + + + + - + - + @@ -22481,16 +22547,16 @@ - + - + - + @@ -22501,38 +22567,38 @@ - + - + - + - + - + - + - + - + - + @@ -22541,7 +22607,7 @@ - + @@ -22551,27 +22617,27 @@ - + - + - + - + - + @@ -22580,7 +22646,7 @@ - + @@ -22589,7 +22655,7 @@ - + @@ -22597,20 +22663,20 @@ - + - + - + @@ -22621,16 +22687,16 @@ - + - + - + @@ -22639,7 +22705,7 @@ - + @@ -22648,27 +22714,27 @@ - + - + - + - + - + - + @@ -22679,7 +22745,7 @@ - + @@ -22690,20 +22756,20 @@ - + - + - + @@ -22714,7 +22780,7 @@ - + @@ -22727,14 +22793,14 @@ - + - + @@ -22743,16 +22809,16 @@ - + - + - + @@ -22763,7 +22829,7 @@ - + @@ -22774,7 +22840,7 @@ - + @@ -22787,7 +22853,7 @@ - + @@ -22796,63 +22862,63 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -22861,18 +22927,18 @@ - + - + - + - + @@ -22881,21 +22947,21 @@ - + - + - + @@ -22904,7 +22970,7 @@ - + @@ -22915,7 +22981,7 @@ - + @@ -22926,7 +22992,7 @@ - + @@ -22935,14 +23001,14 @@ - + - + @@ -22951,7 +23017,7 @@ - + @@ -22968,7 +23034,7 @@ - + @@ -22985,51 +23051,28 @@ - + - + - - - - - - - - - - - - - - - - - - - - - - - - + - + @@ -23038,7 +23081,7 @@ - + @@ -23049,7 +23092,7 @@ - + @@ -23060,14 +23103,14 @@ - + - + @@ -23076,16 +23119,16 @@ - + - + - + - + @@ -23094,31 +23137,31 @@ - + - + - + - + - + - + - + - + - + - + - + - + @@ -23144,37 +23187,37 @@ - + - + - + - + - + - + - + @@ -23183,7 +23226,7 @@ - + @@ -23206,38 +23249,38 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -23689,7 +23732,7 @@ - + @@ -23700,48 +23743,48 @@ - + - + - + - + - + - + - + - + - + - + @@ -23769,82 +23812,82 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -23858,60 +23901,60 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -23919,343 +23962,343 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -24263,10 +24306,10 @@ - + - + @@ -24278,31 +24321,31 @@ - + - + - + - + - + - + - + @@ -24318,25 +24361,25 @@ - + - + - + - + - + @@ -24366,11 +24409,11 @@ - + - + @@ -24402,13 +24445,13 @@ - + - + - + @@ -24466,13 +24509,13 @@ - + - + - + @@ -24480,7 +24523,7 @@ - + @@ -24530,7 +24573,7 @@ - + @@ -24538,34 +24581,34 @@ - + - + - + - + - + - + - + - + @@ -24593,22 +24636,22 @@ - + - + - + - + - + @@ -24671,22 +24714,22 @@ - + - + - + - + @@ -24701,33 +24744,33 @@ - + - + - + - + - + - + - + @@ -24738,7 +24781,7 @@ - + @@ -24748,7 +24791,7 @@ - + @@ -24756,7 +24799,7 @@ - + @@ -24775,54 +24818,54 @@ - + - + - + - + - + - + - + - + - + - + - + - + @@ -24833,11 +24876,11 @@ - + - + @@ -24845,7 +24888,7 @@ - + @@ -24856,21 +24899,21 @@ - + - + - + - + @@ -24899,25 +24942,25 @@ - + - + - + - + - + @@ -24927,72 +24970,72 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -25003,14 +25046,14 @@ - + - + @@ -25026,46 +25069,46 @@ - + - + - + - + - + - + - + - + - + - + - + @@ -25073,11 +25116,11 @@ - + - + @@ -25178,7 +25221,7 @@ - + @@ -25189,18 +25232,18 @@ - + - + - + - + @@ -25211,14 +25254,14 @@ - + - + - + @@ -25233,7 +25276,7 @@ - + @@ -25277,14 +25320,14 @@ - + - + - + @@ -25300,35 +25343,35 @@ - + - + - + - + - + - + - + - + @@ -25336,7 +25379,7 @@ - + @@ -25344,11 +25387,11 @@ - + - + @@ -25400,11 +25443,11 @@ - + - + @@ -25431,736 +25474,736 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +