Bug 12693 - LTO on mingw target cause ld terminated with signal 11
Summary: LTO on mingw target cause ld terminated with signal 11
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.22
: P2 critical
Target Milestone: ---
Assignee: unassigned
Depends on:
Reported: 2011-04-21 13:04 UTC by Dongsheng Song
Modified: 2011-05-18 11:02 UTC (History)
2 users (show)

See Also:
Target: *-*-mingw*
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Dongsheng Song 2011-04-21 13:04:29 UTC
When I do not use lto, gcc works fine:

$ i686-w64-mingw32-gcc -O2 Hello.c

When I use lto, both 32 bit and 64 bit mingw target failed:

$ i686-w64-mingw32-gcc -O2 -flto Hello.c
collect2: ld terminated with signal 11 [Segmentation fault], core dumped

(gdb) bt
#0  0x000000000043013c in coff_write_alien_symbol (abfd=0x9a10f0)
    at /home/dongsheng/vcs/git/binutils/bfd/coffgen.c:1018
#1  coff_write_symbols (abfd=0x9a10f0) at /home/dongsheng/vcs/git/binutils/bfd/coffgen.c:1151
#2  0x000000000044622c in coff_write_object_contents (abfd=<value optimized out>)
    at /home/dongsheng/vcs/git/binutils/bfd/coffcode.h:4133
#3  0x0000000000432937 in bfd_make_readable (abfd=0x9a10f0) at /home/dongsheng/vcs/git/binutils/bfd/opncls.c:861
#4  0x000000000041d38d in plugin_maybe_claim (file=0x7fff76294d20, entry=0x975180)
    at /home/dongsheng/vcs/git/binutils/ld/plugin.c:871
#5  0x000000000041adc9 in ldfile_try_open_bfd (attempt=0x7fff762961dc "/tmp/ccU0nj17.o", entry=0x975180)
    at /home/dongsheng/vcs/git/binutils/ld/ldfile.c:329
#6  0x000000000041b2bc in ldfile_open_file (entry=0x975180) at /home/dongsheng/vcs/git/binutils/ld/ldfile.c:422
#7  0x000000000040ffa5 in load_symbols (entry=0x975180, place=0x7fff76294df0)
    at /home/dongsheng/vcs/git/binutils/ld/ldlang.c:2671
#8  0x000000000041091c in open_input_bfds (s=0x975180, mode=OPEN_BFD_NORMAL)
    at /home/dongsheng/vcs/git/binutils/ld/ldlang.c:3248
#9  0x0000000000411b9a in lang_process () at /home/dongsheng/vcs/git/binutils/ld/ldlang.c:6522
#10 0x0000000000415ecf in main (argc=50, argv=0x7fff76295038) at /home/dongsheng/vcs/git/binutils/ld/ldmain.c:461

*) binutils
commit 32b1bce97bdf3ad37938bffd144aeb9452f64636
Author: DJ Delorie <dj@delorie.com>
Date:   Thu Apr 21 05:48:06 2011 +0000

    * rx-decode.opc (rx_decode_opcode): Set the syntax for multi-byte NOPs.
    * rx-decode.c: Regenerate.

*) gcc 4.6
URL: svn://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch
Repository Root: svn://gcc.gnu.org/svn/gcc
Repository UUID: 138bc75d-0d04-0410-961f-82ee72b054a4
Revision: 172812
Node Kind: directory
Schedule: normal
Last Changed Author: jason
Last Changed Rev: 172806
Last Changed Date: 2011-04-21 12:27:30 +0800 (Thu, 21 Apr 2011)

URL: https://mingw-w64.svn.sourceforge.net/svnroot/mingw-w64/trunk
Repository Root: https://mingw-w64.svn.sourceforge.net/svnroot/mingw-w64
Repository UUID: 4407c894-4637-0410-b4f5-ada5f102cad1
Revision: 4144
Node Kind: directory
Schedule: normal
Last Changed Author: cjacek
Last Changed Rev: 4143
Last Changed Date: 2011-04-16 18:32:42 +0800 (Sat, 16 Apr 2011)
Comment 1 vanboxem.ruben 2011-05-01 11:00:21 UTC
I see the same thing. I used the GCC 4.6 SVN branch and the binutils 2.21 branch. ld terminates when compiling a configure test program "ld terminated with signal 11 [Segmentation fault]

I compiled/linked with -flto/-flto=2
Comment 2 vanboxem.ruben 2011-05-18 11:02:31 UTC
The segfault has been fixed some time ago on trunk. 2.21 still has the problem though.