[Bug binutils/24074] ld fails silently when linking MinGW 64-bit app with BOINC libs

2019-01-07 Thread bugzi...@poradnik-webmastera.com
https://sourceware.org/bugzilla/show_bug.cgi?id=24074

--- Comment #1 from Daniel  ---
I also tried to copy .o/.a files to my Windows machine, and use MinGW toolchain
from latest Cygwin, with binutils 2.29.1.20171006. This time ld crashed with
messages as below. I tried to run this under gdb, but for some reason it did
not catch this signal.

collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core
dumped
compilation terminated.
/usr/lib/gcc/x86_64-w64-mingw32/7.4.0/../../../../x86_64-w64-mingw32/bin/ld:
BFD (GNU Binutils) 2.29.1.20171006 assertion fail
/cygdrive/i/szsz/tmpp/cygwin64/mingw64-x86_64/mingw64-x86_64-binutils-2.29.1.787c9873-1.x86_64/src/binutils-gdb/bfd/cofflink.c:265

Here is contents of ld.exe.stackdump file:

Exception: STATUS_ACCESS_VIOLATION at rip=03E
rax=0001004EFC80 rbx=000600137010 rcx=000600137010
rdx=000600137E18 rsi=0001004ECF38 rdi=0001
r8 =C650 r9 =000180144F30 r10=0001
r11=00010043747B r12=C650 r13=000600137E18
r14=00060013DA80 r15=000100574C00
rbp=0006001295A0 rsp=C588
program=C:\cygwin64\usr\x86_64-w64-mingw32\bin\ld.exe, pid 140, thread main
cs=0033 ds=002B es=002B fs=0053 gs=002B ss=002B
Stack trace:
FrameFunctionArgs
006001295A0  03E (00100524F48, 0010053F5E0, 109, 001)
006001295A0  00100453FA7 (00100574C00, 006001295A0, 0060012DC90, 00100574C00)
006001295A0  0010045496E (001004ECF38, 000, 00100428B2B, 000C77C)
006001295A0  0010043C85C (00100574C00, 00100454910, 001800BF54C, 000)
000  0010040F1E8 (0010050499C, 00600074510, 0010050499C, 000)
001  0010040FD20 (000CAB0, 03A, 001800BF7C2, 000CAB0)
0010050FB40  00100411E16 (003EBDC91C0, 00603A0, 000CBC0, 00180275184)
0010050FB40  001004EA3C6 (000CAB0, 00603B8, 000, 00603C4)
000CCD0  00180049E16 (000, 000, 000, 000)
000  00180047973 (000, 000, 000, 000)
000FFF0  00180047A24 (000, 000, 000, 000)
End of stack trace

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/24074] ld fails silently when linking MinGW 64-bit app with BOINC libs

2019-01-09 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24074

Nick Clifton  changed:

   What|Removed |Added

 CC||nickc at redhat dot com

