From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30779 invoked by alias); 29 Mar 2005 02:06:42 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 30527 invoked from network); 29 Mar 2005 02:06:32 -0000 Received: from unknown (HELO rwcrmhc12.comcast.net) (216.148.227.85) by sourceware.org with SMTP; 29 Mar 2005 02:06:32 -0000 Received: from lucon.org ([24.6.212.230]) by comcast.net (rwcrmhc12) with ESMTP id <2005032902063201400s9gm1e>; Tue, 29 Mar 2005 02:06:32 +0000 Received: by lucon.org (Postfix, from userid 1000) id 0548D97E5A; Mon, 28 Mar 2005 18:06:32 -0800 (PST) Date: Tue, 29 Mar 2005 07:13:00 -0000 From: "H. J. Lu" To: binutils@sources.redhat.com Subject: Re: PATCH: PR 797: Alignment in empty section changes the output layout Message-ID: <20050329020631.GA1504@lucon.org> References: <20050324003653.GA28321@lucon.org> <20050324220556.GA13985@lucon.org> <20050328224231.GC14407@bubble.modra.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050328224231.GC14407@bubble.modra.org> User-Agent: Mutt/1.4.1i X-SW-Source: 2005-03/txt/msg00837.txt.bz2 On Tue, Mar 29, 2005 at 08:12:31AM +0930, Alan Modra wrote: > On Thu, Mar 24, 2005 at 02:05:56PM -0800, H. J. Lu wrote: > > + So we remove the unused output sections without input sections > > + and the empty unused output sections created by linker, if > > + they don't have any contents. */ > > Is it possible to do this in strip_excluded_output_sections? You won't > have sizes set at that stage, but linker_has_input will be set, as will > SEC_HAS_CONTENTS from link script data statements. So I think most of But SEC_KEEP may not be set before lang_mark_used_section. > what you're trying to achieve can be done there. SEC_LINKER_CREATED > sections ought to be handled by the backend size_dynamic_sections > function calling _bfd_strip_section_from_output. Or I can check every output section and call _bfd_strip_section_from_output at the end of bfd_elf_size_dynamic_sections so that I don't have to change every backend. But _bfd_strip_section_from_output will check every input section. It may be expensive. If I have to do it in gld${EMULATION_NAME}_finish for other sections anyway, why not to remove empty unused linker created sections in a same place. H.J.