public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "amonakov at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/109368] LTO drops entry point symbol
Date: Sat, 01 Apr 2023 12:13:31 +0000	[thread overview]
Message-ID: <bug-109368-4-9hmsZodmvJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109368-4@http.gcc.gnu.org/bugzilla/>

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?

  parent reply	other threads:[~2023-04-01 12:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-01 10:17 [Bug lto/109368] New: " pali at kernel dot org
2023-04-01 11:53 ` [Bug lto/109368] " pinskia at gcc dot gnu.org
2023-04-01 11:55 ` pali at kernel dot org
2023-04-01 12:13 ` amonakov at gcc dot gnu.org [this message]
2023-04-01 12:21 ` pali at kernel dot org
2023-04-01 12:44 ` xry111 at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-109368-4-9hmsZodmvJ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).