4 Building binutils-2.5.2.6

Contents of this section

4.1 Choose an alternate directory tree Preparing binutils-2.5.2.6 for compilation

Unpacking the archive


cd /usr/src
tar xfvz binutils-2.5.2.tar.gz
cd binutils-2.5.2

Patching binutils-2.5.2 to binutils-2.5.2.6


patch -p0 < ELF-HOWTO

where ELF-HOWTO is this file. The patch, made by H.J. Lu, fixes some binutils-2.5.2 bugs and allow the support for ELF.

Search for rejected patches


find . -name *.rej -print

should find nothing

Search and erase the original files


find . -name *.orig -print -exec rm -f {} \;

Edit bfd/elf32-i386.c


vi bfd/elf32-i386.c

at line 194 you should find:

#define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1"

change it to:


#define ELF_DYNAMIC_INTERPRETER "/lib/elf/ld-linux.so.1"

The libc-4.6.27 will put the dynamic linker in /lib/elf and ld-linux.so.1 will be a symlink to the real linker -> /lib/elf/ld-linux.so.1.0.14 This is needed because the ELF executables will use this run-time linker to link the shared libraries.

Configure the binutils-2.5.2.6

If you have an i386:


./configure i386-linuxelf

for a 486:


./configure i486-linuxelf

have a little break during configuration, it may take few minutes.

Edit Makefile


vi Makefile

at line 36 you should find:


prefix = /usr/local

change it to:


prefix = /usr/i486-linuxelf

to reflect the installation directory tree we have chosen.

at line 82 you should find:


CFLAGS = -g

change it to:


CFLAGS = -O2 -m486 -fomit-frame-pointer

(use the -m486 only if you have an i486) for optimization.

Edit ld/Makefile to change the default emulation mode:


vi ld/Makefile

at line 189 you should find:


EMUL=i386linux
EMUL_EXTRA1=elf_i386

change it to:


EMUL_EXTRA1=i386linux
EMUL=elf_i386

to set the default emulation to elf_i386 (this will be the ELF linker, not the jump-table one).

4.2 Compiling binutils-2.5.2.6

do the


make

and have a long coffee break.

4.3 Installing binutils-2.5.2.6

do the


make install

and it is done.

Now if you are short of disk space you may want to


cd /usr/src
rm -rf binutils-2.5.2

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter