Bug 51181 - [4.7 regression] libstdc++.so __sync_sub_and_fetch_4 linkage error causing many test suite failures on m68k-linux
Summary: [4.7 regression] libstdc++.so __sync_sub_and_fetch_4 linkage error causing ma...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 51140 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-11-16 22:20 UTC by Mikael Pettersson
Modified: 2011-11-22 21:32 UTC (History)
4 users (show)

See Also:
Host:
Target: m68k-linux
Build:
Known to work:
Known to fail: 4.7.0
Last reconfirmed: 2011-11-17 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mikael Pettersson 2011-11-16 22:20:48 UTC
Some change between 4.7-20111105 and 4.7-20111112 caused massive test suite regressions for C++ code on m68k-linux:

--- mail-report-4.7-20111105-0  2011-11-16 22:52:30.000000000 +0100
+++ mail-report-4.7-20111112-0  2011-11-16 22:39:07.000000000 +0100
@@ -1,5 +1,5 @@
-LAST_UPDATED: Obtained from SVN: trunk revision 181017
+LAST_UPDATED: Obtained from SVN: trunk revision 181327
 
 Native configuration is m68k-unknown-linux-gnu
 
...

                === g++ Summary ===
 
-# of expected passes           26073
-# of unexpected failures       96
-# of expected failures         151
-# of unsupported tests         413
-/mnt/scratch/objdir47/gcc/testsuite/g++/../../g++  version 4.7.0 20111105 (experimental) (GCC) 
+# of expected passes           36074
+# of unexpected failures       3881
+# of expected failures         277
+# of unresolved testcases      98
+# of unsupported tests         659
+/mnt/scratch/objdir47/gcc/testsuite/g++/../../g++  version 4.7.0 20111112 (experimental) (GCC) 
 
...

                === libgomp Summary ===
 
-# of expected passes           1214
-# of unexpected failures       13
+# of expected passes           272
+# of unexpected failures       478
 # of unsupported tests         8

...

                === libstdc++ Summary ===
 
-# of expected passes           8323
-# of unexpected failures       13
-# of expected failures         46
-# of unsupported tests         249
+# of expected passes           2002
+# of unexpected failures       2582
+# of expected failures         5
+# of unsupported tests         655
 
-Compiler version: 4.7.0 20111105 (experimental) (GCC) 
+Compiler version: 4.7.0 20111112 (experimental) (GCC) 
 Platform: m68k-unknown-linux-gnu
 configure flags: --prefix=/mnt/scratch/install47 --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++ --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --disable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --disable-sjlj-exceptions --disable-libmudflap --with-gmp=/home/mikpe/pkgs/linux-m68k/gmp-5.0.2 --with-mpfr=/home/mikpe/pkgs/linux-m68k/mpfr-3.0.1 --with-mpc=/home/mikpe/pkgs/linux-m68k/mpc-0.9 --disable-plugin --disable-lto --disable-multilib --disable-build-poststage1-with-cxx
 BOOT_CFLAGS=-g -O2

Looking in gcc/testsuite/g++/g++.log I see many (more than 11000) undefined references to __sync_sub_and_fetch_4, like this one:

Executing on host: /mnt/scratch/objdir47/gcc/testsuite/g++/../../g++ -B/mnt/scratch/objdir47/gcc/testsuite/g++/../../ /mnt/scratch/gcc-4.7-20111112/gcc/testsuite/g++.dg/bprob/g++-bprob-1.C   -nostdinc++ -I/mnt/scratch/objdir47/m68k-unknown-linux-gnu/libstdc++-v3/include/m68k-unknown-linux-gnu -I/mnt/scratch/objdir47/m68k-unknown-linux-gnu/libstdc++-v3/include -I/mnt/scratch/gcc-4.7-20111112/libstdc++-v3/libsupc++ -I/mnt/scratch/gcc-4.7-20111112/libstdc++-v3/include/backward -I/mnt/scratch/gcc-4.7-20111112/libstdc++-v3/testsuite/util -fmessage-length=0  -g   -fprofile-arcs    -L/mnt/scratch/objdir47/m68k-unknown-linux-gnu/./libstdc++-v3/src/.libs  -B/mnt/scratch/objdir47/m68k-unknown-linux-gnu/./libstdc++-v3/src/.libs  -L/mnt/scratch/objdir47/m68k-unknown-linux-gnu/./libstdc++-v3/src/.libs  -lm   -o /mnt/scratch/objdir47/gcc/testsuite/g++/g++-bprob-1.x01    (timeout = 300)
/mnt/scratch/objdir47/m68k-unknown-linux-gnu/./libstdc++-v3/src/.libs/libstdc++.so: undefined reference to `__sync_sub_and_fetch_4'
collect2: error: ld returned 1 exit status

Only C++ appears affected, the C test results were on par with last week's.
Comment 1 John David Anglin 2011-11-17 20:54:31 UTC
Also seen on hppa64-hp-hpux11.11.  There is no hardware or kernel
support for compare and swap as far as I know on HP PARISC.  Thus
the best that can be done is a mutex implementation.
Comment 2 jsm-csl@polyomino.org.uk 2011-11-17 21:06:54 UTC
FWIW, classic m68k has compare-and-swap, while ColdFire Linux uses kernel 
helpers (available in both vDSO and syscall forms; the syscall forms are 
probably rather easier to use from libgcc than the vDSO is).
Comment 3 Paolo Carlini 2011-11-17 21:10:25 UTC
I would recommend figuring out which specific patch part of the recent TM / C++ atomic work is at the root of the problem and thus CC-ing either Aldy or Andrew or Rth about it
Comment 4 dave.anglin 2011-11-17 21:46:40 UTC
Symbol is from libsupc++/eh_tm.cc.
Comment 5 Richard Henderson 2011-11-17 22:52:45 UTC
http://gcc.gnu.org/ml/libstdc++/2011-11/msg00160.html
Comment 6 Paolo Carlini 2011-11-17 23:59:16 UTC
Thanks Richard. I would say, please test.
Comment 7 Richard Henderson 2011-11-18 01:38:53 UTC
Author: rth
Date: Fri Nov 18 01:38:48 2011
New Revision: 181465

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181465
Log:
PR libstdc++/51181
        * libsupc++/eh_tm.cc (free_any_cxa_exception): Protect the use
        of __sync_sub_and_fetch with _GLIBCXX_ATOMIC_BUILTINS_4.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/libsupc++/eh_tm.cc
Comment 8 Mikael Pettersson 2011-11-18 09:50:30 UTC
Testing Richard's patch ...
Comment 9 Mikael Pettersson 2011-11-20 10:18:44 UTC
Richard's patch in r181465 fixed these failures.
Comment 10 Cesar Strauss 2011-11-22 21:32:33 UTC
*** Bug 51140 has been marked as a duplicate of this bug. ***