PATCH: PR 797: Alignment in empty section changes the output layout

H. J. Lu hjl@lucon.org
Tue Mar 29 07:13:00 GMT 2005


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.



More information about the Binutils mailing list