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

--- Comment #11 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
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   "<artificial>"
        .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?

Reply via email to