Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 79852 - Internal compiler error while attempting to merge hardened gcc-3.4.3.20050110 (emit-rtl.c)
Summary: Internal compiler error while attempting to merge hardened gcc-3.4.3.20050110...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GCC Porting (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
: 62079 78544 80118 81579 82400 82875 84229 86570 87011 87012 87313 87314 88716 89031 89088 89576 94563 94818 95298 96873 97282 97312 97538 104457 106138 106182 115968 (view as bug list)
Depends on: 78666
Blocks:
  Show dependency tree
 
Reported: 2005-01-28 08:12 UTC by antiher0
Modified: 2006-03-29 23:19 UTC (History)
31 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Pre-processed output from ICE (cc5hGmZ1.out,133.11 KB, text/plain)
2005-01-28 08:13 UTC, antiher0
Details
preprocessed file for reproduction (ccHoKKIV.c,111.60 KB, text/plain)
2005-01-28 16:46 UTC, Keith Landry
Details
Fixes the STAGE1 default in the toolchain eclass (toolchain-eclass.patch,430 bytes, patch)
2005-08-29 08:47 UTC, Mike Auty (RETIRED)
Details | Diff
toolchain.eclass.patch (toolchain.eclass.patch,714 bytes, patch)
2005-09-21 02:41 UTC, Jeremy Huddleston (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description antiher0 2005-01-28 08:12:31 UTC
Upgrading from gcc-3.4.3-r1.  Worked fine on my non-hardened system.  On my hardened system, I get the same ICE every time, early in the build process.

Reproducible: Always
Steps to Reproduce:
1. # emerge -avu gcc

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild     U ] sys-devel/gcc-3.4.3.20050110 [3.4.3-r1] -bootstrap -boundschecking -build -debug +fortran -gcj +gtk +hardened (-ip28) (-multilib) -multislot (-n32) (-n64) -nls -nocxx -objc -static (-uclibc) 0 kB 

Total size of downloads: 0 kB

Do you want me to merge these packages? [Yes/No] y


Actual Results:  
gcc -c -DEFAULT_PIE_SSP    -O -DIN_GCC   -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long   
-DHAVE_CONFIG_H    -I. -I.
-I/var/tmp/portage/gcc-3.4.3.20050110/work/gcc-3.4.3/gcc
-I/var/tmp/portage/gcc-3.4.3.20050110/work/gcc-3.4.3/gcc/.
-I/var/tmp/portage/gcc-3.4.3.20050110/work/gcc-3.4.3/gcc/../include 
/var/tmp/portage/gcc-3.4.3.20050110/work/gcc-3.4.3/gcc/cppcharset.c -o cppcharset.o
gcc -c -DEFAULT_PIE_SSP    -O -DIN_GCC   -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long   
-DHAVE_CONFIG_H    -I. -I.
-I/var/tmp/portage/gcc-3.4.3.20050110/work/gcc-3.4.3/gcc
-I/var/tmp/portage/gcc-3.4.3.20050110/work/gcc-3.4.3/gcc/.
-I/var/tmp/portage/gcc-3.4.3.20050110/work/gcc-3.4.3/gcc/../include 
/var/tmp/portage/gcc-3.4.3.20050110/work/gcc-3.4.3/gcc/hashtable.c -o hashtable.o
/var/tmp/portage/gcc-3.4.3.20050110/work/gcc-3.4.3/gcc/hashtable.c: In function
`approx_sqrt':
/var/tmp/portage/gcc-3.4.3.20050110/work/gcc-3.4.3/gcc/hashtable.c:310: internal
compiler error: in try_split, at emit-rtl.c:3314
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugs.gentoo.org/> for instructions.
Preprocessed source stored into
/var/tmp/portage/gcc-3.4.3.20050110/temp/cc5hGmZ1.out file, please attach this
to your bugreport.
make[2]: *** [hashtable.o] Error 1
make[2]: Leaving directory `/var/tmp/portage/gcc-3.4.3.20050110/work/build/gcc'
make[1]: *** [stage1_build] Error 2
make[1]: Leaving directory `/var/tmp/portage/gcc-3.4.3.20050110/work/build/gcc'
make: *** [profiledbootstrap] Error 2

!!! ERROR: sys-devel/gcc-3.4.3.20050110 failed.
!!! Function gcc_do_make, Line 1074, Exitcode 2
!!! make failed with profiledbootstrap
!!! If you need support, post the topmost build error, NOT this status message.



Expected Results:  
Should have merged successfully.

Gentoo Base System version 1.6.8
Portage 2.0.51-r15 (default-linux/x86/2004.3, gcc-3.4.3,
glibc-2.3.4.20041102-r0, 2.6.10-gentoo-r6-1 i686)
=================================================================
System uname: 2.6.10-gentoo-r6-1 i686 AMD Athlon(tm) XP 2200+
Python:              dev-lang/python-2.3.4 [2.3.4 (#1, Aug  1 2004, 02:52:47)]
dev-lang/python:     2.3.4
sys-devel/autoconf:  2.59-r6, 2.13
sys-devel/automake:  1.8.5-r2, 1.5, 1.4_p6, 1.6.3, 1.7.9, 1.9.4
sys-devel/binutils:  2.15.92.0.2-r2
sys-devel/libtool:   1.5.10-r3
virtual/os-headers:  2.6.8.1-r2
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer -fstack-protector"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env
/usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config
/var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer -fstack-protector"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache collision-protect distlocks sandbox
sfperms userpriv usersandbox"
GENTOO_MIRRORS="http://mirror.datapipe.net/gentoo
http://gentoo.mirrors.pair.com/ http://open-systems.ufl.edu/mirrors/gentoo
http://gentoo.osuosl.org/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="x86 3dnow 3dnowex 3ds X X509 Xaw3d aac aalib aavm aim alsa apache2 arts
artworkextra audiofile avi bcmath berkdb bidi bitmap-fonts bmp bonobo bootsplash
bzip2 bzlib calendar canna cap caps cdb cddb cdparanoia cdr chroot cjk codecs
cpdflib crypt cscope ctype cups curl curlwrappers dba dbx devfs26 dga dio
divx4linux djbfft dv dvd dvdr dvdread edl encode erandom esd ethereal evo exif
f77 faac faad fam fbcon ffmpeg fftw flac flash flatfile font-server foomaticdb
fortran freetype freewnn fs ftp gd gdbm gif gimp gimpprint gmp gnome gphoto2 gpm
graphviz gstreamer gtk gtk2 gtkhtml hal hardened hardenedphp iconv icq
imagemagick imap imlib imlib2 immqt-bc innodb jabber java javascript jbig jce
jit joystick jpeg jpeg2k kde ladcca lcms ldap libcaca libg++ libgda libwww live
lzo lzw-tiff mad maildir mailwrapper matroska mcal memlimit mhash mikmod mime
mmap mmx mmx2 mng monkey mono motif mozilla moznoirc mozp3p mp3 mpeg mpeg4 mpi
mplayer msn mysql mysqli nas ncurses netcdf network nocardbus nocd nodrm nptl
nvidia oci8 odbc offensive oggvorbis openal opengl oscar oss pam pcap pcntl pcre
pda pdflib perl php physfs pic pie plotutils png pnp posix ppds prelude python
qt quicktime readline real recode rtc samba scanner sdl session sftplogging
shared sharedmem simplexml slang smartcard sndfile soap sockets socks5
spamassassin speex spell spl sqlite sse ssl svg sysvipc szip tcpd tga theora
tidy tiff tokenizer transcode truetype truetype-fonts type1-fonts unicode usb
uudeview vhosts videos vim-with-x wmf xine xml xml2 xmlrpc xmms xosd xprint
xscreensaver xsl xv xvid xvmc yahoo yv12 zlib"
Unset:  ASFLAGS, CBUILD, CTARGET, LDFLAGS
Comment 1 antiher0 2005-01-28 08:13:19 UTC
Created attachment 49745 [details]
Pre-processed output from ICE
Comment 2 Keith Landry 2005-01-28 09:16:54 UTC
Same issue here, this started after the update to gcc-3.4.3.20050110 and subsequent downgrade.

Now I cannot build perl, or gcc-3.4.3.20050110 again:

Looks like we are not the only ones:
http://forums.gentoo.org/viewtopic.php?p=2005342&highlight=trysplit#2005342

Also have same error if I switch from hardened to vanilla with gcc-config.

http://bugs.gentoo.org/show_bug.cgi?id=78666 is listed as fixed?

emerge info:

Portage 2.0.51-r15 (default-linux/x86/2004.3, gcc-3.4.3, glibc-2.3.4.20040808-r1, 2.6.10-gentoo-r5 i686)
=================================================================
System uname: 2.6.10-gentoo-r5 i686 Intel(R) Pentium(R) 4 CPU 2.40GHz
Gentoo Base System version 1.6.8
Python:              dev-lang/python-2.3.4 [2.3.4 (#1, Jan  4 2005, 09:02:37)]
distcc 2.16 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
dev-lang/python:     2.3.4
sys-devel/autoconf:  2.59-r6, 2.13
sys-devel/automake:  1.8.5-r2, 1.5, 1.4_p6, 1.6.3, 1.7.9, 1.9.4
sys-devel/binutils:  2.15.92.0.2-r1
sys-devel/libtool:   1.5.10-r4
virtual/os-headers:  2.6.8.1-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -march=pentium4 -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=pentium4 -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig buildpkg ccache distlocks sandbox sfperms"
GENTOO_MIRRORS="http://mirrors.tds.net/gentoo http://mirror.datapipe.net/gentoo ftp://mirrors.tds.net/gentoo http://gentoo.ccccom.com http://mirror.clarkson.edu/pub/distributions/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 X acl alsa apm arts artswrappersuid audiofile avi berkdb bitmap-fonts cdparanoia cdr crypt cups dhcp divx4linux doc dvd dvdr emacs encode f77 fam ffmpeg flac font-server foomatic foomaticdb fortran gdbm gif gpm hardened imlib ipv6 ithreads jack java jpeg junit kde kerberos ladccakde ladspa libg++ libwww mad matroska mikmod mmx motif mpeg mppe-mppc mysql ncurses network nls nptl oggvorbis opengl oss pam pdflib perl png python qt quicktime readline real rtc samba scanner sdl snmpsoftmmu spell sse sse2 ssl svg svga tcltk tcpd theora threads tiff transcode truetype truetype-fonts type1-fonts unicode usb videos wifi xine xinerama xml2 xmms xosd xprint xv xvid zlib"
Unset:  ASFLAGS, CBUILD, CTARGET, LDFLAGS
Comment 3 Keith Landry 2005-01-28 16:46:41 UTC
Created attachment 49781 [details]
preprocessed file for reproduction
Comment 4 Keith Landry 2005-01-28 16:53:05 UTC
The file in comment #3 is the preprocessed file created when it borks re-compiling gcc-3.4.3-r1. It borked with:

gcc -c -DEFAULT_PIE_SSP    -O -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long    -DHAVE_CONFIG_H    -I. -I. -I/var/tmp/portage/gcc-3.4.3-r1/work/gcc-3.4.3/gcc -I/var/tmp/portage/gcc-3.4.3-r1/work/gcc-3.4.3/gcc/. -I/var/tmp/portage/gcc-3.4.3-r1/work/gcc-3.4.3/gcc/../include  /var/tmp/portage/gcc-3.4.3-r1/work/gcc-3.4.3/gcc/hashtable.c -o hashtable.o
/var/tmp/portage/gcc-3.4.3-r1/work/gcc-3.4.3/gcc/hashtable.c: In function `approx_sqrt':
/var/tmp/portage/gcc-3.4.3-r1/work/gcc-3.4.3/gcc/hashtable.c:310: internal compiler error: in try_split, at emit-rtl.c:3314
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugs.gentoo.org/> for instructions.
Preprocessed source stored into /var/tmp/portage/gcc-3.4.3-r1/temp/ccHoKKIV.out file, please attach this to your bugreport.
make[2]: *** [hashtable.o] Error 1
make[2]: Leaving directory `/var/tmp/portage/gcc-3.4.3-r1/work/build/gcc'
make[1]: *** [stage1_build] Error 2
make[1]: Leaving directory `/var/tmp/portage/gcc-3.4.3-r1/work/build/gcc'
make: *** [profiledbootstrap] Error 2

I tried removing flags one at a time. It appears to be -O causing the problem. Setting optimization below -O2 causes the error :

straylight wirwzd # gcc -O  -c ccHoKKIV.c
/var/tmp/portage/gcc-3.4.3-r1/work/gcc-3.4.3/gcc/hashtable.c: In function `approx_sqrt':
/var/tmp/portage/gcc-3.4.3-r1/work/gcc-3.4.3/gcc/hashtable.c:310: internal compiler error: in try_split, at emit-rtl.c:3314
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugs.gentoo.org/> for instructions.
Preprocessed source stored into /tmp/ccmQXepE.out file, please attach this to your bugreport.
straylight wirwzd # gcc -O1  -c ccHoKKIV.c
/var/tmp/portage/gcc-3.4.3-r1/work/gcc-3.4.3/gcc/hashtable.c: In function `approx_sqrt':
/var/tmp/portage/gcc-3.4.3-r1/work/gcc-3.4.3/gcc/hashtable.c:310: internal compiler error: in try_split, at emit-rtl.c:3314
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugs.gentoo.org/> for instructions.
Preprocessed source stored into /tmp/ccpVpcNj.out file, please attach this to your bugreport.
straylight wirwzd # gcc -O2  -c ccHoKKIV.c
straylight wirwzd # gcc -O3  -c ccHoKKIV.c
straylight wirwzd #          
Comment 5 Keith Landry 2005-01-28 17:34:43 UTC
Tried removing optimizations added by -O2 one at a time.
Adding -funit-at-a-time allowed for sucessfull compiliation:

straylight wirwzd # sh -x test.sh
+ gcc -O -funit-at-a-time -c ./ccHoKKIV.c
Comment 6 Keith Landry 2005-01-29 00:52:28 UTC
OK to fix this I had to:

1) Switch to a vanilla profile with gcc-config. Otherwise I got:

