[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gold/19044] New: Gold links single-threaded program into a deadlock
From: |
sduvan.gcc at gmail dot com |
Subject: |
[Bug gold/19044] New: Gold links single-threaded program into a deadlock on i686 Linux |
Date: |
Thu, 01 Oct 2015 13:46:07 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=19044
Bug ID: 19044
Summary: Gold links single-threaded program into a deadlock on
i686 Linux
Product: binutils
Version: 2.25
Status: NEW
Severity: normal
Priority: P2
Component: gold
Assignee: ccoutant at gmail dot com
Reporter: sduvan.gcc at gmail dot com
CC: ian at airs dot com
Target Milestone: ---
Created attachment 8664
--> https://sourceware.org/bugzilla/attachment.cgi?id=8664&action=edit
Testcase
The attached reduced testcase shows an example where single-threaded code, if
compiled with gcc 5.2.0 and linked with gold (version 2.25) on i686 Linux,
results in an executable that deadlocks when run. Looking into the details with
a debugger, it seems like the threaded mode support code in libstdc++
(__gthread_active_p()) is handled differently in the constructor and the
destructor of __gnu_cxx::___scoped_lock. While the constructor does the
appropriate test the destructor does not (equivalent to assuming no threading
support). This means that the second time __scoped_lock's constructor is called
the program deadlocks.
Linking with ld (version 2.25), there is no deadlock. Compiling and linking
with gold on x86_64 does not result in a deadlock. The testcase is sensitive to
perturbations and compiler version (the issue has also been seen with gcc 4.9.1
but the testcase was much bigger in that case).
gcc 5.2.0 was configured in the following way:
bash> /opt/sandbox/gcc/5.2.0/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/opt/sandbox/gcc/5.2.0/bin/g++
COLLECT_LTO_WRAPPER=/opt/sandbox/gcc/5.2.0/lib/gcc/x86_64-suse-linux/5.2.0/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../../gcc-5.2.0/configure --enable-languages=c,c++,fortran
--enable-targets=x86_64-suse-linux,i686-suse-linux
--prefix=/opt/sandbox/gcc/5.2.0 --with-gnu-as
--with-as=/opt/sandbox/gcc/binutils-2.25.1/bin/as --with-gnu-ld
--with-ld=/opt/sandbox/gcc/binutils-2.25.1/bin/ld.gold
--with-gmp=/opt/sandbox/gcc/gmp-5.0.1 --with-mpfr=/opt/sandbox/gcc/mpfr-3.0.0
--with-mpc=/opt/sandbox/gcc/mpc-0.8.2 --enable-threads=posix --enable-shared
--enable-__cxa_atexit --enable-libstdcxx-allocator=pool x86_64-suse-linux
Thread model: posix
gcc version 5.2.0 (GCC)
To see the deadlock:
bash> tar -zxvf gold-bug.tar.gz
bash> make bug
bash> ./bug
(hangs)
--
You are receiving this mail because:
You are on the CC list for the bug.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug gold/19044] New: Gold links single-threaded program into a deadlock on i686 Linux,
sduvan.gcc at gmail dot com <=