From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B7FA33858D32; Sat, 1 Apr 2023 12:13:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B7FA33858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680351211; bh=iB5zZGk/SyxaLkMrfOlbv+bzjrZcmtb59nqpz6UgM38=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hwNH49c8cimtNBBxTJ9ZoNkdhbCskN6D9nza07gEBmWFY89vEuIEuzJeoGozzhjay lwHhznjzKPSyIWduUOLMSZ3M7YrRgLokxkv+QnlcWICzKVqzN3dHvO6wJZCCYvu+Or nhirBwkj/imaw/tXtFM70ZCA5YTLQaaWkhdW/Ssk= From: "amonakov at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: amonakov at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109368 Alexander Monakov changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amonakov at gcc dot gnu.org --- Comment #3 from Alexander Monakov --- This is a Binutils bug. GCC does not have any special knowledge that mainCRTStartup needs to be preserved (depending on targeted Windows subsyst= em), 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=3Dbinutils-gdb.git;a=3Dblob;f=3Dld/emultempl/= pep.em;h=3D2a3fd0e6ea802b3683dc786540d13b92f92e9160;hb=3DHEAD#l572 Perhaps the selection happens too late, even though there's a specific atte= mpt to take it into account: https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dblob;f=3Dld/ldlang.c;h= =3Db684e2d479acf18f58076a3b5c78627caa6d8e4f;hb=3DHEAD#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?=