/portage/gcc-3.4.3-r1/work/gcc-3.4.3/gcc/genmodes.c -o genmodes.o
cc1: stack smashing attack in function branch_prob()
xgcc: Internal error: Aborted (program cc1)

2) Re-emerge gcc-3.4.3-r1 using the vanilla profile with:

STAGE1_CFLAGS="-O -funit-at-a-time" emerge -av  =sys-devel/gcc-3.4.3-r1

3) I could then re-emerge gcc gcc-3.4.3-r1 with a hardened profile. I can also now compile perl et.al.

I can now also compile gcc-3.4.3.20050110 (I hit ^C before it installs for now as I need to sleep ;-)).

Does this help others?
Comment 7 Dave X 2005-01-29 11:53:50 UTC
The steps outlined in comment #6 From Keith Landry worked for me.
Comment 8 Igor Galchevsky 2005-01-30 03:22:16 UTC
I can't perform actions in <a href="http://bugs.gentoo.org/show_bug.cgi?id=79852#c6">Step #6</a> as I do not have vanilla profile.

tux spijon # gcc-config -l
[1] i686-pc-linux-gnu-3.4.3 *
[2] i686-pc-linux-gnu-3.4.3-hardened
[3] i686-pc-linux-gnu-3.4.3-hardenednopie
[4] i686-pc-linux-gnu-3.4.3-hardenednossp 
Comment 9 Keith Landry 2005-01-31 11:40:48 UTC
I worked with Igor on the forums. Worked for him too.
Comment 10 Kurt Marasco 2005-02-26 18:37:58 UTC
From comment #6,

