Bug 37739 - [4.4 Regression] bootstrap broken with core gcc > gcc-4.2.x
Summary: [4.4 Regression] bootstrap broken with core gcc > gcc-4.2.x
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.4.0
: P1 normal
Target Milestone: 4.4.2
Assignee: Not yet assigned to anyone
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: build
: 38155 39173 40806 44437 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-10-05 19:18 UTC by Andreas Tobler
Modified: 2012-01-28 04:54 UTC (History)
12 users (show)

See Also:
Host: powerpc-unknown-linux-gnu
Target: powerpc-unknown-linux-gnu
Build: powerpc-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2008-12-11 16:31:13


Attachments
workaround patch (299 bytes, text/x-patch)
2008-10-05 19:25 UTC, Andreas Tobler
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Tobler 2008-10-05 19:18:11 UTC
Since a longer time bootstrap is broken for powerpc-unknown-linux-gnu, 32-bit at least. The interesting condition is, it only fails when the bootstrapping compiler is > 4.2.x, iow. 4.3.x and 4.4.x (Well 4.4 I did not confirm myself)

The failure started with r132589, this commit itself does not contain a fault per se. It is just uncovering the issue.

The failure manifests itself as:
gcc  -g -fkeep-inline-functions -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition -Wc++-compat -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H  -o cc1-dummy c-lang.o stub-objc.o attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-opts.o c-format.o c-semantics.o c-ppoutput.o c-cppbuiltin.o c-objc-common.o c-dump.o c-pch.o c-parser.o rs6000-c.o c-gimplify.o tree-mudflap.o c-pretty-print.o c-omp.o dummy-checksum.o \
          main.o tree-browser.o libbackend.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcpp/libcpp.a   ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -lmpfr -lgmp   -lmpfr -lgmp
/usr/lib/gcc/ppc64-redhat-linux/4.3.0/../../../../lib/crt1.o: In function `_start':
(.text+0x20): relocation truncated to fit: R_PPC_REL24 against symbol `__libc_start_main@@GLIBC_2.0' defined in .glink section in /usr/lib/gcc/ppc64-redhat-linux/4.3.0/../../../../lib/crt1.o
/usr/lib/gcc/ppc64-redhat-linux/4.3.0/crtbegin.o:(.fini+0x0): relocation truncated to fit: R_PPC_REL24 against `.text'
/usr/lib/gcc/ppc64-redhat-linux/4.3.0/crtend.o:(.init+0x0): relocation truncated to fit: R_PPC_REL24 against `.text'
c-lang.o: In function `VEC_tree_base_quick_insert':
/home/andreast/devel/gcc/head-clean/gcc/gcc/tree.h:190: relocation truncated to fit: R_PPC_REL24 against symbol `memmove@@GLIBC_2.0' defined in .glink section in /usr/lib/gcc/ppc64-redhat-linux/4.3.0/../../../../lib/crt1.o
c-lang.o: In function `VEC_tree_base_ordered_remove':
/home/andreast/devel/gcc/head-clean/gcc/gcc/tree.h:190: relocation truncated to fit: R_PPC_REL24 against symbol `memmove@@GLIBC_2.0' defined in .glink section in /usr/lib/gcc/ppc64-redhat-linux/4.3.0/../../../../lib/crt1.o
c-lang.o: In function `VEC_tree_base_block_remove':
/home/andreast/devel/gcc/head-clean/gcc/gcc/tree.h:190: relocation truncated to fit: R_PPC_REL24 against symbol `memmove@@GLIBC_2.0' defined in .glink section in /usr/lib/gcc/ppc64-redhat-linux/4.3.0/../../../../lib/crt1.o
c-lang.o: In function `VEC_tree_gc_copy':
/home/andreast/devel/gcc/head-clean/gcc/gcc/tree.h:191: relocation truncated to fit: R_PPC_REL24 against symbol `memcpy@@GLIBC_2.0' defined in .glink section in /usr/lib/gcc/ppc64-redhat-linux/4.3.0/../../../../lib/crt1.o
c-lang.o: In function `VEC_tree_gc_safe_grow_cleared':
/home/andreast/devel/gcc/head-clean/gcc/gcc/tree.h:191: relocation truncated to fit: R_PPC_REL24 against symbol `memset@@GLIBC_2.0' defined in .glink section in /usr/lib/gcc/ppc64-redhat-linux/4.3.0/../../../../lib/crt1.o
c-lang.o: In function `VEC_tree_heap_free':
/home/andreast/devel/gcc/head-clean/gcc/gcc/tree.h:192: relocation truncated to fit: R_PPC_REL24 against symbol `free@@GLIBC_2.0' defined in .glink section in /usr/lib/gcc/ppc64-redhat-linux/4.3.0/../../../../lib/crt1.o
c-lang.o: In function `VEC_tree_heap_copy':
/home/andreast/devel/gcc/head-clean/gcc/gcc/tree.h:192: relocation truncated to fit: R_PPC_REL24 against symbol `memcpy@@GLIBC_2.0' defined in .glink section in /usr/lib/gcc/ppc64-redhat-linux/4.3.0/../../../../lib/crt1.o
c-lang.o: In function `VEC_tree_heap_safe_grow_cleared':
/home/andreast/devel/gcc/head-clean/gcc/gcc/tree.h:192: additional relocation overflows omitted from the output
collect2: ld returned 1 exit status
make[3]: *** [cc1-dummy] Error 1
make[3]: Leaving directory `/home/andreast/devel/gcc/head-clean/objdir/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/home/andreast/devel/gcc/head-clean/objdir'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/andreast/devel/gcc/head-clean/objdir'
make: *** [all] Error 2

