Bug 42503 - [4.4 Regression] gcc-4.4-20091215 broke libjava on ARM
Summary: [4.4 Regression] gcc-4.4-20091215 broke libjava on ARM
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.4.3
: P1 normal
Target Milestone: 4.4.3
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-25 13:57 UTC by Mikael Pettersson
Modified: 2010-01-05 15:41 UTC (History)
3 users (show)

See Also:
Host: armv5tel-unknown-linux-gnueabi
Target: armv5tel-unknown-linux-gnueabi
Build: armv5tel-unknown-linux-gnueabi
Known to work:
Known to fail:
Last reconfirmed: 2009-12-28 21:40:59


Attachments
pr40134 for 4.4 (2.17 KB, patch)
2009-12-28 09:40 UTC, Matthias Klose
Details | Diff
pr40134 generic + arm bits (1.67 KB, patch)
2009-12-29 13:05 UTC, Mikael Pettersson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikael Pettersson 2009-12-25 13:57:35 UTC
Building gcc-4.4-20091215 on arm with java enabled fails with a linkage error:

libtool: link: ( cd ".libs" && rm -f "libgcj_bc.la" && ln -s "../libgcj_bc.la" "libgcj_bc.la" )
/bin/sh ./libtool --tag=GCJ --mode=link /home/mikpe/objdir44/gcc/gcj -B/home/mikpe/objdir44/armv5tel-brewer-linux-gnueabi/libjava/ -B/home/mikpe/objdir44/gcc/ -L/home/mikpe/objdir44/armv5tel-brewer-linux-gnueabi/libjava -g -O2  -o jv-convert --main=gnu.gcj.convert.Convert -rpath /home/mikpe/crap/lib -shared-libgcc  -L/home/mikpe/objdir44/armv5tel-brewer-linux-gnueabi/libjava/../libstdc++-v3/src/.libs -lstdc++  -L/home/mikpe/objdir44/armv5tel-brewer-linux-gnueabi/libjava/.libs libgcj.la 
libtool: link: /home/mikpe/objdir44/gcc/gcj -B/home/mikpe/objdir44/armv5tel-brewer-linux-gnueabi/libjava/ -B/home/mikpe/objdir44/gcc/ -g -O2 -o .libs/jv-convert --main=gnu.gcj.convert.Convert -shared-libgcc  -L/home/mikpe/objdir44/armv5tel-brewer-linux-gnueabi/libjava/.libs -L/home/mikpe/objdir44/armv5tel-brewer-linux-gnueabi/libjava -L/home/mikpe/objdir44/armv5tel-brewer-linux-gnueabi/libjava/../libstdc++-v3/src/.libs /home/mikpe/objdir44/armv5tel-brewer-linux-gnueabi/libjava/../libstdc++-v3/src/.libs/libstdc++.so ./.libs/libgcj.so /home/mikpe/objdir44/armv5tel-brewer-linux-gnueabi/libstdc++-v3/src/.libs/libstdc++.so -lm -lpthread -lrt -ldl -lz -Wl,-rpath -Wl,/home/mikpe/crap/lib
/usr/bin/ld: .libs/jv-convert: hidden symbol `__sync_synchronize' in /home/mikpe/objdir44/gcc/libgcc.a(linux-atomic.o) is referenced by DSO
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
make[3]: *** [jv-convert] Error 1
make[3]: Leaving directory `/home/mikpe/objdir44/armv5tel-brewer-linux-gnueabi/libjava'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/mikpe/objdir44/armv5tel-brewer-linux-gnueabi/libjava'
make[1]: *** [all-target-libjava] Error 2
make[1]: Leaving directory `/home/mikpe/objdir44'
make: *** [bootstrap] Error 2

4.4 snapshots up to and including 20091208 build fine, so this is a recent regression.
Comment 1 Mikael Pettersson 2009-12-26 14:59:49 UTC
Reverting r155171 allows gcc-4.4-20091215 to build a working libjava again.

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155171
Log:
2009-12-11  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>

        PR target/42263
        2009-08-11  Andrew Haley  <aph@redhat.com>
        * config/arm/arm.c (arm_init_libfuncs): Add __sync_synchronize.

I suspect ARM's "static libgcc has more symbols than the shared one" bug is involved here (see PR40133 and PR40134).
Comment 2 Ramana Radhakrishnan 2009-12-27 11:37:08 UTC
The correct fix is potentially a version of the fix for PR40133 / PR40134 for arm-linux-gnueabi. Looking at this.
Comment 3 Paolo Carlini 2009-12-27 11:59:20 UTC
Yes, unless Matthias has a good explanation and fix for what's going on, those changes should be immediately reverted, I will do that anyway in 3-4 days max.
Comment 4 Paolo Carlini 2009-12-27 12:18:13 UTC
Note, however, that something is definitely wrong in the analysis: PR40133 and PR40134 have been fixed **only in mainline**, thus per se those changes cannot be involved in a breakage involving 4_4-branch. As far as libstdc++ is concerned, in particular, in 4_4-branch we are not trying to do link-test anywhere, we cannot make mistakes about static libgcc symbols. Still, I'm seeing something puzzling and alarming here from the point of view of those issues and I would recommend Matthias to also have a look.
Comment 5 Mikael Pettersson 2009-12-27 13:59:12 UTC
(In reply to comment #4)
> Note, however, that something is definitely wrong in the analysis: PR40133 and
> PR40134 have been fixed **only in mainline**, thus per se those changes cannot
> be involved in a breakage involving 4_4-branch.

I believe it's the *absence* of the PR40134 fix on 4_4-branch that's causing the backport of __sync_synchronize() support to regress. I'm currently testing 4.4-20091215 with relevant bits of PR40134 backported (r151568 + r152975): that cured the build failure, but the testsuite run is not yet finished.
Comment 6 Paolo Carlini 2009-12-27 14:41:28 UTC
Thus you mean only 40134 is involved. Because 40133 *assumes* that on the relevant linux targets there are no surprises with shared vs static libgcc. 

In general, I want to make sure nothing changes in the compiler-proper that breaks the assumptions of 40133, which then would have to be reverted. For now mainline seems still ok, I think Matthias tests regularly those targets.
Comment 7 Mikael Pettersson 2009-12-28 00:46:15 UTC
(In reply to comment #5)
> I believe it's the *absence* of the PR40134 fix on 4_4-branch that's causing
> the backport of __sync_synchronize() support to regress. I'm currently testing
> 4.4-20091215 with relevant bits of PR40134 backported (r151568 + r152975): that
> cured the build failure, but the testsuite run is not yet finished.

The testsuite run now finished with no regressions compared to 4.4 snapshots from before this regression.
Comment 8 Matthias Klose 2009-12-28 09:40:10 UTC
Created attachment 19399 [details]
pr40134 for 4.4

Mikael's analysis seems to be right; the __sync_synchronise backport requires the backport of pr40134. I'm attaching the patch that I do apply for the Debian gcc-4.4 build, based on Jakub's initial patch including the powerpc chunk and the bits for arm and parisc.
Comment 9 Paolo Carlini 2009-12-28 10:37:33 UTC
Good. To clarify, I have no personal objections to that specific kind of backport to 4_4-branch... seems a bit late, but still, since the basic issue is a wrong-code... up to the maintainers.
Comment 10 Mikael Pettersson 2009-12-28 12:11:15 UTC
Matthias, your Debian patch includes the following, which is not part of the trunk fix for PR40134 but instead appears to be a fragment from an early version of the PR41175/PR40677 fix (which seems to depend on PR40134):

--- a/src/gcc/config/rs6000/rs6000.c    (revision 151558)
+++ b/src/gcc/config/rs6000/rs6000.c    (working copy)
@@ -15869,7 +15869,7 @@
 no_global_regs_above (int first, bool gpr)
 {
   int i;
-  for (i = first; i < gpr ? 32 : 64 ; i++)
+  for (i = first; i < (gpr ? 32 : 64) ; i++)
     if (global_regs[i])
       return false;
   return true;

Comment 11 Ramana Radhakrishnan 2009-12-29 10:24:33 UTC
(In reply to comment #7)
> (In reply to comment #5)
> > I believe it's the *absence* of the PR40134 fix on 4_4-branch that's causing
> > the backport of __sync_synchronize() support to regress. I'm currently testing
> > 4.4-20091215 with relevant bits of PR40134 backported (r151568 + r152975): that
> > cured the build failure, but the testsuite run is not yet finished.
> 
> The testsuite run now finished with no regressions compared to 4.4 snapshots
> from before this regression.
> 

Can you or Matthias submit this patch to gcc-patches@gcc.gnu.org ? 

Comment 12 Mikael Pettersson 2009-12-29 13:05:00 UTC
Created attachment 19413 [details]
pr40134 generic + arm bits

This is the version of the PR40134 patch I intend to submit, unless Matthias wants to submit his version. This version only adds t-slibgcc-libgcc support and enables it for arm-linux-gnueabi. Mainline and debian also enables it for some powerpc and hppa targets, I'm excluding those bits to avoid involving other targets than arm at this point. (It's easy to enable other targets later on.)
Comment 13 Debian GCC Maintainers 2009-12-29 13:34:38 UTC
looks fine to me (but I cannot approve). I'm using this patch already for package builds without seeing regressions.
Comment 14 Mikael Pettersson 2009-12-29 23:15:14 UTC
Patch submitted:
<http://gcc.gnu.org/ml/gcc-patches/2009-12/msg01192.html>
Comment 15 Matthias Klose 2010-01-04 15:13:39 UTC
Subject: Bug 42503

Author: doko
Date: Mon Jan  4 15:13:08 2010
New Revision: 155617

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155617
Log:
2010-01-04  Mikael Pettersson  <mikpe@it.uu.se>

        PR target/42503

        Backport from mainline:

        2009-09-09  Jakub Jelinek  <jakub@redhat.com>

        * config/t-slibgcc-elf-ver (SHLIB_MAKE_SOLINK, SHLIB_INSTALL_SOLINK):
        New variables.
        (SHLIB_LINK, SHLIB_INSTALL): Use them.
        * config/t-slibgcc-libgcc: New file.

        2009-10-19  Matthias Klose  <doko@ubuntu.com>

        PR target/40134
        * config.gcc (arm*-*-linux-*eabi): Use config/t-slibgcc-libgcc.

Added:
    branches/gcc-4_4-branch/gcc/config/t-slibgcc-libgcc
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/config.gcc
    branches/gcc-4_4-branch/gcc/config/t-slibgcc-elf-ver

Comment 16 Richard Biener 2010-01-05 15:17:54 UTC
Is this fixed now?
Comment 17 Mikael Pettersson 2010-01-05 15:41:22 UTC
Fixed now, closing.