[Bug bootstrap/55571] [4.6/4.7/4.8 regression] PR48076 fix broke bootstrap on armv5tel-linux-gnueabi

2012-12-04 Thread rth at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55571



--- Comment #9 from Richard Henderson rth at gcc dot gnu.org 2012-12-04 
17:09:07 UTC ---

(In reply to comment #8)

 In case it's useful to anyone else, a small program that reproduces the

 problem.

 

 % arm-linux-gnueabi-gcc -o utils utils.c

 [same problem with __sync_synchronize]



Does this require the compiler to be installed?  Because I'm having trouble

triggering the problem reliably.  I've tried your test with the compiler

still in-tree and it succeeds.  I can reproduce the fail with a full build,

but invoking the same link from the command line does NOT fail.



There's something weird going on here with the linker...


[Bug bootstrap/55571] [4.6/4.7/4.8 regression] PR48076 fix broke bootstrap on armv5tel-linux-gnueabi

2012-12-04 Thread rth at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55571



--- Comment #10 from Richard Henderson rth at gcc dot gnu.org 2012-12-04 
19:05:44 UTC ---

I can reproduce Joel's problem with the g++ driver or,

as expected, by adding -shared-libgcc to the link line.



Leaving aside the odd and transient bootstrap problem

(which really should not have occurred using -static-libgcc),

it becomes easy to see that when the shared libgcc has an

undefined symbol that is resolvable by the static libgcc,

then the linker is correct in generating the hidden symbol

referenced by DSO error.



The attachment I posted for gcc 4.7 applies with fuzz 1 to

mainline.


[Bug bootstrap/55571] [4.6/4.7/4.8 regression] PR48076 fix broke bootstrap on armv5tel-linux-gnueabi

2012-12-04 Thread rth at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55571



--- Comment #11 from Richard Henderson rth at gcc dot gnu.org 2012-12-04 
19:08:23 UTC ---

Author: rth

Date: Tue Dec  4 19:08:18 2012

New Revision: 194159



URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=194159

Log:

PR bootstrap/55571



* Makefile.in (libgcc_s.so): Depend on and link with libgcc.a.



Modified:

trunk/libgcc/ChangeLog

trunk/libgcc/Makefile.in


[Bug bootstrap/55571] [4.6/4.7/4.8 regression] PR48076 fix broke bootstrap on armv5tel-linux-gnueabi

2012-12-04 Thread rth at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55571



--- Comment #12 from Richard Henderson rth at gcc dot gnu.org 2012-12-04 
19:10:05 UTC ---

Author: rth

Date: Tue Dec  4 19:09:59 2012

New Revision: 194160



URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=194160

Log:

PR bootstrap/55571



* Makefile.in (libgcc_s.so): Depend on and link with libgcc.a.



Modified:

branches/gcc-4_7-branch/libgcc/ChangeLog

branches/gcc-4_7-branch/libgcc/Makefile.in


[Bug bootstrap/55571] [4.6/4.7/4.8 regression] PR48076 fix broke bootstrap on armv5tel-linux-gnueabi

2012-12-04 Thread rth at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55571



--- Comment #13 from Richard Henderson rth at gcc dot gnu.org 2012-12-04 
19:11:39 UTC ---

Author: rth

Date: Tue Dec  4 19:11:33 2012

New Revision: 194161



URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=194161

Log:

PR bootstrap/55571



* Makefile.in (libgcc_s.so): Depend on and link with libgcc.a.



Modified:

branches/gcc-4_6-branch/libgcc/ChangeLog

branches/gcc-4_6-branch/libgcc/Makefile.in


[Bug bootstrap/55571] [4.6/4.7/4.8 regression] PR48076 fix broke bootstrap on armv5tel-linux-gnueabi

2012-12-04 Thread rth at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55571



Richard Henderson rth at gcc dot gnu.org changed:



   What|Removed |Added



 Status|ASSIGNED|RESOLVED

 Resolution||FIXED



--- Comment #14 from Richard Henderson rth at gcc dot gnu.org 2012-12-04 
19:13:40 UTC ---

The bootstrap problem is fixed.



The issue of why the stage2 g++ driver sometimes pulls in the

shared libgcc with -static-libgcc belongs in another PR.


[Bug bootstrap/55571] [4.6/4.7/4.8 regression] PR48076 fix broke bootstrap on armv5tel-linux-gnueabi

2012-12-03 Thread ebotcazou at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55571



Eric Botcazou ebotcazou at gcc dot gnu.org changed:



   What|Removed |Added



 Status|UNCONFIRMED |NEW

   Last reconfirmed||2012-12-03

 CC||ebotcazou at gcc dot

   ||gnu.org

   Target Milestone|--- |4.6.4

Summary|[4.6.4 regression] PR48076  |[4.6/4.7/4.8 regression]

   |fix broke bootstrap on  |PR48076 fix broke bootstrap

   |armv5tel-linux-gnueabi  |on armv5tel-linux-gnueabi

 Ever Confirmed|0   |1

   Severity|normal  |critical



--- Comment #1 from Eric Botcazou ebotcazou at gcc dot gnu.org 2012-12-03 
09:23:04 UTC ---

You cannot link a simple program without -static-libgcc.


[Bug bootstrap/55571] [4.6/4.7/4.8 regression] PR48076 fix broke bootstrap on armv5tel-linux-gnueabi

2012-12-03 Thread rguenth at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55571



Richard Biener rguenth at gcc dot gnu.org changed:



   What|Removed |Added



   Priority|P3  |P1

  Known to work||4.6.3

  Known to fail||4.6.4


[Bug bootstrap/55571] [4.6/4.7/4.8 regression] PR48076 fix broke bootstrap on armv5tel-linux-gnueabi

2012-12-03 Thread jakub at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55571



Jakub Jelinek jakub at gcc dot gnu.org changed:



   What|Removed |Added



 CC||jakub at gcc dot gnu.org



--- Comment #2 from Jakub Jelinek jakub at gcc dot gnu.org 2012-12-03 
13:54:57 UTC ---

Perhaps just guard the PR48076 changes with

#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) \

  || defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)

