https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109368

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gcc dot gnu.org

--- Comment #3 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
This is a Binutils bug. GCC does not have any special knowledge that
mainCRTStartup needs to be preserved (depending on targeted Windows subsystem),
it just preserves the symbols the linker tells it to preserve.

You can see how the linker selects the default entry point for PE targets:
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=ld/emultempl/pep.em;h=2a3fd0e6ea802b3683dc786540d13b92f92e9160;hb=HEAD#l572

Perhaps the selection happens too late, even though there's a specific attempt
to take it into account:
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=ld/ldlang.c;h=b684e2d479acf18f58076a3b5c78627caa6d8e4f;hb=HEAD#l8082

(if you inspect GCC dumps produced with -fdump-ipa-all, you'll see that
mainCRTStartup is marked as prevailing_def_ironly instead of prevailing_def)

Would you mind reporting it to the Binutils bugzilla and leaving a link to the
new bug here?

Reply via email to