PATCH: PR binutils/5307: objcopy PE<->EFI doesn't work when both PE/EFI are enabled

H.J. Lu hjl@lucon.org
Mon Nov 12 23:33:00 GMT 2007


On Mon, Nov 12, 2007 at 11:02:56PM +0000, Pedro Alves wrote:
> Hi,
> 
> H.J. Lu wrote:
> >objcopy sets pe_opthdr.Subsystem in _bfd_XXi_swap_aouthdr_out if it is
> >IMAGE_SUBSYSTEM_UNKNOWN. But _bfd_XX_bfd_copy_private_bfd_data_common
> >copies pe_opthdr.Subsystem from input to output so that
> >pe_opthdr.Subsystem is never changed. This patch sets
> >pe_opthdr.Subsystem to IMAGE_SUBSYSTEM_UNKNOWN if output is different
> >from input.
> >
> 
> Wouldn't you normally want the default subsystem of the
> output?  Isn't it IMAGE_SUBSYSTEM_EFI_APPLICATION for efi-app-* ?

It is done with

  if (extra->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN)
    extra->Subsystem = pe->target_subsystem;

in _bfd_XXi_swap_aouthdr_out. target_subsystem has been set properly
according to target.

> Wouldn't a more general objcopy flag to change the subsystem
> to the one you want be more useful (like ld's --subsystem) ?
> 
 
It is called "-O efi-app-ia32" for objcopy.


H.J.



More information about the Binutils mailing list