--- Comment #2 from Nick Clifton  ---
(In reply to Daniel from comment #0)

Hi Daniel,

> I was trying to link 64-bit MinGW app using crosscompiler on CentOS Linux.

Is the bionic library very big ?  Mysterious failures like this are often 
caused by the system running out of resources.  Usually memory or disk space.

> GNU ld (GNU Binutils) 2.25

2.25 is an old version of the binutils.  We are currently on release 2.31...


> /root/gcc-8.2.0-mingw64/lib/gcc/x86_64-w64-mingw32/8.2.0/crtend.o succeeded
> /root/gcc-8.2.0-mingw64/lib/gcc/x86_64-w64-mingw32/8.2.0/crtend.ocollect2:
> error: ld returned 1 exit status


> #2  0x00418160 in ldwrite () at ../../ld/ldwrite.c:590

Sadly that bit of code is very unhelpful:

 if (!bfd_final_link (link_info.output_bfd, &link_info))
{
  /* If there was an error recorded, print it out.  Otherwise assume
 an appropriate error message like unknown symbol was printed
 out.  */

  if (bfd_get_error () != bfd_error_no_error)
einfo (_("%F%P: final link failed: %E\n"));
  else
xexit (1);   < this is line 590
}

So the linker is terminating, and hoping that an error message has already
been displayed. :-(


> /usr/lib/gcc/x86_64-w64-mingw32/7.4.0/../../../../x86_64-w64-mingw32/bin/ld: 
> BFD (GNU Binutils) 2.29.1.20171006 assertion fail /cygdrive/i/szsz
> /tmpp/cygwin64/mingw64-x86_64/mingw64-x86_64-binutils-2.29.1.787c9873-1.x86_64
> /src/binutils-gdb/bfd/cofflink.c:265

OK, well that assertion is checking that size of ordinary symbols and
auxillary symbols is the same:

   BFD_ASSERT (symesz == bfd_coff_auxesz (abfd));

Is it possible for you to find these two values ?  I have a theory that
the problem is that one or maybe both of them has not been initialised.
On Linux this probably goes undetected because allocated memory is usually
zeroed, even if not explicitly requested by the program.  But under mingw32
the memory could contain any random value.  That is just a guess however.

Cheers
  Nick

 BFD_ASSERT (symesz == bfd_coff_auxesz (abfd));

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/24074] ld fails silently when linking MinGW 64-bit app with BOINC libs

2019-01-13 Thread bugzi...@poradnik-webmastera.com
https://sourceware.org/bugzilla/show_bug.cgi?id=24074

--- Comment #3 from Daniel  ---
(In reply to Nick Clifton from comment #2)
> (In reply to Daniel from comment #0)
> 
> Hi Daniel,
> 
> > I was trying to link 64-bit MinGW app using crosscompiler on CentOS Linux.
> 
> Is the bionic library very big ?  Mysterious failures like this are often 
> caused by the system running out of resources.  Usually memory or disk space.

BOINC, not bionic :) BTW, sources are at https://github.com/BOINC/boinc . Lib
is not big. Machine where I compiled it had 17GB of free HDD space and 64GB
RAM. I also did not saw any "killed" errors caused by OOM from make when
building. In the past I saw them on Odroid, so I am familiar with them.

> Sadly that bit of code is very unhelpful:
> 
>  if (!bfd_final_link (link_info.output_bfd, &link_info))
> [cut]
> So the linker is terminating, and hoping that an error message has already
> been displayed. :-(

Yes, definitely. It would be good to improve this.

> > /usr/lib/gcc/x86_64-w64-mingw32/7.4.0/../../../../x86_64-w64-mingw32/bin/ld:
> >  
> > BFD (GNU Binutils) 2.29.1.20171006 assertion fail /cygdrive/i/szsz
> > /tmpp/cygwin64/mingw64-x86_64/mingw64-x86_64-binutils-2.29.1.787c9873-1.x86_64
> > /src/binutils-gdb/bfd/cofflink.c:265
> 
> OK, well that assertion is checking that size of ordinary symbols and
> auxillary symbols is the same:
> 
>BFD_ASSERT (symesz == bfd_coff_auxesz (abfd));

Unfortunately gdb under Cygwin for some reason is not catching this crash, I
tried to do it before I logged this issue. I will try to build new binutils on
Linux and see what I will find there. 

In the meantime I found another thing. It turned out that configure script
generates/modifies files which are then used during MinGW build. In fact I had
to edit config.h to disable HAVE_STRCASESTR, but I assumed that someone else
broke MinGW build and this was not fixed yet. These generated files came from
some older BOINC version.

When I cloned BOINC repo in new dir and started build there, I got working
libs. Here are their sizes:

[root@Wojslawice mingw64]# ls -lh /boinc2/820/mingw64/lib/
total 488K
-rw-r--r--. 1 root root 413K Jan 12 23:46 libboinc.a
-rw-r--r--. 1 root root  47K Jan 12 23:46 libboinc_api.a
-rw-r--r--. 1 root root  13K Jan 12 23:46 libboinc_graphics2.a
-rw-r--r--. 1 root root 6.9K Jan 12 23:46 libboinc_opencl.a

And this is for broken build:

[root@Wojslawice mingw64]# ls -lh /root/boinc82/mingw64/lib/
total 6.7M
-rw-r--r--. 1 root root 6.7M Jan  5 19:00 libboinc.a
-rw-r--r--. 1 root root  47K Jan  5 19:00 libboinc_api.a
-rw-r--r--. 1 root root  13K Jan  5 19:00 libboinc_graphics2.a
-rw-r--r--. 1 root root 6.9K Jan  5 19:00 libboinc_opencl.a

At this moment I do not know if bad code was created by gcc, as or ld - I am
going to find this, and create small testcase so you would be able to reproduce
this. I will either update this issue or log a new one for gcc.

I am attaching broken libs to this issue, so you could check what exactly is
wrong with them.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/24074] ld fails silently when linking MinGW 64-bit app with BOINC libs

2019-01-13 Thread bugzi...@poradnik-webmastera.com
https://sourceware.org/bugzilla/show_bug.cgi?id=24074

--- Comment #4 from Daniel  ---
Created attachment 11538
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11538&action=edit
Broken BOINC libs

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/24074] ld fails silently when linking MinGW 64-bit app with BOINC libs

2019-12-29 Thread ssbssa at yahoo dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=24074

Hannes Domani  changed:

   What|Removed |Added

 CC||ssbssa at yahoo dot de

--- Comment #5 from Hannes Domani  ---
(In reply to Daniel from comment #4)
> Created attachment 11538 [details]
> Broken BOINC libs

I've just tried to compile & link the example a.cpp from the description, with
the attached BOINC libs, and it works for me:

$ g++ -c a.cpp
$ g++ -static -oa.exe a.o -Lmingw64/lib -lboinc_api -lboinc

And the resulting a.exe starts without problem.

So I'm guessing the bug was already fixed.
I used gcc 9.2.0 and binutils 2.33.1 for my tests.

-- 
You are receiving this mail because:
You are on the CC list for the bug.