and otherwise just use asm volatile ( : : : memory); barrier?

Or for those targets avoid the optimization:

#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) \

  || defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)

# define USE_ATOMICS

#endif



#ifdef USE_ATOMICS

  pointer offset = __atomic_load_n (obj-loc.offset, __ATOMIC_ACQUIRE);

#else

  pointer offset = 0;

#endif



  if (__builtin_expect (offset == 0, 0))

...

#ifdef USE_ATOMICS

  __atomic_store_n (obj-loc.offset, offset, __ATOMIC_RELEASE);

#else

  obj-loc.offset = offset;

#endif

Then for the targets without sync compare and swap it will always grab the lock

and do everything with the lock held.


[Bug bootstrap/55571] [4.6/4.7/4.8 regression] PR48076 fix broke bootstrap on armv5tel-linux-gnueabi

2012-12-03 Thread mikpe at it dot uu.se


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55571



--- Comment #3 from Mikael Pettersson mikpe at it dot uu.se 2012-12-03 
14:39:19 UTC ---

Eric has already upgraded this bug report to a 4.6/4.7/4.8 regression, but

I'd like to add that I now got a very similar error with 4.8-20121202:



/mnt/scratch/objdir48/./prev-gcc/xg++ -B/mnt/scratch/objdir48/./prev-gcc/

-B/mnt/scratch/install48/armv5tel-unknown-linux-gnueabi/bin/ -nostdinc++

-B/mnt/scratch/objdir48/prev-armv5tel-unknown-linux-gnueabi/libstdc++-v3/src/.libs

-B/mnt/scratch/objdir48/prev-armv5tel-unknown-linux-gnueabi/libstdc++-v3/libsupc++/.libs

-I/mnt/scratch/objdir48/prev-armv5tel-unknown-linux-gnueabi/libstdc++-v3/include/armv5tel-unknown-linux-gnueabi

-I/mnt/scratch/objdir48/prev-armv5tel-unknown-linux-gnueabi/libstdc++-v3/include

-I/mnt/scratch/gcc-4.8-20121202/libstdc++-v3/libsupc++

-L/mnt/scratch/objdir48/prev-armv5tel-unknown-linux-gnueabi/libstdc++-v3/src/.libs

-L/mnt/scratch/objdir48/prev-armv5tel-unknown-linux-gnueabi/libstdc++-v3/libsupc++/.libs

  -g -O2 -gtoggle -DIN_GCC   -fno-exceptions -fno-rtti

-fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings

-Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long

-Wno-variadic-macros -Wno-overlength-strings -Werror   -DHAVE_CONFIG_H

-static-libstdc++ -static-libgcc  -o cc1 c/c-lang.o c-family/stub-objc.o

attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o c/c-convert.o c/c-aux-info.o

c/c-objc-common.o c/c-parser.o c-family/c-common.o c-family/c-cppbuiltin.o

c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o

c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o

c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o

c-family/c-ada-spec.o tree-mudflap.o arm-c.o glibc-c.o \

  cc1-checksum.o libbackend.a main.o  libcommon-target.a libcommon.a

../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a