"I can now also compile gcc-3.4.3.20050110 (I hit ^C before it installs for now as I need to sleep ;-))."

Everything works for me to this point as well, but if I recompile the toolchain (glibc binutils gcc) again after this point I get back to the same error on the gcc compile. I'm not so techy, but it seems that it is the building of glibc with the hardened gcc profile that borks the latter gcc compile. 

Anybody else have the error return after recompiling the tool chain?
Comment 11 Keith Landry 2005-02-28 03:21:57 UTC
I ended up doing the followng the following to upgrade and have no issues:

1) Switch to vanilla profile 
2) STAGE1_CFLAGS="-O -funit-at-a-time" emerge -av  =sys-devel/gcc-3.4.3-r1 
3) Switch to hardened profile 
4) emerge -av  =sys-devel/gcc-3.4.3-r1 
5) emerge -av  =sys-devel/gcc-3.4.3-r1 
6) emerge -av =sys-devel/gcc-3.4.3.20050110
7) emerge -e system
Comment 12 Jasper Thrussell 2005-03-21 06:10:25 UTC
I'm getting this exact same error when upgrading from gcc-3.4.3.20050110 to gcc-3.4.3.20050110-r1
Comment 13 Mark Loeser (RETIRED) gentoo-dev 2005-04-02 23:35:47 UTC
*** Bug 80118 has been marked as a duplicate of this bug. ***
Comment 14 Paper 2005-04-04 16:57:19 UTC
The solution pointed out in comment #11 doesn't work if gcj is in USE. Step 4 completes successfully, but step 5 terminate always here:

