From patchwork Fri Nov 25 16:57:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Matz X-Patchwork-Id: 26100 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp4158590wrr; Fri, 25 Nov 2022 08:57:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Zki6XIEhqoPMb/VYgHnDTjWdZgZRS7lCo6/EkmFrq7NYy2GFX/IzwGVHJQpTXIiypeL3X X-Received: by 2002:a17:907:cc9c:b0:7bb:8de1:5139 with SMTP id up28-20020a170907cc9c00b007bb8de15139mr6990631ejc.55.1669395473655; Fri, 25 Nov 2022 08:57:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669395473; cv=none; d=google.com; s=arc-20160816; b=lVWx3lsiA70df9JG1VRGgCL5iGvq/ZieD/0eLJjwR0Et7XZwmI25ZB81yV1v3ikaOF qSPJhEydu4WBcnH4C6Gckp851yCp37kK+IhrgKkR5T+qZbmX9ALKlv5xKXaZkFmrYFAq yTdZIFytSWoKUOaXJ8Yxw173K+82CXdzsW16R9YowgxOX1an6xgrOCwe/l846FptEwku 6e/jIdgS8zVxbOUDjC3/h/I/HrNMBn/24MGF6l/7x+Cb/SQok6QeLoJ6JvYtddalrSuN wyHz2PWeENX0LbGlWs5OQj9rPrtRpki17jQCJttqJFHj2cMDANweklGPiHihiOfkm/Jw QVQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:mime-version :user-agent:references:message-id:in-reply-to:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=ZWWL7Owde0X6XWoGeTu8bSh9cEg5WricZqZvAQimxAs=; b=zkJoE8iwTf2gmgKUAmjuzkkCffyS4VWr66BTgKmZe0fT4YglcDcPYFOM4g0O+TWW0E v5RlmIrQ2RWN2wADBuvKqP0TauR7GAJZ40R+82//TClMn2KTGXlgwbfvAEEAkSFxhL4D GsSGyA4ToBODJ3kd9OZIgd9xMlSUz9uTXAJu4GgqvdaHYEofgTEehlWm6ibs5QXXCiWP ksFHVKJd7QUdV08Wu5Bl5a3hnvAG5rAnDfEsvquJ/+d83hklpTdghxTdQ7Q1ZkEfdXH1 t7lgTXhr9WrtBDCEjJTDYx0/Qm1oA0MLXg1Ks+mjPVilMTNYgugdr5BnDikwuH2f74Zs 5aIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=sPlRnflP; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id sg34-20020a170907a42200b007ae3958c7c9si295071ejc.999.2022.11.25.08.57.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Nov 2022 08:57:53 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=sPlRnflP; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 043D8384E3AA for ; Fri, 25 Nov 2022 16:57:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 043D8384E3AA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669395469; bh=ZWWL7Owde0X6XWoGeTu8bSh9cEg5WricZqZvAQimxAs=; h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=sPlRnflPqRwWbZYHNfaylj1hKP7gKindywXdypWJoqK9lWKUkLxa6A1LnfoUrPG2I eeTiLFN6rDDcK2n4UqWZoJAi9pR3VuxvBiU3rTab7ii+r+6NT7WJBRH9AkVF5Qmqda 7Hj+nhrRitz6MRxAZCg01vcpopbl+P33Mg66snkQ= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 3E45138493F2 for ; Fri, 25 Nov 2022 16:57:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3E45138493F2 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 76B9421B15 for ; Fri, 25 Nov 2022 16:57:38 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 725772C141 for ; Fri, 25 Nov 2022 16:57:38 +0000 (UTC) Received: by wotan.suse.de (Postfix, from userid 10510) id 676166586; Fri, 25 Nov 2022 16:57:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by wotan.suse.de (Postfix) with ESMTP id 655EA6238 for ; Fri, 25 Nov 2022 16:57:38 +0000 (UTC) Date: Fri, 25 Nov 2022 16:57:38 +0000 (UTC) To: binutils@sourceware.org Subject: [PATCH 7/8] section-select: Remove bfd_max_section_id again In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 X-Spam-Status: No, score=-9.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Michael Matz via Binutils From: Michael Matz Reply-To: Michael Matz Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750488028062155279?= X-GMAIL-MSGID: =?utf-8?q?1750488028062155279?= since we reset the whole matching state completely we don't need the already-seen early-outs anymore. --- Depending on how 4/8 is decided this patch might not land in the tree in the end, as without rebuilding the whole matchings from scratch the early-outs remain useful, Ciao, Michael. bfd/bfd-in2.h | 2 -- bfd/section.c | 19 ------------------- ld/ldlang.c | 19 +------------------ ld/ldlang.h | 1 - 4 files changed, 1 insertion(+), 40 deletions(-) diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 5350ae42b03..0b071dda1e5 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -1330,8 +1330,6 @@ discarded_section (const asection *sec) { 0, NAME, 0, BSF_SECTION_SYM, SECTION } #endif -unsigned int bfd_get_max_section_id (void); - void bfd_section_list_clear (bfd *); asection *bfd_get_section_by_name (bfd *abfd, const char *name); diff --git a/bfd/section.c b/bfd/section.c index d691bf265ab..f73e0345e15 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -849,25 +849,6 @@ SUBSECTION These are the functions exported by the section handling part of BFD. */ -/* -FUNCTION - bfd_get_max_section_id - -SYNOPSIS - unsigned int bfd_get_max_section_id (void); - -DESCRIPTION - Returns an internal number representing the maximum value of - any SECTION->id member. Whenever a new section is created that - value increases. It never decreases. -*/ - -unsigned int -bfd_get_max_section_id (void) -{ - return _bfd_section_id; -} - /* FUNCTION bfd_section_list_clear diff --git a/ld/ldlang.c b/ld/ldlang.c index 18d10531d51..abaa9916256 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -368,8 +368,6 @@ walk_wild_file_in_exclude_list (struct name_list *exclude_list, return false; } -static unsigned int old_max_section_id = 0; - /* Add SECTION (from input FILE) to the list of matching sections within PTR (the matching wildcard is SEC). */ @@ -402,9 +400,6 @@ walk_wild_section_match (lang_wild_statement_type *ptr, const char *file_spec = ptr->filename; char *p; - if (s->id < ptr->max_section_id) - return; - /* Check if filenames match. */ if (file_spec == NULL) ; @@ -896,8 +891,6 @@ resolve_wild_sections (lang_input_statement_type *file) const char *sname = bfd_section_name (s); char c = 1; struct prefixtree *t = ptroot; - if (old_max_section_id && s->id < old_max_section_id) - continue; //printf (" YYY consider %s of %s\n", sname, file->the_bfd->filename); do { @@ -954,7 +947,6 @@ resolve_wilds (void) } } } - old_max_section_id = bfd_get_max_section_id (); } /* For each input section that matches wild statement S calls @@ -965,12 +957,7 @@ walk_wild (lang_wild_statement_type *s, callback_t callback, void *data) { lang_statement_union_type *l; - if (s->max_section_id < bfd_get_max_section_id ()) - { - //printf("XXX %s\n", s->filename ? s->filename : ""); - s->max_section_id = bfd_get_max_section_id (); - } - + //printf("XXX %s\n", s->filename ? s->filename : ""); for (l = s->matching_sections.head; l; l = l->header.next) { (*callback) (s, l->input_matcher.pattern, l->input_matcher.section, @@ -7853,8 +7840,6 @@ reset_one_wild (lang_statement_union_type *statement) if (statement->header.type == lang_wild_statement_enum) { lang_wild_statement_type *stmt = &statement->wild_statement; - stmt->max_section_id = 0; - /* XXX Leaks? */ lang_list_init (&stmt->matching_sections); } } @@ -7863,7 +7848,6 @@ static void reset_resolved_wilds (void) { lang_for_each_statement (reset_one_wild); - old_max_section_id = 0; } void @@ -8240,7 +8224,6 @@ lang_add_wild (struct wildcard_spec *filespec, new_stmt->section_list = section_list; new_stmt->keep_sections = keep_sections; lang_list_init (&new_stmt->children); - new_stmt->max_section_id = 0; lang_list_init (&new_stmt->matching_sections); analyze_walk_wild_section_handler (new_stmt); if (0) diff --git a/ld/ldlang.h b/ld/ldlang.h index 5d9d2447f1c..b92a7bb9d96 100644 --- a/ld/ldlang.h +++ b/ld/ldlang.h @@ -399,7 +399,6 @@ struct lang_wild_statement_struct lang_statement_list_type children; struct name_list *exclude_name_list; lang_statement_list_type matching_sections; - unsigned int max_section_id; lang_section_bst_type *tree, **rightmost; struct flag_info *section_flag_list;