../libcpp/libcpp.a   ../libbacktrace/.libs/libbacktrace.a

../libiberty/libiberty.a ../libdecnumber/libdecnumber.a   -lmpc -lmpfr -lgmp  

-lz

/usr/bin/ld: cc1: hidden symbol `__sync_synchronize' in

/mnt/scratch/objdir48/./prev-gcc/libgcc.a(linux-atomic.o) is referenced by DSO

/usr/bin/ld: final link failed: Bad value

collect2: error: ld returned 1 exit status

make[3]: *** [cc1] Error 1

make[3]: Leaving directory `/mnt/scratch/objdir48/gcc'

make[2]: *** [all-stage2-gcc] Error 2

make[2]: Leaving directory `/mnt/scratch/objdir48'

make[1]: *** [stage2-bubble] Error 2

make[1]: Leaving directory `/mnt/scratch/objdir48'

make: *** [bootstrap] Error 2


[Bug bootstrap/55571] [4.6/4.7/4.8 regression] PR48076 fix broke bootstrap on armv5tel-linux-gnueabi

2012-12-03 Thread ebotcazou at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55571



Eric Botcazou ebotcazou at gcc dot gnu.org changed:



   What|Removed |Added



  Known to fail||4.7.3, 4.8.0



--- Comment #4 from Eric Botcazou ebotcazou at gcc dot gnu.org 2012-12-03 
14:43:13 UTC ---

 Eric has already upgraded this bug report to a 4.6/4.7/4.8 regression, but

 I'd like to add that I now got a very similar error with 4.8-20121202:



Sure, our 4.7.x arm-linux-gnueabi cross-compiler is also affected.


[Bug bootstrap/55571] [4.6/4.7/4.8 regression] PR48076 fix broke bootstrap on armv5tel-linux-gnueabi

2012-12-03 Thread rth at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55571



Richard Henderson rth at gcc dot gnu.org changed:



   What|Removed |Added



 AssignedTo|unassigned at gcc dot   |rth at gcc dot gnu.org

   |gnu.org |



--- Comment #5 from Richard Henderson rth at gcc dot gnu.org 2012-12-03 
15:34:18 UTC ---

I think Jakub's idea is a bit overkill.  We're just in need of a

barrier, and we ought to be able to get one.  Perhaps we should

be linking libgcc_s.so itself against the static libgcc?



Although I can't recall why we're placing the __sync functions

in the static library in the first place.  It's not like they're

required to be unique.  I guess I'll have to dig that out of the

mail archives...


[Bug bootstrap/55571] [4.6/4.7/4.8 regression] PR48076 fix broke bootstrap on armv5tel-linux-gnueabi

2012-12-03 Thread rth at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55571



--- Comment #6 from Richard Henderson rth at gcc dot gnu.org 2012-12-03 
16:48:59 UTC ---

Created attachment 28861

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=28861

proposed patch 4.6 only



IMO there are multiple problems being exposed here.  Some of them

probably require more build surgery than others.  In the case of

gcc 4.6 (and probably 4.7) I'd like to fix nothing other than the

minimal.



This patch links libgcc_s.so.1 with libgcc.a.  That brings in the

hidden __sync_synchronize symbol (as well as all of the others)

into the shared library so that it doesn't require external resolution.



I've only tested this via cross-compile so far, wherein I see what

I expected from the dynamic symbol table.


[Bug bootstrap/55571] [4.6/4.7/4.8 regression] PR48076 fix broke bootstrap on armv5tel-linux-gnueabi

2012-12-03 Thread rth at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55571



Richard Henderson rth at gcc dot gnu.org changed:



   What|Removed |Added



 Status|NEW |ASSIGNED


[Bug bootstrap/55571] [4.6/4.7/4.8 regression] PR48076 fix broke bootstrap on armv5tel-linux-gnueabi

2012-12-03 Thread rth at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55571



--- Comment #7 from Richard Henderson rth at gcc dot gnu.org 2012-12-03 
19:04:28 UTC ---

Created attachment 28863

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=28863

proposed patch for 4.7



Same as 4.6 modulo fuzz + conflicts.


[Bug bootstrap/55571] [4.6/4.7/4.8 regression] PR48076 fix broke bootstrap on armv5tel-linux-gnueabi

2012-12-03 Thread brobecker at gnat dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55571



--- Comment #8 from Joel Brobecker brobecker at gnat dot com 2012-12-04 
04:51:45 UTC ---

Created attachment 28869

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=28869

Small reproducer with arm-eabi



In case it's useful to anyone else, a small program that reproduces the

problem.



% arm-linux-gnueabi-gcc -o utils utils.c

[same problem with __sync_synchronize]