Created attachment 10359 [details] Proposed patch If you specify -pie option a different entry point is used for PE/PE+ executables, specifically the entry point for a DLL. This for instance affects attempt to use --dynamicbase which needs an relocatable executable. As different thread on internet suggests to use -pie option to enable relocations on an executable the current behaviour seems wrong. I tested with a project we have and with this patch and --dynamicbase --pie --subsystem console the correct entry point is called.
(In reply to Frediano Ziglio from comment #0) > If you specify -pie option a different entry point is used for PE/PE+ > executables, specifically the entry point for a DLL. The workaround with -pie should no longer be necessary any more. Since https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=dc9bd8c92af67947db44b3cb428c050259b15cd0 the relocation table is no longer stripped if you specify -dynamicbase.