From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id E69233857C46 for ; Wed, 23 Sep 2020 13:51:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E69233857C46 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=matz@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 5CB29AD2C; Wed, 23 Sep 2020 13:52:34 +0000 (UTC) Date: Wed, 23 Sep 2020 13:51:56 +0000 (UTC) From: Michael Matz To: "H.J. Lu" cc: Hans-Peter Nilsson , Fangrui Song , Binutils Subject: Re: [PATCH] Support SHF_GNU_RETAIN ELF section flag In-Reply-To: Message-ID: References: <20200923010930.xtc4mgmxsoesohkn@gmail.com> <20200923095818.npbwybrm63vb4ejm@jozef-acer-manjaro> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP 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, 23 Sep 2020 13:51:59 -0000 Hello, On Wed, 23 Sep 2020, H.J. Lu via Binutils wrote: > > I think that: > > > > > .section .text,"ax" > > > ... > > > foo: > > > ... > > > .retain > > > retained_fn: > > > ... > > > > is some nice syntactic sugar compared to: > > > > > .section .text,"ax" > > > ... > > > foo: > > > ... > > > .section .text,"axR" > > > retained_fn: > > > ... > > > > It's also partly for convenience; we have other directives which are > > synonyms or short-hand for each other. > > > > You don't need to keep the whole section when only one symbol should > be kept. Please drop the .retain directive. GCC, as and ld should do the > right thing with > > .section .text,"ax" > ... > foo: > ... > .section .text,"axR" > > retained_fn: > > where foo can be dropped and retained_fn will be kept. This is not what we discussed at the ABI list, the flag is per section, so either the whole section is retained or not. What you describe is something else that would work on a per symbol basis, which would have to be specified in a different way and might or might not be a good idea. But let's not conflate these two. About the .retain syntactic sugar: I also think it's not necessary, the .section directive with R flag merging is good enough IMHO. Ciao, Michael.