Linking EFI applications with x86_64-pc-mingw32-ld

Shea Levy
Mon Apr 2 20:06:00 GMT 2012

On 04/02/2012 03:50 PM, Kai Tietz wrote:
> 2012/4/2 Andreas Schwab<>:
>> NightStrike<>  writes:
>>> I don't know the answer to your question, but at the very least, you
>>> should try using the x86_64-w64-mingw32 target.  Notice that the
>>> middle part of the triplet is not -pc-.
>> The vendor part of the triplet is just for information.
>> Andreas.
> Right,  the vendor-part in triplet for binutils is just for
> information.  But yes, it is possible to link EFI COFF code by it.
> You need to specify the proper entry-point (by -e option) and you need
> to set the proper sub-system  There are pre-defined aliases for
> sub-systems
> "native" (1)
> "windows" (2)
> "console" (3)
> "posix" (7)
> "wince" (9)
> "xbox" (14)
> So can specify subsystem by ld's option '-subsystem=".  The argument
> of this option is either one of the strings above or a number.
> Regards,
> Kai

Thanks, this is getting me closer to what I want. Now, I have an object 
file that just has a .text section, but, when linked with 
x86_64-w64-mingw32-ld -e main -subsystem=10, a .idata section is added. 
Additionally, .text is extended with several zeros (for alignment I'm 
guessing?) and the symbol table is claiming there's a (completely 
0-filled) __CTOR_LIST__ and __DTOR_LIST__ in the middle of the added 0s. 
Can the added section and padding be safely removed?

Shea Levy

More information about the Binutils mailing list