The bootstrapping compiler has this version:

[andreast@mini objdir]$ gcc -v
Using built-in specs.
Target: ppc64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--enable-secureplt --with-long-double-128 --build=ppc64-redhat-linux
--target=ppc64-redhat-linux --with-cpu=default32
Thread model: posix
gcc version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC)


The configuration flags used:

/home/andreast/devel/gcc/head-clean/gcc/configure
--prefix=/home/andreas/devel/gcc/head-clean/testbin --disable-static
--enable-languages=c

With Janis and Peter B. we found a workaround to bootstrap again:

Basically we need a very recent binutils (I use (GNU Binutils) 2.19.50.20080922) and a tweak to link cc1: --relax.

I'll attach the workaround patch later.

Due to the fact that I do not know on how to go on I have to file this PR.
I'll add Janis and Peter to CC as they did a big contribution in analyzing this issue.
Comment 1 Andreas Tobler 2008-10-05 19:25:52 UTC
Created attachment 16463 [details]
workaround patch

Workaround patch to make bootstrap working again.
Comment 2 Andreas Schwab 2008-10-05 21:54:23 UTC
Another workaround is to build with optimisation.
Comment 3 Andrew Pinski 2008-10-06 21:53:27 UTC
>The failure started with r132589

Though it pushed the code limit up on the functions inside insn-automata.o.
I wonder if we could get a way to disable and enable some scheduling for the first stage where we only need a few of them.
Comment 4 Jakub Jelinek 2008-11-14 15:10:14 UTC
Given that .text (with --relax) is ATM 48MB on cc1-dummy (and f951) and 52.7MB on cc1plus-dummy (when using somewhat older 4.4 snapshot as bootstrap compiler), I'm afraid just conditionalizing something during first stage wouldn't help us much.  bl can jump just 32MB forward or backward.
I think --relax on ppc32 isn't that new, at least 5 years old, if not more.
Comment 5 Jakub Jelinek 2008-11-16 13:02:55 UTC
*** Bug 38155 has been marked as a duplicate of this bug. ***
Comment 6 Jakub Jelinek 2008-12-11 10:02:26 UTC
I think this should be P1.  While a workaround (such as STAGE1_CFLAGS="-g -O1")
exists, not being able to bootstrap on a primary platform is very severe.
Comment 7 Richard Biener 2008-12-11 11:28:38 UTC
I tried to reproduce this but ran into a different error on powerpc-linux:

