Hi,

Recently I started messing around with GCC and attempted to build it many
times. I first had lots of trouble with the 4.5 snapshots, but have now
moved to 4.6 and all seems well. I put all the instructions in a single file
(not quite a script, but almost, if you're willing to call a file with
commands a script).

The goal is to build an optimized GCC for myself and perhaps later (when I'm
confident about the quality of it) I can upload it to Sourceforge.

The commands are loosely based on makebuildroot.sh from mingw-w64 svn. For
now no multilib, but I have enabled lto and whole-program optimization,
along with -mtune=core2 for all parts of the process.

I do have some specific questions though:
1. Is there still an installation and/or other issue with multilib and GCC
4.6 or is that all fixed now?
2. Would -fomit-frame-pointer help optimization?
3. Is it smart to enable 4.5's lto to a 4.6 source, or should I first get a
4.6 GCC built without it?

Thanks!

Ruben
#################
#Required tools:#
#################
# - GCC/mingw-w64 for host platform (lto requires 4.5.1+)
# - flex
# - bison
# - makeinfo

##########
#Sources:#
##########
#libiconv
#Binutils
#libelf
#gmp
#mpfr
#mpc
#GCC
#mingw-w64

###################
#Directory layout:#
###################
#<root>
#<root>/mingw64-old <-- binary toolchain used for compilation
#<root>/src
#<root>/src/libiconv
#<root>/src/binutils
#<root>/src/libelf
#<root>/src/gmp
#<root>/src/mpfr
#<root>/src/mpc
#<root>/src/gcc
#<root>/src/mingw-w64
#<root>/build
#<root>/build/binutils
#<root>/build/libelf
#<root>/build/gmp
#<root>/build/mpfr
#<root>/build/mpc
#<root>/build/gcc
#<root>/build/mingw-w64-crt
#<root>/build/mingw64 <-- this is where everything will be installed
#<root>/build/mingw64/bin <-- location of new compiler

##########################
#Build steps from <root>:#
##########################
#prepare
# allow eg iconv-0.dll to be found
export PATH=/mingw/x86_64-w64-mingw32/bin:$PATH
# allow new tools to be found
export PATH=/home/ruben/mingw64/build/mingw64/bin:$PATH

cd build

#libiconv
cd libiconv
../../src/libiconv/configure --prefix=/mingw/x86_64-w64-mingw32 
--host=x86_64-w64-mingw32 CFLAGS="-mtune=core2 -flto" LFLAGS="-flto -fwhopr=3"
make
make install
cd ..
# binutils
cd binutils
../../src/binutils/configure --prefix=/home/ruben/mingw64/build/mingw64 
--with-sysroot=/home/ruben/mingw64/build/mingw64 --target=x86_64-w64-mingw32 
--host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --enable-lib64 
--disable-lib32 CFLAGS="-mtune=core2 -flto" LFLAGS="-flto -fwhopr=3"
make
make install
cd ..
# libelf - no optimizations possible
cd libelf
../../src/libelf/configure --prefix==/mingw/x86_64-w64-mingw32 
--build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32
make
make install
cd ..
# gmp
cd gmp
../../src/gmp/configure --prefix=/mingw/x86_64-w64-mingw32 
--build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 CFLAGS="-mtune=core2 
-flto" LFLAGS="-flto -fwhopr=3"
make
make install
cd ..
# mpfr
cd mpfr
../../src/mpfr/configure --prefix=/mingw/x86_64-w64-mingw32 
--build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 CFLAGS="-mtune=core2 
-flto" LFLAGS="-flto -fwhopr=3"
make
make install
cd ..
# mpc
cd mpc
../../src/mpc/configure --prefix=/mingw/x86_64-w64-mingw32 
--build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 CFLAGS="-mtune=core2 
-flto" LFLAGS="-flto -fwhopr=3"
make
make install
cd ..
# mingw-w64
cd build/mingw-w64
../../src/mingw-w64/configure --prefix=/home/ruben/mingw64/build/mingw64 
--with-sysroot=/home/ruben/mingw64/build/mingw64 --target=x86_64-w64-mingw32 
--host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --disable-lib32 
--enable-lib64 CFLAGS="-mtune=core2 -flto" LFLAGS="-flto -fwhopr=3"
make
make install
cd ..
cp mingw64/x86_64-w64-mingw32/include mingw64/mingw/include
# gcc
cd gcc
../../src/gcc/configure --prefix=/home/ruben/mingw64/build/mingw64 
--with-sysroot=/home/ruben/mingw64/build/mingw64 --target=x86_64-w64-mingw32 
--host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 
--enable-languages=c,c++,lto --enable-stage1-languages=c,c++,lto 
--enable-fully-dynamic-string --disable-multilib  --enable-lib64 
--disable-lib32 --enable-lto --enable-libgomp CFLAGS="-mtune=core2 -flto" 
LFLAGS="-flto -fwhopr=3" BOOT_CFLAGS="-mtune=core2 -flto" BOOT_LFLAGS="-flto 
-fwhopr=3"
make #profiledbootstrap
make install
cd ..
#set up path
export PATH=/home/ruben/mingw64/build/mingw64/bin:$PATH

# full gcc
cd gcc
make
make install
cd ..
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to