How to build GCC

Stock GCC ships with GNU Obj-C runtime. It doesn't fit our needs, so we'll be using patched GCC from Cocotron repository.

Tools required: subversion, gcc, make

Start with cloning the repository:

svn checkout http://cocotron-tools-gpl3.googlecode.com/svn/trunk/gcc cocotron-gcc

Now make a separate directory for building, configure and build gcc:

mkdir gcc-build
cd gcc-build
../cocotron-gcc/configure --prefix=/opt/objc --with-gnu-as --with-gnu-ld --without-newlib --disable-multilib \
    --disable-libssp --disable-nls --disable-libobjc --enable-libffi --enable-objc-gc \
    --enable-languages=c,objc,c++,obj-c++  --enable-checking=release
make -j2
sudo make install

Now you can use your new gcc by

export PATH="/opt/objc/bin:$PATH"

Be careful, as this switches your system gcc to the objc one for current session.

Setting up custom toolchain name

It is possible to have two gcc variants (system and objc one) to run side by side. That would require to build gcc with --host=i686-objc-linux-gnu so it would not collide with system's i686-pc-linux-gnu (or any other you have). This method requires building custom binutils, and I'm pretty lazy about testing it myself.