Now you MUST go on recompiling the Whole Thing to be sure everything is okay. The recompilation is not only the way to have ELF binaries, it is a way to test the reliability of the binaries we have just compiled. Think of this as the Stage 2 (a la gcc Stage 2). I do not think a Stage 3 will be useful, but if you like you can do the Stage 3 too :) (e.g. Stage 3 compiled files should be the same as Stage 2, given the same compilation flags.)
You have to repeat the steps 4.* 5.* 6.*, with one small difference: in the Stage 2 you will use the gcc-elf!
Follow section pbin
Now you must change the gcc with gcc-elf in Makefile
vi Makefile
at line 72 you should find:
CC = cc
change it to:
CC = gcc-elf
Now follow the 4.2 and 4.3
You are done with binutils-2.5.2.6
Follow section pgcc for configuration.
Now compile the compiler stage1, do:
make LANGUAGES=c CC=gcc-elf CFLAGS="-O2 -m486 -fomit-frame-pointer -N"
Be warned: all things related to enquire.c and float.h are still valid!! We now have the ELF C lib but enquire will compile and link the right way only if we copy the installed gcc-elf specs file in gcc source directory (xgcc must know where to find crt and libc), so you have to wait until the gcc compilation is finished, then you will cp the correct specs:
cp /usr/i486-linuxelf/lib/gcc-lib/i486-linux/2.6.2/specs .
then remove enquire (an invalid file):
rm ./enquire
then re-compile with the same command line as the first compilation, and it will finish the compilation: do the above for all compilation stages, after every build.
Now make stage2 and stage3 of the compiler to build g++ and obj-c.
Here are the commands:
*** First compilation (stage1) ***
ln -s /usr/i486-linuxelf/bin/as .
ln -s /usr/i486-linuxelf/bin/ld .
make LANGUAGES=c CC=gcc-elf CFLAGS="-O2 -m486 -fomit-frame-pointer -N"
cp /usr/i486-linuxelf/lib/gcc-lib/i486-linux/2.6.2/specs .
rm ./enquire
make LANGUAGES=c CC=gcc-elf CFLAGS="-O2 -m486 -fomit-frame-pointer -N"
*** Second compilation (stage2) ***
make stage1
ln -s /usr/i486-linuxelf/bin/as stage1/as
ln -s /usr/i486-linuxelf/bin/ld stage1/ld
make LANGUAGES=c CC="stage1/xgcc -Bstage1/" CFLAGS="-O2 -m486 -fomit-frame-pointer -N"
cp /usr/i486-linuxelf/lib/gcc-lib/i486-linux/2.6.2/specs .
rm ./enquire
make LANGUAGES=c CC="stage1/xgcc -Bstage1/" CFLAGS="-O2 -m486 -fomit-frame-pointer -N"
*** Third compilation (stage3) ***
make stage2
ln -s /usr/i486-linuxelf/bin/as stage2/as
ln -s /usr/i486-linuxelf/bin/ld stage2/ld
make CC="stage2/xgcc -Bstage2/" CFLAGS="-O2 -m486 -fomit-frame-pointer -N"
cp /usr/i486-linuxelf/lib/gcc-lib/i486-linux/2.6.2/specs .
rm ./enquire
make CC="stage2/xgcc -Bstage2/" CFLAGS="-O2 -m486 -fomit-frame-pointer -N"
Now compare the objects of stage2 and stage3: they MUST be equal!!!!
for file in *.o
do
echo $file
cmp $file stage2/$file
done
Now for installation do
make install
Make sure /usr/i486-linuxelf/lib/gcc-lib/i486-linux/2.6.2/specs is correct.
Follow sections plib , clib and ilib .
Next Chapter, Previous Chapter
Table of contents of this chapter, General table of contents
Top of the document, Beginning of this Chapter