/usr/src/packages/BUILD/gcc-4.4.0-20081204/obj-powerpc64-suse-linux/./gcc/xgcc -B/usr/src/packages/BUILD/gcc-4.4.0-20081204/obj-powerpc64-suse-linux/./gcc/ -B/usr/powerpc64-suse-linux/bin/ -B/usr/powerpc64-suse-linux/lib/ -isystem /usr/powerpc64-suse-linux/include -isystem /usr/powerpc64-suse-linux/sys-include -O2 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -funwind-tables -fasynchronous-unwind-tables -g -U_FORTIFY_SOURCE -O2 -O2 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -funwind-tables -fasynchronous-unwind-tables -g -U_FORTIFY_SOURCE -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition  -isystem ./include  -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/../include -I../../gcc/../libcpp/include  -I../../gcc/../libdecnumber -I../../gcc/../libdecnumber/dpd -I../libdecnumber  -DCLOOG_PPL_BACKEND   -g0 -finhibit-size-directive -fno-inline-functions -fno-exceptions -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize  -I. -I. -I../.././gcc -I../../../libgcc -I../../../libgcc/. -I../../../libgcc/../gcc -I../../../libgcc/../include -I../../../libgcc/../libdecnumber/dpd -I../../../libgcc/../libdecnumber -o crtbeginS.o -MT crtbeginS.o -MD -MP -MF crtbeginS.dep -fPIC -msdata=none \
          -c ../../../libgcc/../gcc/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O
# of the build tree, for now.
/tmp/ccbxqGQj.s: Assembler messages:
/tmp/ccbxqGQj.s:103: Error: CFI instruction used without previous .cfi_startproc
/tmp/ccbxqGQj.s:160: Error: CFI instruction used without previous .cfi_startproc
make install-leaf DESTDIR=../../.././gcc \
          slibdir= libsubdir= MULTIOSDIR=64
make[3]: *** [crtbegin.o] Error 1
make[3]: *** Waiting for unfinished jobs....
/tmp/ccL1bPVt.s: Assembler messages:
/tmp/ccL1bPVt.s:131: Error: CFI instruction used without previous .cfi_startproc
/tmp/ccL1bPVt.s:201: Error: CFI instruction used without previous .cfi_startproc
make[3]: *** [crtbeginS.o] Error 1
Comment 8 Jakub Jelinek 2008-12-11 16:31:13 UTC
Testing a patch...
Comment 9 Andreas Tobler 2008-12-15 19:35:21 UTC
Tested the patch on F10.
Results here:
http://gcc.gnu.org/ml/gcc-testresults/2008-12/msg01223.html

Thanks.
Comment 10 Jakub Jelinek 2008-12-19 14:57:06 UTC
Subject: Bug 37739

Author: jakub
Date: Fri Dec 19 14:55:42 2008
New Revision: 142833

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142833
Log:
	PR bootstrap/37739
	* config.host: For powerpc*-*-linux* host with 32-bit GCC,
	use rs6000/x-linux-relax snippet if ld is new enough,
	otherwise use rs6000/x-linux-O1.
	* config/rs6000/x-linux-relax: New file.
	* config/x-cflags-O1: New file.

Added:
    trunk/gcc/config/rs6000/x-linux-relax
    trunk/gcc/config/x-cflags-O1
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config.host

Comment 11 Jakub Jelinek 2008-12-19 14:59:24 UTC
Fixed.
Comment 12 lucier 2009-02-11 18:13:50 UTC
I just got the same error with

   140	12:54	../../gcc-4.3.3/configure --prefix=/pkgs/gcc-4.3.3 --enable-languages=c
   141	12:54	make -j 4 bootstrap > & build.log &

trying to build gcc-4.3.3 with

[lucier@descartes gcc-4.3.3]$ gcc -v
Using built-in specs.
Target: ppc64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --enable-secureplt --with-long-double-128 --build=ppc64-redhat-linux --target=ppc64-redhat-linux --with-cpu=default32
Thread model: posix
gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC) 

So, if it was fixed on mainline, it wasn't fixed on the branch.

