Bob Slawson <[EMAIL PROTECTED]> posted
[EMAIL PROTECTED], excerpted below, on  Thu, 31 Aug 2006
13:17:19 -0400:

> Dieter Ries wrote:
>> OK so there it is, gcc 4.1.1 is stable.
>>
>> i just emerged it and switched gcc-config to 4.1.1.
>> does it make sense to recompile gcc 4.1.1 with gcc 4.1.1?
>> (do you know what i mean?
>>   
> No.  As part of the gcc build process, the new gcc is used to compile 
> itself.  'Stage 1'
> uses an existing compiler to compile the new source to 'xgcc'.  Then in 
> 'stage 2',
> 'xgcc' compiles the new source to 'gcc', the compiler is compiling itself.

Actually, while you are correct about the gcc build process, the Gentoo
Linux gcc upgrade guide [1] DOES recommend rebuilding it, but as part of a
larger full system rebuild.

Quoting the gist of the general instructions:

Code Listing 2.1: Upgrading GCC
# emerge -uav gcc

(Please substitute "i686-pc-linux-gnu-4.1.1" with the GCC
version and CHOST settings you've upgraded to:)
# gcc-config i686-pc-linux-gnu-4.1.1
# source /etc/profile

If you upgraded from gcc 3 to 4 (e.g. from 3.4.6 to 4.1.1 in this
example) you will have to run fix_libtool_files.sh manually
# fix_libtool_files.sh 3.4.6

(Rebuilding libtool)
# emerge --oneshot -av libtool

   To be completely safe that your system is in a sane state, you must
   rebuild the toolchain and then world to make use of the new compiler.

Code Listing 2.2: Rebuilding system
# emerge -eav system
# emerge -eav world

   It is safe to remove the older GCC version at this time. If you feel the
   need, please issue the following command (as usual, substitute
   =sys-devel/gcc-3.4* with the version you want to uninstall):

Code Listing 2.3: Removing older GCC version
# emerge -aC =sys-devel/gcc-3.4*

End quote.

Thus, the new gcc will actually be compiled three times, first in the
initial upgrade, second as part of emerge --emptytree system (which builds
the rest of the toolchain using the new gcc and builds the new gcc using
itself), third as part of emerge --emptytree world, which rebuilds the
entire system (including gcc) using the now fully upgraded toolchain.

IOW, first time rebuilds gcc using the old version, second time rebuilds
it and the toolchain using new gcc but partly old toolchain, third time
rebuilds it (and everything else) with an entirely fresh toolchain.

Of course, that's going to take some major time...  probably 2-3 days of
constant compiling.  (I figure a day with my dual Opteron, with the
portage work dir in a tmpfs based ramdisk in main memory... since I have 8
gigs of ram I might as well use it.) 

OTOH, gcc 4.1.1 is a HUGE boost in performance for amd64, much more so
than for x86, as amd64 is still new enough for this to be the first version
to really have support for it fully integrated and optimized.  (gcc 3.x had
support, but it was bolted on, and optimizations weren't as good as they
could have been as a result.  gcc 4.0 had it integrated but as the first
release of the rewrite, was mainly focused on not making things worse. gcc
4.1 finally has integrated amd64 support AND is better than 3.x in
general. gcc 4.1.1 fixed a few minor remaining bugs from 4.1.0.)

[1] http://www.gentoo.org/doc/en/gcc-upgrading.xml

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman

-- 
gentoo-amd64@gentoo.org mailing list

Reply via email to