From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 101683 invoked by alias); 2 Apr 2015 16:29:31 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 101605 invoked by uid 48); 2 Apr 2015 16:29:27 -0000 From: "hubicka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/65581] [5 Regression] testsuite lto issue: multiple definition of `main', undefined reference to `WinMain' Date: Thu, 02 Apr 2015 16:29:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 5.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-04/txt/msg00164.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65581 --- Comment #11 from Jan Hubicka --- Thanks! The resolution file is wrong: 1 test.o 1 172 795d441a PREEMPTED_REG main the resolution of main() should be PREVAILING_DEF_IRONLY. PREEMTED_REG is defined as follows: PREEMPTED_REG (this definition was pre-empted by a definition in a regular object file) This is linker bug. It basicaly instructs GCC to drop the definition of main because it is defined elsewhere. However GCC is not ready for non-weak symbol to be preemted and produces the function into final binary anyway: .file "" .def __main; .scl 2; .type 32; .endef .text .globl main .def main; .scl 2; .type 32; .endef .seh_proc main main: subq $40, %rsp .seh_stackalloc 40 .seh_endprologue call __main movl $0, %eax addq $40, %rsp ret .seh_endproc .ident "GCC: (GNU) 5.0.0 20150326 (experimental) [trunk revision 221697]" Is something wrong with this assembly? How does the testecase comile w/o LTO?