public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Error Linking LTO programs using GCC6.4
@ 2017-09-27 13:51 叶雨飞
  2017-09-27 14:22 ` 叶雨飞
  2017-09-27 18:26 ` Steven Penny
  0 siblings, 2 replies; 6+ messages in thread
From: 叶雨飞 @ 2017-09-27 13:51 UTC (permalink / raw)
  To: cygwin

The same program was linking fine using previous gcc 5.X , please
advise how to debug further.

[Linking driver.exe]
collect2: fatal error: ld terminated with signal 11 [Segmentation
fault], core dumped
compilation terminated.
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld:
libdriver.a(regexp.o) (15065197): Section flag STYP_GROUP (0x4)
ignored
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld:
libdriver.a(regexp.o) (15065197): Section flag STYP_COPY (0x10)
ignored
make: *** [Makefile:194: driver.exe] Error 1

aunyx@DESKTOP-R60LL3E ~/fluffos/src
$ cat ld.exe.stackdump
Exception: STATUS_ACCESS_VIOLATION at rip=0010045A417
rax=0000000000000000 rbx=0000000600525E40 rcx=0000000600525E40
rdx=0000000100571C00 rsi=0000000000000001 rdi=00000006002E2420
r8 =0000000600528C70 r9 =0000000000000058 r10=0000000100000000
r11=0000000000000000 r12=00000000000003EE r13=0000000100571C00
r14=00000006000D5B50 r15=00000006000CDC00
rbp=00000006000D9A30 rsp=00000000FFFFC4D0
program=D:\cygwin\usr\x86_64-pc-cygwin\bin\ld.exe, pid 8564, thread main
cs=0033 ds=002B es=002B fs=0053 gs=002B ss=002B
Stack trace:
Frame        Function    Args
006000D9A30  0010045A417 (00100571C00, 006000E3374, 000FFFFC6A0, 00100571C00)
006000D9A30  0010045382E (006002E2420, 006000D9A30, 000000003EE, 00100571C00)
006000D9A30  0010045433E (001004EAE20, 00000000000, 0010042843B, 000FFFFC70C)
006000D9A30  0010043C095 (00100571C00, 001004542E0, 001800BAE1C, 00000000000)
00000000000  0010040EDB8 (00600075530, 00600076970, 0010050295C, 00000000000)
00000000000  0010040F8D0 (001802FDC50, 00600068A50, 001800BB092, 00600069690)
000FFFFCA40  00100411976 (003FED791C0, 006000003F0, 001800BB092, 00000390038)
000FFFFCA40  001004E8C7A (000FFFFCA40, 000FFFFCAF0, 00000000000, 001801C31A0)
000FFFFCCB0  00180047BC2 (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  00180045863 (00000000000, 00000000000, 00000000000, 00000000000)
000FFFFFFF0  00180045914 (00000000000, 00000000000, 00000000000, 00000000000)
End of stack trace

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Error Linking LTO programs using GCC6.4
  2017-09-27 13:51 Error Linking LTO programs using GCC6.4 叶雨飞
@ 2017-09-27 14:22 ` 叶雨飞
  2017-09-27 22:18   ` 叶雨飞
  2017-09-27 18:26 ` Steven Penny
  1 sibling, 1 reply; 6+ messages in thread
From: 叶雨飞 @ 2017-09-27 14:22 UTC (permalink / raw)
  To: cygwin

Okay, so I managed to extract more details using binutils-debuginfo
package , but still has no clue how to solve this.  OTOH, binutils
2.25 seems to be doing better

Starting program: /usr/x86_64-pc-cygwin/bin/ld -plugin
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/cyglto_plugin.dll
-plugin-opt=/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/lto-wrapper.exe
-plugin-opt=-fresolution=/tmp/ccNFf1JQ.res
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lcygwin
-plugin-opt=-pass-through=-ladvapi32
-plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32
-plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lgcc --build-id -m i386pep --wrap _Znwm
--wrap _Znam --wrap _ZdlPv --wrap _ZdaPv --wrap _ZnwmRKSt9nothrow_t
--wrap _ZnamRKSt9nothrow_t --wrap _ZdlPvRKSt9nothrow_t --wrap
_ZdaPvRKSt9nothrow_t -Bdynamic --dll-search-prefix=cyg --tsaware -o
driver.exe -L/usr/lib/w32api
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../lib/crt0.o
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/crtbegin.o -L/usr/lib
-L/usr/lib/gcc/x86_64-pc-cygwin/6.4.0
-L/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/lib/../lib
-L/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../lib -L/lib/../lib
-L/usr/lib/../lib
-L/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/lib
-L/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../.. -v main.o libdriver.a
-lpcre -lz -lcrypt -lpcre -levent -lstdc++ -lgcc_s -lgcc -lcygwin
-ladvapi32 -lshell32 -luser32 -lkernel32 -lgcc_s -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../lib/default-manifest.o
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/crtend.o
[New Thread 6752.0x2d9c]
[New Thread 6752.0x206c]
[New Thread 6752.0x284c]
[New Thread 6752.0x2278]
[New Thread 6752.0x1154]
GNU ld (GNU Binutils) 2.29.51.20170708
/usr/x86_64-pc-cygwin/bin/ld: libdriver.a(regexp.o) (15065208):
Section flag STYP_COPY (0x10) ignored

Program received signal SIGSEGV, Segmentation fault.
_bfd_coff_get_external_symbols (abfd=abfd@entry=0x6005374e0) at
/usr/src/debug/binutils-2.28-3/bfd/coffgen.c:1635
1635      if (obj_coff_external_syms (abfd) != NULL)
(gdb) bt
#0  _bfd_coff_get_external_symbols (abfd=abfd@entry=0x6005374e0) at
/usr/src/debug/binutils-2.28-3/bfd/coffgen.c:1635
#1  0x000000010045382e in coff_link_add_object_symbols
(abfd=0x6005374e0, info=0x100571c00 <link_info>) at
/usr/src/debug/binutils-2.28-3/bfd/cofflink.c:183
#2  0x000000010045433e in coff_link_check_archive_element
(abfd=0x6005374e0, info=0x100571c00 <link_info>, h=<optimized out>,
name=<optimized out>, pneeded=0xffffc11c) at
/usr/src/debug/binutils-2.28-3/bfd/cofflink.c:220
#3  0x000000010043c095 in _bfd_generic_link_add_archive_symbols
(abfd=0x6000ba0e0, info=0x100571c00 <link_info>, checkfn=0x1004542e0
<coff_link_check_archive_element>) at
/usr/src/debug/binutils-2.28-3/bfd/linker.c:977
#4  0x000000010040edb8 in load_symbols (entry=0x60003a200,
place=<optimized out>) at
/usr/src/debug/binutils-2.28-3/ld/ldlang.c:2863
#5  0x000000010040f8d0 in open_input_bfds (s=0x60003a200,
mode=mode@entry=OPEN_BFD_NORMAL) at
/usr/src/debug/binutils-2.28-3/ld/ldlang.c:3312
#6  0x0000000100411976 in lang_process () at
/usr/src/debug/binutils-2.28-3/ld/ldlang.c:7010
#7  0x00000001004e8c7a in main (argc=69, argv=0xffffc450) at
/usr/src/debug/binutils-2.28-3/ld/ldmain.c:437
(gdb) print *abfd
$1 = {filename = 0x600537640 "regexp.o (symbol from plugin)", xvec =
0x10053f140 <x86_64_pei_vec>, iostream = 0x600537670, iovec =
0x100523360 <_bfd_memory_iovec>, lru_prev = 0x0, lru_next = 0x0, where
= 9, mtime = 0, id = 4294967261, format = bfd_unknown,
  direction = read_direction, flags = 71680, cacheable = 0,
target_defaulted = 1, opened_once = 0, mtime_set = 0, no_export = 0,
output_has_begun = 0, has_armap = 0, is_thin_archive = 0,
selective_search = 0, is_linker_output = 0, is_linker_input = 0,
  plugin_format = bfd_plugin_unknown, lto_output = 0, plugin_dummy_bfd
= 0x0, origin = 0, proxy_origin = 0, section_htab = {table =
0x6005381d0, newfunc = 0x100441630 <bfd_section_hash_newfunc>, memory
= 0x600537620, size = 13, count = 0, entsize = 304,
    frozen = 0}, sections = 0x0, section_last = 0x0, section_count =
0, archive_pass = 0, start_address = 0, outsymbols = 0x0, symcount =
0, dynsymcount = 0, arch_info = 0x100522c00 <bfd_default_arch_struct>,
arelt_data = 0x0, my_archive = 0x0,
  archive_next = 0x0, archive_head = 0x0, nested_archives = 0x0, link
= {next = 0x0, hash = 0x0}, tdata = {aout_data = 0x0, aout_ar_data =
0x0, oasys_obj_data = 0x0, oasys_ar_data = 0x0, coff_obj_data = 0x0,
pe_obj_data = 0x0, xcoff_obj_data = 0x0,
    ecoff_obj_data = 0x0, ieee_data = 0x0, ieee_ar_data = 0x0,
srec_data = 0x0, verilog_data = 0x0, ihex_data = 0x0, tekhex_data =
0x0, elf_obj_data = 0x0, nlm_obj_data = 0x0, bout_data = 0x0, mmo_data
= 0x0, sun_core_data = 0x0, sco5_core_data = 0x0,
    trad_core_data = 0x0, som_data = 0x0, hpux_core_data = 0x0,
hppabsd_core_data = 0x0, sgi_core_data = 0x0, lynx_core_data = 0x0,
osf_core_data = 0x0, cisco_core_data = 0x0, versados_data = 0x0,
netbsd_core_data = 0x0, mach_o_data = 0x0,
    mach_o_fat_data = 0x0, plugin_data = 0x0, pef_data = 0x0,
pef_xlib_data = 0x0, sym_data = 0x0, any = 0x0}, usrdata =
0x60053c710, memory = 0x600537600, build_id = 0x0}

On Wed, Sep 27, 2017 at 6:51 AM, 叶雨飞 <sunyucong@gmail.com> wrote:
> The same program was linking fine using previous gcc 5.X , please
> advise how to debug further.
>
> [Linking driver.exe]
> collect2: fatal error: ld terminated with signal 11 [Segmentation
> fault], core dumped
> compilation terminated.
> /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld:
> libdriver.a(regexp.o) (15065197): Section flag STYP_GROUP (0x4)
> ignored
> /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld:
> libdriver.a(regexp.o) (15065197): Section flag STYP_COPY (0x10)
> ignored
> make: *** [Makefile:194: driver.exe] Error 1
>
> aunyx@DESKTOP-R60LL3E ~/fluffos/src
> $ cat ld.exe.stackdump
> Exception: STATUS_ACCESS_VIOLATION at rip=0010045A417
> rax=0000000000000000 rbx=0000000600525E40 rcx=0000000600525E40
> rdx=0000000100571C00 rsi=0000000000000001 rdi=00000006002E2420
> r8 =0000000600528C70 r9 =0000000000000058 r10=0000000100000000
> r11=0000000000000000 r12=00000000000003EE r13=0000000100571C00
> r14=00000006000D5B50 r15=00000006000CDC00
> rbp=00000006000D9A30 rsp=00000000FFFFC4D0
> program=D:\cygwin\usr\x86_64-pc-cygwin\bin\ld.exe, pid 8564, thread main
> cs=0033 ds=002B es=002B fs=0053 gs=002B ss=002B
> Stack trace:
> Frame        Function    Args
> 006000D9A30  0010045A417 (00100571C00, 006000E3374, 000FFFFC6A0, 00100571C00)
> 006000D9A30  0010045382E (006002E2420, 006000D9A30, 000000003EE, 00100571C00)
> 006000D9A30  0010045433E (001004EAE20, 00000000000, 0010042843B, 000FFFFC70C)
> 006000D9A30  0010043C095 (00100571C00, 001004542E0, 001800BAE1C, 00000000000)
> 00000000000  0010040EDB8 (00600075530, 00600076970, 0010050295C, 00000000000)
> 00000000000  0010040F8D0 (001802FDC50, 00600068A50, 001800BB092, 00600069690)
> 000FFFFCA40  00100411976 (003FED791C0, 006000003F0, 001800BB092, 00000390038)
> 000FFFFCA40  001004E8C7A (000FFFFCA40, 000FFFFCAF0, 00000000000, 001801C31A0)
> 000FFFFCCB0  00180047BC2 (00000000000, 00000000000, 00000000000, 00000000000)
> 00000000000  00180045863 (00000000000, 00000000000, 00000000000, 00000000000)
> 000FFFFFFF0  00180045914 (00000000000, 00000000000, 00000000000, 00000000000)
> End of stack trace

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Error Linking LTO programs using GCC6.4
  2017-09-27 13:51 Error Linking LTO programs using GCC6.4 叶雨飞
  2017-09-27 14:22 ` 叶雨飞
@ 2017-09-27 18:26 ` Steven Penny
  1 sibling, 0 replies; 6+ messages in thread
From: Steven Penny @ 2017-09-27 18:26 UTC (permalink / raw)
  To: cygwin

On Wed, 27 Sep 2017 06:51:05, =?UTF-8?B?5Y+26Zuo6aOe?= wrote:
> The same program was linking fine using previous gcc 5.X , please
> advise how to debug further.

Known issue:

- http://cygwin.com/ml/cygwin/2017-09/msg00236.html
- http://github.com/Martchus/tageditor/issues/23

doesnt looks like this will be resolved soon


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Error Linking LTO programs using GCC6.4
  2017-09-27 14:22 ` 叶雨飞
@ 2017-09-27 22:18   ` 叶雨飞
  2017-09-27 23:16     ` Steven Penny
  0 siblings, 1 reply; 6+ messages in thread
From: 叶雨飞 @ 2017-09-27 22:18 UTC (permalink / raw)
  To: cygwin

This is actually not the same issue at
https://cygwin.com/ml/cygwin/2017-09/msg00236.html

In my case, it is caused by latest binutils 2.28 , when using 2.25
everything is fine (even with gcc-6.4)

Maybe we should hold back upgrading binutils , or maybe it need a more
recent version? There seems to be binutils 2.29.1 now

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Error Linking LTO programs using GCC6.4
  2017-09-27 22:18   ` 叶雨飞
@ 2017-09-27 23:16     ` Steven Penny
  2017-09-28  7:35       ` 叶雨飞
  0 siblings, 1 reply; 6+ messages in thread
From: Steven Penny @ 2017-09-27 23:16 UTC (permalink / raw)
  To: cygwin

On Wed, 27 Sep 2017 14:42:43, =?UTF-8?B?5Y+26Zuo6aOe?= wrote:
> This is actually not the same issue at
> https://cygwin.com/ml/cygwin/2017-09/msg00236.html
> 
> In my case, it is caused by latest binutils 2.28 , when using 2.25
> everything is fine (even with gcc-6.4)
> 
> Maybe we should hold back upgrading binutils , or maybe it need a more
> recent version? There seems to be binutils 2.29.1 now

Actually, it is the same issue:

    $ cygcheck -s | grep -e binutils -e gcc
    mingw64-x86_64-binutils                 2.25.0.1.23f238d-1     OK
    mingw64-x86_64-gcc-core                 6.3.0-1                OK
    mingw64-x86_64-gcc-g++                  6.3.0-1                OK

    $ cat z.cpp
    #include <iostream>
    main() {
      std::cout << "cout test\n";
    }

    $ x86_64-w64-mingw32-g++ -static -o z z.cpp
    $ ./z
    cout test

So, with both your post and my post, the issue is fixed by not using:

- binutils 2.28.1
- mingw64-x86_64-binutils 2.28.1
- mingw64-i686-binutils 2.28.1

which leaves the last working version:

- binutils 2.25.0
- mingw64-x86_64-binutils 2.25.0
- mingw64-i686-binutils 2.25.0


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Error Linking LTO programs using GCC6.4
  2017-09-27 23:16     ` Steven Penny
@ 2017-09-28  7:35       ` 叶雨飞
  0 siblings, 0 replies; 6+ messages in thread
From: 叶雨飞 @ 2017-09-28  7:35 UTC (permalink / raw)
  To: cygwin

Aha,  do you get the same stacktrace that I have?  Also, it seems you
don't use -flto , so it has nothing to do with LTO.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-09-28  4:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-27 13:51 Error Linking LTO programs using GCC6.4 叶雨飞
2017-09-27 14:22 ` 叶雨飞
2017-09-27 22:18   ` 叶雨飞
2017-09-27 23:16     ` Steven Penny
2017-09-28  7:35       ` 叶雨飞
2017-09-27 18:26 ` Steven Penny

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).