Subject: Re: Adding ELF64 support
To: David S. Miller <davem@caip.rutgers.edu>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: tech-kern
Date: 09/03/1996 02:14:53
David S. Miller <davem@caip.rutgers.edu> writes:


>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

I think we're all adults and can take ANSI/Reiserism token
concatenation as read...

GNU binutils has done this for aout since, well, since before there
was a binutils.  *BSD systems don't use Make directly, they use
config.  Modifying the suggested scheme to work with config is very
do-able.  I thought Matt was asking how to do something like this
whilst still emitting only one copy of the common functions?

There's also the issue of how, on a 64/32-bit machine, an exec package
should ascertain whether elf32 or elf64 is the best fit for a given
executable. (mips3 chips have, iirc, 64-bit mode, 32-bit mode, and
64-bit int/32-bit float.)

This is made somewhat hairier still by the NetBSD "machine
independent" exec-package code still assuming that ELF is used only
for running non-NetBSD binaries in emulation mode...