The question is relatively straight forward: how can I build a GCC of the 4.x series (along with binutils and friends) that targets a 2.4 ABI on the same architecture as the host for the compiler?
The host system would be x86 or x86_64 and the only requirement is that the built ELF files run on an old kernel as long as the ABI matches. (Kernel sources/headers exist)
A compatible libc would be required as well in order to link it in. However, I can dynamically link against it as well, since I know the (g)libc version.
Any pointers would be much appreciated. I'm somewhat familiar with crosstool-ng, but that doesn't even seem to support 2.4 kernels anymore (for obvious reasons).
gcc performs the compilation step to build a program, and then it calls other programs to assemble the program and to link the program's component parts into an executable program that you can run.
So, build is the machine you're building on (no change there), host is the machine you're building for (the target libraries are built for the target, so host is the target you specified), and target doesn't apply (because you're not building a compiler, you're building libraries).
Probably the easiest way is to setup a modern tool chain on an old OS.
RHEL 2.1 or 3 might be best, as they were supported until recently.
Compiling gcc 4 may be tricky since you'll need maths libraries as well. You may have to do a multi-stage approach.
EDIT:
For compiling newer gcc:
Something like this:
cd ~/software
tar xjf $DOWNLOAD/gcc/gcc-core-${GCCVER}.tar.bz2 || failure "unpack gcc failed"
tar xjf $DOWNLOAD/gcc/gcc-g++-${GCCVER}.tar.bz2 || failure "unpack g++ failed"
cd gcc-${GCCVER}
tar xjf $DOWNLOAD/gmp-5.0.2.tar.bz2 || failure "unpack gmp failed"
#tar xjf $DOWNLOAD/gmp-4.3.2.tar.bz2 || failure "unpack gmp failed"
ln -s gmp-* gmp
tar xjf $DOWNLOAD/mpfr-2.4.2.tar.bz2 || failure "unpack mpfr failed"
#tar xjf $DOWNLOAD/mpfr-2.4.2.tar.bz2 || failure "unpack mpfr failed"
ln -s mpfr-* mpfr
tar xzf $DOWNLOAD/mpc-0.9.tar.gz || failure "unpack mpc failed"
ln -s mpc-* mpc
cd ..
mkdir gcc-build
cd gcc-build
../gcc-${GCCVER}/configure --prefix=/opt/tools || failure "configure failed"
make || failure "make failed"
make install || failure "install failed"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With