Should I just reopen this against 4.3.3, or should I file a new bug report for 4.3.3 and refer back to this one.
Comment 13 Mikael Pettersson 2009-06-11 00:01:17 UTC
(In reply to comment #11)
> Fixed.

Not quite. I'm trying to build gcc-4.4-20090609 on powerpc64-unknown-linux-gnu, with binutils 2.17.50.0.6-6, configured with --enable-languages=c,ada --with-cpu=default32 --disable-shared, and the first attempt to link gnat1 fails with R_PPC_REL24 errors similar to those shown earlier in this PR entry.

A look in the build log shows that the host C compiler is invoked with -O1 while building the C parts of stage1, but the host gnat is invoked with no optimisation flags at all. It seems that the workaround to pass -O1 when --relax is missing isn't propagated into the Ada parts.

If I set CC='gcc -O2' during the initial configure step the build succeeds.


Comment 14 acrux 2009-06-14 09:27:41 UTC
(In reply to comment #11)
> Fixed.
> 

it seems unfixed. Unable to bootstrap gcc-4.4.0 from itself. Problems happens only on powerpc32. 

failure:
/home/varie/gcc/work/src/build/gcc/../../gcc-4.4.0/gcc/tree.h:192: relocation truncated to fit: R_PPC_REL24 against symbol `free@@GLIBC_2.0' defined in .plt section in /usr/lib/gcc/powerpc-unknown-linux-gnu/4.4.0/../../../crt1.o
c-lang.o: In function `VEC_tree_heap_copy':
/home/varie/gcc/work/src/build/gcc/../../gcc-4.4.0/gcc/tree.h:192: relocation truncated to fit: R_PPC_REL24 against symbol `memcpy@@GLIBC_2.0' defined in .plt section in /usr/lib/gcc/powerpc-unknown-linux-gnu/4.4.0/../../../crt1.o
c-lang.o: In function `VEC_tree_heap_safe_grow_cleared':
/home/varie/gcc/work/src/build/gcc/../../gcc-4.4.0/gcc/tree.h:192: relocation truncated to fit: R_PPC_REL24 against symbol `memset@@GLIBC_2.0' defined in .plt section in /usr/lib/gcc/powerpc-unknown-linux-gnu/4.4.0/../../../crt1.o
c-lang.o: In function `VEC_constructor_elt_base_quick_insert':
/home/varie/gcc/work/src/build/gcc/../../gcc-4.4.0/gcc/tree.h:1532: additional relocation overflows omitted from the output
collect2: ld returned 1 exit status
make[3]: *** [cc1-dummy] Error 1
make[3]: Leaving directory `/home/varie/gcc/work/src/build/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/home/varie/gcc/work/src/build'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/varie/gcc/work/src/build'
make: *** [all] Error 2

bootstrapping compiler:
bash-4.0# gcc -v
Using built-in specs.
Target: powerpc-unknown-linux-gnu
Configured with: ../gcc-4.4.0/configure --disable-multilib --prefix=/usr --libexecdir=/usr/lib --enable-languages=c,c++,objc --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-shared --disable-nls --with-x=no --enable-long-long --host=powerpc-unknown-linux-gnu --build=powerpc-unknown-linux-gnu --target=powerpc-unknown-linux-gnu
Thread model: posix
gcc version 4.4.0 (CRUX PPC) (GCC)

and binutils-2.19.1 and glibc-2.10.1
Comment 15 Jan Meier 2009-07-02 16:26:35 UTC
Same problem here on powerpc-32: 

powerpc-unknown-linux-gnu-gcc  -g -fkeep-inline-functions -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition -Wc++-compat -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H  -o cc1-dummy c-lang.o stub-objc.o attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-opts.o c-format.o c-semantics.o c-ppoutput.o c-cppbuiltin.o c-objc-common.o c-dump.o c-pch.o c-parser.o rs6000-c.o c-gimplify.o tree-mudflap.o c-pretty-print.o c-omp.o dummy-checksum.o \
          main.o tree-browser.o libbackend.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcpp/libcpp.a   ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a   -lmpfr -lgmp
/usr/lib/gcc/powerpc-unknown-linux-gnu/4.4.0/../../../crt1.o: In function `_start':
(.text+0x20): relocation truncated to fit: R_PPC_REL24 against symbol `__libc_start_main@@GLIBC_2.0' defined in .plt section in /usr/lib/gcc/powerpc-unknown-linux-gnu/4.4.0/../../../crt1.o
/usr/lib/gcc/powerpc-unknown-linux-gnu/4.4.0/../../../crti.o: In function `_init':
initfini.c:(.init+0x10): relocation truncated to fit: R_PPC_LOCAL24PC against symbol `_GLOBAL_OFFSET_TABLE_' defined in .got section in /usr/lib/gcc/powerpc-unknown-linux-gnu/4.4.0/../../..make[3]: Leaving directory `/var/tmp/paludis/build/sys-devel-gcc-4.4.0-r1/work/gcc_build/gcc'
make[2]: Leaving directory `/var/tmp/paludis/build/sys-devel-gcc-4.4.0-r1/work/gcc_build'
make[1]: Leaving directory `/var/tmp/paludis/build/sys-devel-gcc-4.4.0-r1/work/gcc_build'
/crt1.o+fffffffc
c-lang.o: In function `VEC_tree_base_quick_insert':
/var/tmp/paludis/build/sys-devel-gcc-4.4.0-r1/work/gcc-4.4.0/gcc/tree.h:190: relocation truncated to fit: R_PPC_REL24 against symbol `memmove@@GLIBC_2.0' defined in .plt section in /usr/lib/gcc/powerpc-unknown-linux-gnu/4.4.0/../../../crt1.o
c-lang.o: In function `VEC_tree_base_ordered_remove':
/var/tmp/paludis/build/sys-devel-gcc-4.4.0-r1/work/gcc-4.4.0/gcc/tree.h:190: relocation truncated to fit: R_PPC_REL24 against symbol `memmove@@GLIBC_2.0' defined in .plt section in /usr/lib/gcc/powerpc-unknown-linux-gnu/4.4.0/../../../crt1.o
c-lang.o: In function `VEC_tree_base_block_remove':
/var/tmp/paludis/build/sys-devel-gcc-4.4.0-r1/work/gcc-4.4.0/gcc/tree.h:190: relocation truncated to fit: R_PPC_REL24 against symbol `memmove@@GLIBC_2.0' defined in .plt section in /usr/lib/gcc/powerpc-unknown-linux-gnu/4.4.0/../../../crt1.o
c-lang.o: In function `VEC_tree_gc_copy':
/var/tmp/paludis/build/sys-devel-gcc-4.4.0-r1/work/gcc-4.4.0/gcc/tree.h:191: relocation truncated to fit: R_PPC_REL24 against symbol `memcpy@@GLIBC_2.0' defined in .plt section in /usr/lib/gcc/powerpc-unknown-linux-gnu/4.4.0/../../../crt1.o
c-lang.o: In function `VEC_tree_gc_safe_grow_cleared':
/var/tmp/paludis/build/sys-devel-gcc-4.4.0-r1/work/gcc-4.4.0/gcc/tree.h:191: relocation truncated to fit: R_PPC_REL24 against symbol `memset@@GLIBC_2.0' defined in .plt section in /usr/lib/gcc/powerpc-unknown-linux-gnu/4.4.0/../../../crt1.o
c-lang.o: In function `VEC_tree_heap_free':
/var/tmp/paludis/build/sys-devel-gcc-4.4.0-r1/work/gcc-4.4.0/gcc/tree.h:192: relocation truncated to fit: R_PPC_REL24 against symbol `free@@GLIBC_2.0' defined in .plt section in /usr/lib/gcc/powerpc-unknown-linux-gnu/4.4.0/../../../crt1.o
c-lang.o: In function `VEC_tree_heap_copy':
/var/tmp/paludis/build/sys-devel-gcc-4.4.0-r1/work/gcc-4.4.0/gcc/tree.h:192: relocation truncated to fit: R_PPC_REL24 against symbol `memcpy@@GLIBC_2.0' defined in .plt section in /usr/lib/gcc/powerpc-unknown-linux-gnu/4.4.0/../../../crt1.o
c-lang.o: In function `VEC_tree_heap_safe_grow_cleared':
/var/tmp/paludis/build/sys-devel-gcc-4.4.0-r1/work/gcc-4.4.0/gcc/tree.h:192: relocation truncated to fit: R_PPC_REL24 against symbol `memset@@GLIBC_2.0' defined in .plt section in /usr/lib/gcc/powerpc-unknown-linux-gnu/4.4.0/../../../crt1.o
c-lang.o: In function `VEC_constructor_elt_base_quick_insert':
/var/tmp/paludis/build/sys-devel-gcc-4.4.0-r1/work/gcc-4.4.0/gcc/tree.h:1532: additional relocation overflows omitted from the output
collect2: ld returned 1 exit status
make[3]: *** [cc1-dummy] Error 1
make[2]: *** [all-stage1-gcc] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [bootstrap] Error 2

gcc-4.4.0 
binutils-2.19.1
Comment 16 lucier 2009-07-02 16:35:47 UTC
OK, so we've had several reliable reports that this bug still exists, but I'm not high enough in the GCC bugzilla hierarchy to reopen this bug (I just tried),  perhaps Andreas or Jakub would like to do so.  (Jakub, I've added your e-mail as a CC to this bug, sorry if that isn't appropriate.
Comment 17 Peter Bergner 2009-07-02 16:48:45 UTC
Alan, do you have any ideas?
Comment 18 Alan Modra 2009-07-03 01:38:45 UTC
I wonder whether people reporting that this bug has not been fixed (at least for C/C++) realize that the fix needs to be in the sources you are building.  It's not a fix that affects the installed compiler.

I've resisted turning on relax by default in ld because it slows down link time due to adding another pass over the relocations in input files.  I probably should look at doing something clever in ld.  A neat trick would be to automatically turn on relax if executable sections have addresses that might result in reloc overflow.
Comment 19 Richard Biener 2009-07-19 17:04:33 UTC
*** Bug 40806 has been marked as a duplicate of this bug. ***
Comment 20 Richard Biener 2009-07-19 19:23:23 UTC
*** Bug 40806 has been marked as a duplicate of this bug. ***
Comment 21 Richard Biener 2009-07-19 19:24:41 UTC
Re-open on request.  A workaround exists, so certainly not P1.
Comment 22 giffordj 2009-07-22 17:21:10 UTC
Work around doesn't work.
Comment 23 Jakub Jelinek 2009-07-23 13:36:42 UTC
Can you please
grep xmake_file= gcc/Makefile
in the gcc build directory as well as write what
gcc -Wl,--version
prints?  Binutils 2.19 and later have the needed relax fixes I think, so rs6000/x-linux-relax should be used...
Comment 24 giffordj 2009-07-23 16:50:49 UTC
root:/var/build_system/work/gcc-build# grep xmake_file= gcc/Makefile
xmake_file= $(srcdir)/config/rs6000/x-rs6000 $(srcdir)/config/rs6000/x-linux-relax $(srcdir)/config/x-linux

root:/var/build_system$ gcc -Wl,--version
GNU ld (GNU Binutils for Cross-LFS - Retrieved on 20090707) 2.19.1
Copyright 2007 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

This binutils is standard 2.19.1 plus two patches.
The first patch is what's in the 2_19 cvs.
http://svn.cross-lfs.org/svn/repos/patches/binutils/binutils-2.19.1-branch_update-6.patch.
The second patch is updates (That I as a CLFS Developer) thought would fix the issue on PPC.
http://svn.cross-lfs.org/svn/repos/patches/binutils/binutils-2.19.1-fixes-1.patch
Comment 25 Jakub Jelinek 2009-07-23 16:56:02 UTC
Is -Wl,--relax passed to the compiler driver when linking the binary that fails to link then?  If yes, you are looking at a ld problem.
Comment 26 giffordj 2009-07-23 18:36:06 UTC
Looks like it's being used. Any ideas?

gcc -isystem /usr/include -m32   -g -fkeep-inline-functions -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition -Wc++-compat -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -DGENERATOR_FILE -Wl,-rpath-link,/lib -m32  -Wl,--relax -o build/genoutput \
gcc -isystem /usr/include -m32   -g -fkeep-inline-functions -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition -Wc++-compat -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -DGENERATOR_FILE -Wl,-rpath-link,/lib -m32  -Wl,--relax -o build/genpeep \
gcc -isystem /usr/include -m32   -g -fkeep-inline-functions -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition -Wc++-compat -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -DGENERATOR_FILE -Wl,-rpath-link,/lib -m32  -Wl,--relax -o build/genrecog \
gcc -isystem /usr/include -m32   -g -fkeep-inline-functions -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition -Wc++-compat -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -DGENERATOR_FILE -Wl,-rpath-link,/lib -m32  -Wl,--relax build/gcov-iov.o -o build/gcov-iov
Comment 27 Jakub Jelinek 2009-07-24 09:46:43 UTC
These are small helper programs.  The real question is if -Wl,--relax is used on the gcc line that actually fails with the linker errors.
Comment 28 giffordj 2009-07-24 13:12:30 UTC
Looks like it.

gcc -isystem /usr/include -m32   -g -fkeep-inline-functions -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition -Wc++-compat -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -Wl,-rpath-link,/lib -m32  -Wl,--relax -o cc1-dummy c-lang.o stub-objc.o attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-opts.o c-format.o c-semantics.o c-ppoutput.o c-cppbuiltin.o c-objc-common.o c-dump.o c-pch.o c-parser.o rs6000-c.o c-gimplify.o tree-mudflap.o c-pretty-print.o c-omp.o dummy-checksum.o \
          main.o tree-browser.o libbackend.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcpp/libcpp.a   ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -Lyes/lib -Lyes/lib -lmpfr -lgmp -ldl
libbackend.a(tree-ssa-ccp.o): In function `VEC_gimple_base_quick_insert':
/var/build_system/work/gcc-4.4.1/gcc/gimple.h:33: relocation truncated to fit: R_PPC_REL24 against symbol `memmove@@GLIBC_2.0' defined in .plt section in /usr/lib/crt1.o
libbackend.a(tree-ssa-ccp.o): In function `VEC_gimple_base_ordered_remove':
/var/build_system/work/gcc-4.4.1/gcc/gimple.h:33: relocation truncated to fit: R_PPC_REL24 against symbol `memmove@@GLIBC_2.0' defined in .plt section in /usr/lib/crt1.o
libbackend.a(tree-ssa-ccp.o): In function `VEC_gimple_base_block_remove':
/var/build_system/work/gcc-4.4.1/gcc/gimple.h:33: relocation truncated to fit: R_PPC_REL24 against symbol `memmove@@GLIBC_2.0' defined in .plt section in /usr/lib/crt1.o
libbackend.a(tree-ssa-ccp.o): In function `VEC_gimple_heap_free':
/var/build_system/work/gcc-4.4.1/gcc/gimple.h:34: relocation truncated to fit: R_PPC_REL24 against symbol `free@@GLIBC_2.0' defined in .plt section in /usr/lib/crt1.o
libbackend.a(tree-ssa-ccp.o): In function `VEC_gimple_heap_copy':
/var/build_system/work/gcc-4.4.1/gcc/gimple.h:34: relocation truncated to fit: R_PPC_REL24 against symbol `memcpy@@GLIBC_2.0' defined in .plt section in /usr/lib/crt1.o
libbackend.a(tree-ssa-ccp.o): In function `VEC_gimple_heap_safe_grow_cleared':
/var/build_system/work/gcc-4.4.1/gcc/gimple.h:34: relocation truncated to fit: R_PPC_REL24 against symbol `memset@@GLIBC_2.0' defined in .plt section in /usr/lib/crt1.o
libbackend.a(tree-ssa-ccp.o): In function `VEC_gimple_gc_copy':
/var/build_system/work/gcc-4.4.1/gcc/gimple.h:35: relocation truncated to fit: R_PPC_REL24 against symbol `memcpy@@GLIBC_2.0' defined in .plt section in /usr/lib/crt1.o
libbackend.a(tree-ssa-ccp.o): In function `VEC_gimple_gc_safe_grow_cleared':
/var/build_system/work/gcc-4.4.1/gcc/gimple.h:35: relocation truncated to fit: R_PPC_REL24 against symbol `memset@@GLIBC_2.0' defined in .plt section in /usr/lib/crt1.o
libbackend.a(tree-ssa-ccp.o): In function `VEC_gimple_seq_base_quick_insert':
/var/build_system/work/gcc-4.4.1/gcc/gimple.h:37: relocation truncated to fit: R_PPC_REL24 against symbol `memmove@@GLIBC_2.0' defined in .plt section in /usr/lib/crt1.o
libbackend.a(tree-ssa-ccp.o): In function `VEC_gimple_seq_base_ordered_remove':
/var/build_system/work/gcc-4.4.1/gcc/gimple.h:37: relocation truncated to fit: R_PPC_REL24 against symbol `memmove@@GLIBC_2.0' defined in .plt section in /usr/lib/crt1.o
libbackend.a(tree-ssa-ccp.o): In function `VEC_gimple_seq_base_block_remove':
/var/build_system/work/gcc-4.4.1/gcc/gimple.h:37: additional relocation overflows omitted from the output
collect2: ld returned 1 exit status
make[3]: *** [cc1-dummy] Error 1
make[3]: Leaving directory `/var/build_system/work/gcc-build/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/var/build_system/work/gcc-build'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/var/build_system/work/gcc-build'

Comment 29 giffordj 2009-07-26 20:28:22 UTC
STAGE1_CFLAGS="-g -O2" is a workaround, -O1 gave failure later in the build. -O2 built GCC all the way through, with only one unexpected testsuite failure.
Comment 30 giffordj 2009-08-06 17:32:41 UTC
http://sourceware.org/bugzilla/show_bug.cgi?id=10474 is the bug I opened on Binutils.
Comment 31 giffordj 2009-08-11 15:09:49 UTC
http://sourceware.org/ml/binutils/2009-08/msg00163.html appears to have fixed this issue. See http://sourceware.org/bugzilla/show_bug.cgi?id=10474 for details.

Comment 32 Mark Mitchell 2009-08-31 21:48:34 UTC
Can anyone confirm that this is fixed?
Comment 33 Alan Modra 2009-09-30 02:29:29 UTC
To save people looking through the binutils bug report, here's the bug analysis:

"You are using the old-style plt and got rather than the new secure plt (forced by old startup files even if all the other code is capable of using the new secure plt).  The old-style plt is a bss section, located towards the end of the image.  Calls branch into the plt, then bounce from there to their final destination.  At the time code is relaxed some data sections, located between .text and .plt, have not yet been sized.  In particular, .eh_frame_hdr is still zero size.  When this section is properly sized, some of the branches will no longer reach.

This is a horrible bug.  To fix it I'll need to change quite a lot of code in the linker, for all elf targets."

So to avoid the bug you'll need a new linker (binutils 2.20 has the fix) or not use old libraries and startup files lacking -msecure-plt support.
Comment 34 Jakub Jelinek 2009-10-07 13:35:10 UTC
Linker bug, so closing.  Workaround also exists, use a non-buggy linker, or use non-obsolete crt files.
Comment 35 Andreas Tobler 2009-10-07 19:54:49 UTC
Seems like powerpc-*-freebsd* is now also affected.
I have the -O1 patch in testing.
The newer binutils option is a nop since FreeBSD (has to) stay(s) on binutils 2.15.
Comment 36 Alan Modra 2009-10-07 22:35:01 UTC
Andreas, there is no way this bug can be fixed 100% in gcc, except perhaps if you are willing to compile -static.  Source and/or compiler fixes only work to the extent that they limit code+data size to less than 33M.  If you go over that size, and are using the old-style bss plt with .eh_frame data, then you start playing russian roulette.
Comment 37 Andreas Tobler 2009-10-08 05:10:07 UTC
Subject: Bug 37739

Author: andreast
Date: Thu Oct  8 05:09:54 2009
New Revision: 152550

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152550
Log:
2009-10-08  Andreas Tobler  <a.tobler@schweiz.org>

	PR bootstrap/37739
	* config.host: Use config/x-cflags-O1 for powerpc FreeBSD.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config.host

Comment 38 Richard Biener 2010-06-07 08:39:21 UTC
*** Bug 44437 has been marked as a duplicate of this bug. ***
Comment 39 Andrew Pinski 2012-01-28 04:54:28 UTC
*** Bug 39173 has been marked as a duplicate of this bug. ***