diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-07-12 00:45:49 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-07-12 00:45:49 +0000 |
commit | 66f20d0f9bd86dc11f3869d78f3c5749789323ee (patch) | |
tree | f6462cca735c009dc41d590bc0128102d7645006 /include/asm-mips64/elf.h | |
parent | 45c5d1ba96c0670768c065115604d52afa7882b0 (diff) |
ELF loader changes / cleanup as discussed on linux-kernel.
Diffstat (limited to 'include/asm-mips64/elf.h')
-rw-r--r-- | include/asm-mips64/elf.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/include/asm-mips64/elf.h b/include/asm-mips64/elf.h index 0c549baf0..429c80561 100644 --- a/include/asm-mips64/elf.h +++ b/include/asm-mips64/elf.h @@ -1,5 +1,4 @@ -/* $Id: elf.h,v 1.3 2000/01/17 23:32:47 ralf Exp $ - * +/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. @@ -22,9 +21,22 @@ typedef double elf_fpreg_t; typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; /* - * This is used to ensure we don't load something for the wrong architecture. + * This is used to ensure we don't load something for the wrong + * architecture or OS. */ -#define elf_check_arch(x) ((x) == EM_MIPS || (x) == EM_MIPS_RS4_BE) +#define elf_check_arch(hdr) \ +({ \ + int __res = 0; \ + struct elfhdr *__h = (hdr); \ + \ + if ((__h->e_machine != EM_MIPS) && (__h->e_machine != EM_MIPS)) \ + __res = -ENOEXEC; \ + if (sizeof(elf_caddr_t) == 8 && \ + __h->e_ident[EI_CLASS] == ELFCLASS32) \ + __res = -ENOEXEC; \ + \ + __res; \ +}) /* * These are used to set parameters in the core dumps. |