LD patch to silence warnings about removed sections

Alan Modra amodra@bigpond.net.au
Fri Jun 7 19:19:00 GMT 2002


On Fri, Jun 07, 2002 at 06:10:28PM +0100, Richard Sandiford wrote:
> I'm not sure what the best fix is.  The patch below makes
> lang_size_sections_1 skip sections that we've already removed,
> but it seems a bit hackish.  I couldn't find a way of checking
> for removed sections directly (is there one?) so I made
> _bfd_strip_section_from_output set the SEC_EXCLUDE flag in
> output sections too.

I don't think there is a test you can use for output sections.

> + 	    /* The section might have been removed after its statement was
> + 	       added.  For example, ldemul_before_allocation can remove
> + 	       dynamic sections if they turn out not to be needed.  */
> + 	    if ((bfd_get_section_flags (output_bfd, os->bfd_section)
> + 		 & SEC_EXCLUDE) != 0)
> + 	      break;
> + 

Hmm, this will break "ld -r".  eg. for objects containing ELF
SHT_GROUP sections, and probably other cases.  Please test
!link_info.relocateable too.  OK with that change.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list