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

H.J. Lu hjl.tools@gmail.com
Wed Aug 2 13:09:00 GMT 2017
On Wed, Aug 2, 2017 at 5:54 AM, Alan Modra <amodra@gmail.com> wrote:
> 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.

We can do something like this.  There is no need to check for
ELF specific info if either input or output isn't ELF.


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Skip-ELF-section-header-check-if-not-needed.patch
Type: text/x-patch
Size: 1284 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20170802/b91df97f/attachment.bin>


More information about the Binutils mailing list