/home/data/portage/tmp/portage/gcc-3.4.3-r1/work/gcc-3.4.3/libjava/java/awt/geom/QuadCurve2D.java: In class `java.awt.geom.QuadCurve2D':
/home/data/portage/tmp/portage/gcc-3.4.3-r1/work/gcc-3.4.3/libjava/java/awt/geom/QuadCurve2D.java: In method `java.awt.geom.QuadCurve2D.solveQuadratic(double[],double[])':
/home/data/portage/tmp/portage/gcc-3.4.3-r1/work/gcc-3.4.3/libjava/java/awt/geom/QuadCurve2D.java:706: internal compiler error: in try_split, at emit-rtl.c:3314

Any idea?
Comment 15 Mark Loeser (RETIRED) gentoo-dev 2005-04-05 13:01:35 UTC
*** Bug 82875 has been marked as a duplicate of this bug. ***
Comment 16 SpanKY gentoo-dev 2005-04-15 15:59:04 UTC
*** Bug 89031 has been marked as a duplicate of this bug. ***
Comment 17 SpanKY gentoo-dev 2005-04-15 15:59:38 UTC
*** Bug 87313 has been marked as a duplicate of this bug. ***
Comment 18 SpanKY gentoo-dev 2005-04-15 15:59:41 UTC
*** Bug 87314 has been marked as a duplicate of this bug. ***
Comment 19 SpanKY gentoo-dev 2005-04-15 15:59:43 UTC
*** Bug 88716 has been marked as a duplicate of this bug. ***
Comment 20 SpanKY gentoo-dev 2005-04-15 16:00:15 UTC
*** Bug 86570 has been marked as a duplicate of this bug. ***
Comment 21 SpanKY gentoo-dev 2005-04-15 16:00:26 UTC
*** Bug 84229 has been marked as a duplicate of this bug. ***
Comment 22 SpanKY gentoo-dev 2005-04-15 16:00:34 UTC
*** Bug 87011 has been marked as a duplicate of this bug. ***
Comment 23 SpanKY gentoo-dev 2005-04-15 16:01:52 UTC
*** Bug 81579 has been marked as a duplicate of this bug. ***
Comment 24 SpanKY gentoo-dev 2005-04-15 16:02:01 UTC
*** Bug 82400 has been marked as a duplicate of this bug. ***
Comment 25 SpanKY gentoo-dev 2005-04-15 16:02:03 UTC
*** Bug 87012 has been marked as a duplicate of this bug. ***
Comment 26 Keith Landry 2005-04-15 16:40:14 UTC
To Paper from Comment 14:

Try omitting gjc unill you are on the new version of gcc then add it and rebuild then?
 
