Subject: Re: Adding ELF64 support
To: None <matt@lkg.dec.com>
From: David S. Miller <davem@caip.rutgers.edu>
List: tech-kern
Date: 09/03/1996 03:07:36
   Date: Mon, 02 Sep 1996 18:29:26 +0000
   From: Matt Thomas <matt@lkg.dec.com>

   In doing so, I cloned exec_elf.c and made a exec_elf64.c.  However
   I'm not really happy with this approach.  

One method I have seen to deal with this is to have only one
exec_elf.c file.  But you change a few things, and compile it twice.

For every Elf32_XXX you have in the sources, change it to:

ElfW(XXX)

Then, at the top you do the following:

#ifdef ELF_64BIT
#define ElfW(x) Elf32_x
#else
#define ElfW(x) Elf64_x
#endif

(you get the idea)  For arch's which want both 32 bit and 64 bit elf
support, you make the rule for building the exec_elf.c into an object
file handle this by running it once to create exec_elf32.o with normal
$(CC) arguments, then once again to create exec_elf64.o but this time
passing -DELF_64BIT to $(CC).  Then teach the final link makefile rule
to look for these two objects instead of plain exec_elf.o when linking
the kernel.

Later,
David S. Miller
davem@caip.rutgers.edu