summaryrefslogtreecommitdiffstats
path: root/include/asm-mips64/elf.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-07-12 00:45:49 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-07-12 00:45:49 +0000
commit66f20d0f9bd86dc11f3869d78f3c5749789323ee (patch)
treef6462cca735c009dc41d590bc0128102d7645006 /include/asm-mips64/elf.h
parent45c5d1ba96c0670768c065115604d52afa7882b0 (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.h20
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.