[Top] [All Lists]

Re: [patch] linux: RFC: elf_check_arch() rework

Subject: Re: [patch] linux: RFC: elf_check_arch() rework
From: Daniel Jacobowitz <>
Date: Wed, 24 Jul 2002 14:08:50 -0400
In-reply-to: <>
References: <>
User-agent: Mutt/1.5.1i
On Wed, Jul 24, 2002 at 07:05:36PM +0200, Maciej W. Rozycki wrote:
> Hello,
>  After noticing I cannot run a trivial ELF64 program because of the
> EF_MIPS_ARCH_3 flag (quite a reasonable setting for a 64-bit executable,
> isn't it?), I concluded a considerable rework of elf_check_arch() is
> needed as what we currently have is inadequate. 
>  Here is my proposal.  I think binfmt_elf.c for mips and binfmt_elf32.c
> for mips64 should accept all ELF32 binaries either with no ABI mark (as
> produced by most versions of binutils) or with a 32 (aka o32) ABI one and
> binfmt_elf.c for mips64 should accept all ELF32 binaries with an n32 ABI
> mark and all ELF64 ones (which essentially means the 64 aka n64 ABI). 
> Everything else (i.e. o64 and EABIs) is rejected.  The patch adds
> necessary ELF file header flag definitions and synchronizes a few wrong
> ones to the binutils' definitions as well. 
>  It removes the bogus check of architecture flags as they are really
> irrelevant -- the code is intended to handle executable formats and not
> execution of code.  If a user incorporates unsupported opcodes, he'll just
> get SIGILL at one moment.  We may actually check if an architecture is
> supported even no other Linux port seems to care, but then the comparison
> should be against mips_cpu.isa_level and not against hardcoded constants. 
>  Note, this is an RFC at this stage -- I haven't tested the code
> adequately for an immediate inclusion, even if it looks obvious.  There
> should be no problems with code made with old binutils as unset flags are
> treated as (o)32. 

Well, that sounds like the right approach to me.  It sounds like
there's some real progress on the 64-bit tools now...

Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

<Prev in Thread] Current Thread [Next in Thread>