From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zmcc-2-mx.zmailcloud.com (zmcc-2-mx.zmailcloud.com [52.37.197.7]) by sourceware.org (Postfix) with ESMTPS id F238C3850438 for ; Wed, 11 Nov 2020 14:57:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F238C3850438 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=symas.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=hyc@symas.com Received: from zmcc-2.zmailcloud.com (zmcc-2-mta-1.zmailcloud.com [146.148.52.56]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by zmcc-2-mx.zmailcloud.com (Postfix) with ESMTPS id 17E9C40616; Wed, 11 Nov 2020 08:57:36 -0600 (CST) Received: from zmcc-2.zmailcloud.com (localhost [127.0.0.1]) by zmcc-2-mta-1.zmailcloud.com (Postfix) with ESMTPS id 954D5CFD15; Wed, 11 Nov 2020 08:57:35 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by zmcc-2-mta-1.zmailcloud.com (Postfix) with ESMTP id 7D64ACFCCB; Wed, 11 Nov 2020 08:57:35 -0600 (CST) DKIM-Filter: OpenDKIM Filter v2.10.3 zmcc-2-mta-1.zmailcloud.com 7D64ACFCCB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=symas.com; s=37C7994C-28CA-11EA-A30F-68F90BB9D764; t=1605106655; bh=lc+V8kB1HUprCfnQVuHHr/Xb/He1q/T63Ro/uThMRAQ=; h=To:From:Message-ID:Date:MIME-Version; b=LnjVF/olpmSLpCStG3bDUNbgbNxUREIuJ1Dbs6TDk3vnsEetyPZuI+CZH9RVVLGNz GgTvhoEzTXgmrudWi2fiNJYaCLdDXms1VPsjCX8kpisJ3z86sJth8e4kha7gEGk9g0 EXqgfruy+EFM4XCSOeuQB3tVTenAy7fqH489PP5jrHHVqrewfIhhAGkFl33hHjBVO7 9d0/8jQ3UwLcbN+gSk4SiRKHaoMF7WrdiwAv9uCJglg24i5+2MlvMgslF+byYkUGhv 9fUyCY58AwSk3vzngSzk4eF+pNYI1nJPmmg12jflSqNuzsVAvtdXejnXNB9r5TIilD yuKpdwsZlkp8w== Received: from zmcc-2.zmailcloud.com ([127.0.0.1]) by localhost (zmcc-2-mta-1.zmailcloud.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id cYHlsBisnDxV; Wed, 11 Nov 2020 08:57:35 -0600 (CST) Received: from [192.168.1.155] (unknown [84.203.30.144]) by zmcc-2-mta-1.zmailcloud.com (Postfix) with ESMTPSA id C81FFCD9E6; Wed, 11 Nov 2020 08:57:34 -0600 (CST) Subject: Re: [PATCH] dependency list for static libraries To: Alan Modra Cc: binutils@sourceware.org References: <31f9062e-175d-06e9-695a-797c7ee11420@symas.com> <58620dc1-3bb9-aaae-b476-ebb613ecb627@redhat.com> <1aaf4429-074c-7912-e6e6-4d2f82d6ef10@redhat.com> <6d270cf5-4011-d916-3e5f-140bc506f807@symas.com> <20201108013911.GB15956@bubble.grove.modra.org> <63667fcd-8b9c-d416-3240-9712eeee4658@symas.com> <20201109000146.GC15956@bubble.grove.modra.org> <763d46e7-9912-81af-3d1a-a82b82ddfb54@symas.com> <20201110110708.GG15956@bubble.grove.modra.org> From: Howard Chu Message-ID: <91c63de5-bc0b-e2e3-a517-25c7b40af419@symas.com> Date: Wed, 11 Nov 2020 14:57:32 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.3 MIME-Version: 1.0 In-Reply-To: <20201110110708.GG15956@bubble.grove.modra.org> Content-Type: multipart/mixed; boundary="------------499519FEDAC2AFC9A8C2BFB1" X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_RED autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: 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-List-Received-Date: Wed, 11 Nov 2020 14:57:39 -0000 This is a multi-part message in MIME format. --------------499519FEDAC2AFC9A8C2BFB1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Alan Modra wrote: > On Tue, Nov 10, 2020 at 02:44:13AM +0000, Howard Chu wrote: >> Ok, how about a patch to make it 2nd. Just trying to avoid having to >> search all the way to the end, for archives with a particularly large >> number of members. > > That might be OK. > -- -- Howard Chu CTO, Symas Corp. http://www.symas.com Director, Highland Sun http://highlandsun.com/hyc/ Chief Architect, OpenLDAP http://www.openldap.org/project/ --------------499519FEDAC2AFC9A8C2BFB1 Content-Type: text/x-patch; name="0001-Insert-libdeps-record-as-2nd-member-of-archive-inste.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Insert-libdeps-record-as-2nd-member-of-archive-inste.pa"; filename*1="tch" >From 868bf42666b74ccfa0e87bb4560801a63f71db83 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 11 Nov 2020 14:54:25 +0000 Subject: [PATCH] Insert libdeps record as 2nd member of archive instead of last --- binutils/ar.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/binutils/ar.c b/binutils/ar.c index 537b139e98..8bde751168 100644 --- a/binutils/ar.c +++ b/binutils/ar.c @@ -890,13 +890,16 @@ main (int argc, char **argv) if (bfd_find_target (plugin_target, libdeps_bfd) == NULL) fatal (_("Cannot reset libdeps record type.")); - /* Append our libdeps record to the list of files - being operated on. */ + /* Insert our libdeps record in 2nd slot of the list of files + being operated on. We shouldn't use 1st slot, but we want + to avoid having to search all the way to the end of an + archive with a large number of members at link time. */ new_files = xmalloc ((file_count + 2) * sizeof (char *)); - for (i = 0; i < file_count; i++) - new_files[i] = files[i]; - new_files[i++] = LIBDEPS; - file_count = i; + new_files[0] = files[0]; + new_files[1] = LIBDEPS; + for (i = 1; i < file_count; i++) + new_files[i+1] = files[i]; + file_count = ++i; files = new_files; files[i] = NULL; } -- 2.20.1 --------------499519FEDAC2AFC9A8C2BFB1--