You may want to to quickpkg your current version first. 
Comment 27 Alexandre Rostovtsev (RETIRED) gentoo-dev 2005-04-15 16:51:10 UTC
My solution (see bug #89031) was to use an old gcc-3.3.5 package to recompile gcc-3.4.3-20050110. After some unfortunate experiences in the past, I've learned to always keep backups (using quickpkg) of toolchain binaries...

Perhaps the best way to fix this bug is for someone with bandwidth to host an i386 binary gcc-3.3.5 package.
Comment 28 Charles Pence 2005-04-18 12:19:45 UTC
To #27:  The trouble is, it's not just that you can't recompile the toolchain.  I mean, there's plenty of hosted binary toolchain packages that you can find in an emergency.  The problem is that even the newly recompiled GCC is still uncapable of compiling itself after N attempts, where N is somewhere between 1 and 3 depending on your hardware.

After you use 3.3.5 to recompile hardened 3.4.3, try recompiling hardened 3.4.3 with itself two or three times.  Then try compiling libperl.  At some point in that process, I'm guessing it will break.  See the experiences in #80118 for some examples.

There appears to be something _honestly_flawed_ with the hardened 3.4.3 right now, to the point that it just can't compile stuff.
Comment 29 Alexander Ivanchev 2005-04-18 12:27:50 UTC
#28, yes, you're right, and the bug is mighty interesting - hopefully someone's looking into it too :)
Comment 30 Adam Mondl (RETIRED) gentoo-dev 2005-04-21 18:47:21 UTC
*** Bug 89576 has been marked as a duplicate of this bug. ***
Comment 31 Poggi Jérôme 2005-04-26 02:12:18 UTC
*** Bug 89088 has been marked as a duplicate of this bug. ***
Comment 32 Myles Goodwin 2005-05-06 14:58:43 UTC
any news on the progress of this bug?
Comment 33 Mark Loeser (RETIRED) gentoo-dev 2005-05-29 19:19:09 UTC
*** Bug 62079 has been marked as a duplicate of this bug. ***
Comment 34 Christophe C 2005-05-31 16:47:52 UTC
*** Bug 94563 has been marked as a duplicate of this bug. ***
Comment 35 Christophe C 2005-05-31 16:49:02 UTC
(In reply to comment #34)
> *** Bug 94563 has been marked as a duplicate of this bug. ***

It's also there in gcc-3.4.4 hardened - I opened 94563 before seing this one.

Comment 36 Simon Strandman 2005-06-02 00:28:37 UTC
I had a gcc 3.4.3-r1 on my server that culdn't compile itself, any updates nor libstdc++. They all failed 
with this error.  But I changed toolchain.eclass to pass -O2 instead of -O to STAGE1_CFLAGS and that 
made gcc 3.4.4 compile. This is probably because -O2 includes -funit-at-a-time and -O doesn't.

This bug could probably be resolved by letting toolchain.eclass check if gcc 3.4 is used and then 
append -funit-at-a-time to the stage1 flags. Alternatively -O2 could be used instead of -O for stage1 
always.
Comment 37 SpanKY gentoo-dev 2005-06-02 08:52:14 UTC
*** Bug 94818 has been marked as a duplicate of this bug. ***
Comment 38 Mike Auty (RETIRED) gentoo-dev 2005-06-12 13:36:54 UTC
Changing the STAGE1_CFLAGS to include -O2 instead of just -O worked a treat.  I
had also been having troubles installing gcc-3.4.4 and other programs, but
gcc-3.4.4 just finished compiling fine now.
Comment 39 SpanKY gentoo-dev 2005-06-23 18:06:45 UTC
*** Bug 96873 has been marked as a duplicate of this bug. ***
Comment 40 Jakub Moc (RETIRED) gentoo-dev 2005-06-28 02:24:33 UTC
*** Bug 97282 has been marked as a duplicate of this bug. ***
Comment 41 Dirk Heinrichs 2005-06-28 04:53:48 UTC
Setting STAGE1_CFLAGS to -O2 fixed it for me, also. 
Comment 42 Armando Di Cianno (RETIRED) gentoo-dev 2005-06-28 13:49:22 UTC
*** Bug 97312 has been marked as a duplicate of this bug. ***
Comment 43 Armando Di Cianno (RETIRED) gentoo-dev 2005-06-28 14:43:50 UTC
fwiw, comment #11 did (quite throughly it does seems) fix the issues I was having.
Comment 44 Jakub Moc (RETIRED) gentoo-dev 2005-06-30 13:36:03 UTC
*** Bug 97538 has been marked as a duplicate of this bug. ***
Comment 45 Simon Strandman 2005-07-17 10:33:18 UTC
Do anyone care to fix this bug? It has been open for half a year now and the fix
is really easy! Just check comment #36.
Comment 46 SpanKY gentoo-dev 2005-07-17 22:44:45 UTC
can someone verify that using -funit-at-a-time actually fixes this ?  i'd prefer
to use that instead of -O2
Comment 47 Milan Holzäpfel 2005-07-18 06:08:37 UTC
emerge info from actual system:

Portage 2.0.51.19 (default-linux/amd64/2005.0, gcc-3.4.3, glibc-2.3.4.20041102-
r1, 2.6.11.12-grsec-20 x86_64)
=================================================================
System uname: 2.6.11.12-grsec-20 x86_64 AMD Athlon(tm) 64 Processor 3000+
[...]


emerge info from the chroot on that system where this error occurs:

Portage 2.0.51.22-r1 (uclibc/x86/hardened, gcc-3.4.4, uclibc-0.9.27-r0, 2.6.11.
12-grsec-20 i686)
=================================================================
System uname: 2.6.11.12-grsec-20 i686 AMD Athlon(tm) 64 Processor 3000+
Gentoo Base System version 1.6.12
dev-lang/python:     2.3.4-r1, 2.4.1-r1
sys-apps/sandbox:    1.2.10
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.5
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.18-r1
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-gentoo-linux-uclibc"
CFLAGS="-Os -march=athlon-xp -pipe -fomit-frame-pointer"
CHOST="i686-gentoo-linux-uclibc"
[...]


emerge gcc with STAGE1_CFLAGS="-O":

| gcc -c -DEFAULT_PIE_SSP -DEFAULT_RELRO -DEFAULT_BIND_NOW   -DUSE_UCLIBC -O -
DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -
pedantic -Wno-long-long    -DHAVE_CONFIG_H 
   -I. -I. -I/var/tmp/portage/gcc-3.4.4/work/gcc-3.4.4/gcc -I/var/tmp/portage/
gcc-3.4.4/work/gcc-3.4.4/gcc/. -I/var/tmp/portage/gcc-3.4.4/work/gcc-3.4.4/gcc/
../include  /var/tmp/portage/gcc-3.4.4/
work/gcc-3.4.4/gcc/hashtable.c -o hashtable.o
| /var/tmp/portage/gcc-3.4.4/work/gcc-3.4.4/gcc/hashtable.c: In function 
`approx_sqrt':
| /var/tmp/portage/gcc-3.4.4/work/gcc-3.4.4/gcc/hashtable.c:310: internal 
compiler error: in try_split, at emit-rtl.c:3343
| Please submit a full bug report,
| with preprocessed source if appropriate.
| See <URL:http://bugs.gentoo.org/> for instructions.
| Preprocessed source stored into /var/tmp/portage/gcc-3.4.4/temp/ccOZThMl.out 
file, please attach this to your bugreport.
| make[2]: *** [hashtable.o] Error 1
| make[2]: Leaving directory `/var/tmp/portage/gcc-3.4.4/work/build/gcc'


with STAGE1_CFLAGS="-O -funit-at-a-time":

| make[2]: Entering directory `/var/tmp/portage/gcc-3.4.4/work/build/gcc'
| stage1/xgcc -Bstage1/ -B/usr/i686-gentoo-linux-uclibc/bin/ -c -DEFAULT_PIE_SSP 
-DEFAULT_RELRO -DEFAULT_BIND_NOW   -DUSE_UCLIBC -march=athlon-xp -pipe -O2 -
fprofile-use -DIN_GCC   -W -Wall -Wwrite-
strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wold-
style-definition     -DHAVE_CONFIG_H -DGENERATOR_FILE    -I. -I. -I/var/tmp/
portage/gcc-3.4.4/work/gcc-3.4.4/gcc -I/
var/tmp/portage/gcc-3.4.4/work/gcc-3.4.4/gcc/. -I/var/tmp/portage/gcc-3.4.4/
work/gcc-3.4.4/gcc/../include  /var/tmp/portage/gcc-3.4.4/work/gcc-3.4.4/gcc/
genmodes.c -o genmodes.o
| stage1/cc1: stack smashing attack in function branch_prob()
| xgcc: Internal error: Killed (program cc1)
| Please submit a full bug report.
| See <URL:http://bugs.gentoo.org/> for instructions.
| make[2]: *** [genmodes.o] Error 1
| make[2]: Leaving directory `/var/tmp/portage/gcc-3.4.4/work/build/gcc'


with STAGE1_CFLAGS="-O2":

| stage1/xgcc -Bstage1/ -B/usr/i686-gentoo-linux-uclibc/bin/ -c -DEFAULT_PIE_SSP 
-DEFAULT_RELRO -DEFAULT_BIND_NOW   -DUSE_UCLIBC -march=athlon-xp -pipe -O2 -
fprofile-generate -DIN_GCC   -W -Wall -Ww
rite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -
Wold-style-definition     -DHAVE_CONFIG_H    -I. -I. -I/var/tmp/portage/gcc-3.4.
4/work/gcc-3.4.4/gcc -I/var/tmp/port
age/gcc-3.4.4/work/gcc-3.4.4/gcc/. -I/var/tmp/portage/gcc-3.4.4/work/gcc-3.4.4/
gcc/../include  /var/tmp/portage/gcc-3.4.4/work/gcc-3.4.4/gcc/mkdeps.c -o 
mkdeps.o
| xgcc: Internal error: Killed (program cc1)
| Please submit a full bug report.
| See <URL:http://bugs.gentoo.org/> for instructions.
| make[2]: *** [mkdeps.o] Error 1
| make[2]: Leaving directory `/var/tmp/portage/gcc-3.4.4/work/build/gcc'

+ this from dmesg:

| cc1[9902]: segfault at 0000000068736168 rip 0000000068736168 rsp 
00000000bfffbcfc error 14
| PAX: execution attempt in: <NULL>, 00000000-00000000 00000000
| PAX: terminating task: /var/tmp/portage/gcc-3.4.4/work/build/gcc/stage1/
cc1(cc1):9902, uid/euid: 250/250, PC: 0000000068736168, SP: 00000000bfffbcfc
| PAX: bytes at PC: <1>grsec: (g32:S:/mnt/g32/jn) denied resource overstep by 
requesting 1468833792 for RLIMIT_STACK against limit 2088960 for /mnt/g32/jn/
var/tmp/portage/gcc-3.4.4/work/build/gcc/stage1/cc1[cc1:9902] uid/euid:250/250 
gid/egid:250/250, parent /mnt/g32/jn/var/tmp/portage/gcc-3.4.4/work/build/gcc/
stage1/xgcc[xgcc:24227] uid/euid:250/250 gid/egid:250/250
| <invalid address>.
| grsec: (g32:S:/mnt/g32/jn) denied resource overstep by requesting 4096 for 
RLIMIT_CORE against limit 0 for /mnt/g32/jn/var/tmp/portage/gcc-3.4.4/work/
build/gcc/stage1/cc1[cc1:9902] uid/euid:250/250 gid/egid:250/250, parent /mnt/
g32/jn/var/tmp/portage/gcc-3.4.4/work/build/gcc/stage1/xgcc[xgcc:24227] uid/
euid:250/250 gid/egid:250/250

(Note that I am running an 64-Bit-Kernel with a 64-Bit-System on AMD64, all of 
the above (except for the dmesg) was from a 32-Bit-system on a chroot, for which 
the MPROTECT-feature is disabled using GRSecurity's ACL system. (otherwise I 
cannot run 32-Bit-executables, see also bug #93769 for this.)

That is, setting STAGE1_CFLAGS to -O2 or -O -funit-at-a-time doesn't fix 
anything here. (also passing -funit-at-a-time to emerge-perl-CFLAGS doesn't 
prevent the emit-rtl.c:3343-one from happening there.  This was submitted in bug 
#99247, which is a duplicate of bug #97538, which has in turn been marked as 
being a duplicate of this bug.) 

I will now try as suggested in comment #11.

Regards,
Milan
Comment 48 Armando Di Cianno (RETIRED) gentoo-dev 2005-07-18 13:27:26 UTC
The steps in comment #11 (basically rebuilding the entire toolchain from the
correctly built hardened gcc-3.4.4) worked for gcc.  It also worked when I went
back and tried to build links (where I first experienced this bug) in bug 97312.
 However, I experienced it in one/two more packages after this (sadly, I forget
which), and I gave up currently working with the hardened gcc.

I am fairly certain that I rebuilt the entire toolchain in the correct, repeated
order, but this is where the other errors I had may come from if they are more
"my fault" than gcc hardened's "fault".
Comment 49 Simon Strandman 2005-07-21 01:47:27 UTC
I could reproduce this error on my server. I had to recompile gcc twice before 
it would happend again.

Setting STAGE1_CFLAGS to -O -funit-at-a-time gets me past this error but then I 
get the same error as Milan instead:

make[2]: Entering directory `/var/tmp/portage/gcc-3.4.4/work/build/gcc'
stage1/xgcc -Bstage1/ -B/usr/i686-pc-linux-gnu/bin/ -c -DEFAULT_PIE_SSP -
DEFAULT_RELRO -DEFAULT_BIND_NOW    -O2 -march=pentium3 -pipe -fprofile-use
-DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -
pedantic -Wno-long-long -Wold-style-definition     -DHAVE_CONFIG_H
-DGENERATOR_FILE    -I. -I. -I/var/tmp/portage/gcc-3.4.4/work/gcc-3.4.4/gcc -I/
var/tmp/portage/gcc-3.4.4/work/gcc-3.4.4/gcc/.
-I/var/tmp/portage/gcc-3.4.4/work/gcc-3.4.4/gcc/../include  /var/tmp/portage/
gcc-3.4.4/work/gcc-3.4.4/gcc/genmodes.c -o genmodes.o
cc1: stack smashing attack in function branch_prob()
xgcc: Internal error: Aborted (program cc1)
Please submit a full bug report.
See <URL:http://bugs.gentoo.org/> for instructions.
make[2]: *** [genmodes.o] Error 1
make[2]: Leaving directory `/var/tmp/portage/gcc-3.4.4/work/build/gcc'
make[1]: *** [stagefeedback_build] Error 2
make[1]: Leaving directory `/var/tmp/portage/gcc-3.4.4/work/build/gcc'
make: *** [profiledbootstrap] Error 2

However setting STAGE1_CFLAGS to -O2 gets me past this error too and gcc 
installs successfully.
Comment 50 Andreas Turriff 2005-07-29 03:15:58 UTC
Out of curiosity, has anyone looked at Robert Connolly's work for the Hardened
Linux from Scratch project? While I'm not savvy enough myself to follow his
toolchain patches from one end to the other, they do seem to produce a working
toolchain capable of recompiling itself. Maybe one of the devs would be willing
to investigate what you folks and Hardened LFS are doing differently? The links are
http://lfs.osuosl.org/patches/downloads/gcc/
http://lfs.osuosl.org/patches/downloads/binutils/
http://lfs.osuosl.org/patches/downloads/glibc/
Comment 51 SpanKY gentoo-dev 2005-07-29 23:52:58 UTC
we know Robert Connolly (he goes by 'ashes' on irc), but i dont think we've
chatted about ssp much
Comment 52 Jakub Moc (RETIRED) gentoo-dev 2005-08-29 05:42:51 UTC
*** Bug 95298 has been marked as a duplicate of this bug. ***
Comment 53 Jakub Moc (RETIRED) gentoo-dev 2005-08-29 06:15:10 UTC
OK, gcc-3.4.4 was working for me. Today I upgraded to gcc-3.4.4-r1 and got this
error with lm_sensors.

The working one was emerged on:

$ genlop -s gcc

Sun Jul 10 20:08:45 2005 >>> sys-devel/gcc-3.4.4

Downgraded again from 3.4.4-r1 to 3.4.4 using the binary package and
lm_sensors-2.9.1-r1 compiles without a hitch.
Comment 54 Mike Auty (RETIRED) gentoo-dev 2005-08-29 08:47:46 UTC
Created attachment 67180 [details, diff]
Fixes the STAGE1 default in the toolchain eclass

Yep, I also found that recompiling gcc lost the previous temporary patch i'd
applied.  It seems as though the toolchain.eclass hasn't been fixed to apply
-O2 rather than just -O when build gcc.  The attached patch does this, but when
applied to the main portage tree it will get overwritten after the next sync. 
It would be best if this got fixed in the main tree...
Comment 55 SpanKY gentoo-dev 2005-09-01 06:18:00 UTC
*** Bug 104457 has been marked as a duplicate of this bug. ***
Comment 56 Bjarke Istrup Pedersen (RETIRED) gentoo-dev 2005-09-07 04:20:43 UTC
(In reply to comment #54)
> Created an attachment (id=67180) [edit]
> Fixes the STAGE1 default in the toolchain eclass
> Yep, I also found that recompiling gcc lost the previous temporary patch i'd
> applied.  It seems as though the toolchain.eclass hasn't been fixed to apply
> -O2 rather than just -O when build gcc.  The attached patch does this, but 
when
> applied to the main portage tree it will get overwritten after the next 
sync. 
> It would be best if this got fixed in the main tree...

This patch works fine for me, unless it breaks something else, I'd vote for 
this solution.

Comment 57 Sergey Dovnar 2005-09-16 02:12:33 UTC
*** Bug 106138 has been marked as a duplicate of this bug. ***
Comment 58 Jakub Moc (RETIRED) gentoo-dev 2005-09-16 02:58:30 UTC
Any reason why the patch from Comment #54 cannot be used? It works.
Comment 59 SpanKY gentoo-dev 2005-09-16 08:45:52 UTC
*** Bug 106182 has been marked as a duplicate of this bug. ***
Comment 60 Jeremy Huddleston (RETIRED) gentoo-dev 2005-09-20 21:05:22 UTC
I just hit this on a new system.  I'm verifying that adding -funit-at-a-time
corrects the problem here, and I'll use that if the compiler being used is 3.4
(since is works fine with 3.3, and 3.3 doesn't have -funit-at-a-time).  If that
doesn't work, I'll try -O2.
Comment 61 Jeremy Huddleston (RETIRED) gentoo-dev 2005-09-21 02:41:25 UTC
Created attachment 68918 [details, diff]
toolchain.eclass.patch

I added -funit-at-a-time to STAGE1_CFLAGS if we're building with gcc-3.4, then
I rebuild gcc-3.4.4-r1 using gcc-3.3.6.  I switched to 3.4.4-vanilla and
rebuilt gcc-3.4.4-r1 3 times successfully.  I then switched to 3.4.4 (hardened)
and it failed to build gcc.  I then changed the stage1_cflags to be -O2, and
it's built gcc once so far, and I'll leave it going overnight.	At the very
least this suggests that just adding -funit-at-a-time is not the solution.  I'm
curious what combination of flags in -O2 alleviates this bug, but I've got
better things to do with my time than dig further into that...

Attached is a patch which bumps to -O2 only if using a hardened 3.4 compiler to
build a 3.4 compiler because I don't like the idea of bumping to -O2 globally. 
 Please verify that this fixes the problem for you guys as well, and I'll
commit it.
Comment 62 Mark Loeser (RETIRED) gentoo-dev 2005-12-11 20:40:41 UTC
*** Bug 78544 has been marked as a duplicate of this bug. ***
Comment 63 Jakub Moc (RETIRED) gentoo-dev 2005-12-18 11:26:46 UTC
*** Bug 115968 has been marked as a duplicate of this bug. ***
Comment 64 Mark Loeser (RETIRED) gentoo-dev 2006-01-15 17:00:04 UTC
Have we fixed this?
Comment 65 Kevin F. Quinn (RETIRED) gentoo-dev 2006-03-29 23:19:47 UTC
(In reply to comment #64)
> Have we fixed this?

I reckon so, since we've had no dups for three months :)

Anyone still having the problem, yell.