[PATCH] PR ld/21884: Check ELF section header only for ELF output

Alan Modra amodra@gmail.com
Wed Aug 2 12:54:00 GMT 2017
On Wed, Aug 02, 2017 at 04:53:51AM -0700, H.J. Lu wrote:
> --- a/ld/emultempl/elf32.em
> +++ b/ld/emultempl/elf32.em
> @@ -2136,7 +2136,8 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
>      }
>  
>    /* Look through the script to see where to place this section.  */
> -  if (constraint == 0)
> +  if (constraint == 0
> +      && link_info.output_bfd->xvec->flavour == bfd_target_elf_flavour)
>      for (os = lang_output_section_find (secname);
>  	 os != NULL;
>  	 os = next_matching_output_section_statement (os, 0))

This doesn't look to be the right place to me.  I think the loop
should run but the ELF specific tests be omitted when either input or
output is non-ELF.

Also, there is a similar problem with the .mbind code just a little
earlier.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list