linking EFI binary from ELF objects and archives

Nick Clifton nickc@redhat.com
Wed Sep 9 12:49:34 GMT 2020


Hi Jan,

> in PR 22369 you said
> 
> "I do wonder if we should issue an error message when attempting to
>  perform cross-format links like this.  Although in theory of course
>  the library could contain both COFF format objects and ELF format
>  objects.  Which makes things a little more complicated.  Hmm, maybe
>  I need to think about this."
> 
> Am I correctly understanding that while linking EFI binaries (i.e.
> PE32+) from ELF _objects_ works,

Actually I do not think that this does work.  The PR was for a case
where this was attempted, and a seg-fault was generated.  But I
think that even if the seg-fault had not happened the link still 
would have failed.

> As an aside - while looking at coff_link_check_archive_element() I
> got puzzled by
> 
>   /* If the archive element has already been loaded then one
>      of the symbols defined by that element might have been
>      made undefined due to being in a discarded section.  */
>   if (((struct coff_link_hash_entry *) h)->indx == -3)
>     return TRUE;
> 
>   /* PR 22369 - Skip non COFF objects in the archive.  */
>   if (! bfd_family_coff (abfd))
>     return TRUE;
> 
> Shouldn't these two checks be the other way around,

Yes - this is a bug...  I am testing the obvious fix now and
if nothing goes wrong I will check the patch in later today.

Cheers
  Nick






More information about the Binutils mailing list