summaryrefslogtreecommitdiffstats
path: root/include/asm-mips
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-mips
parent45c5d1ba96c0670768c065115604d52afa7882b0 (diff)
ELF loader changes / cleanup as discussed on linux-kernel.
Diffstat (limited to 'include/asm-mips')
-rw-r--r--include/asm-mips/elf.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h
index 31f455d9d..732ea22ea 100644
--- a/include/asm-mips/elf.h
+++ b/include/asm-mips/elf.h
@@ -15,9 +15,33 @@ 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
+ * and also rejects IRIX binaries.
*/
-#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 (__h->e_flags & EF_MIPS_ARCH) \
+ __res = -ENOEXEC; \
+ \
+ __res; \
+})
+
+/* This one accepts IRIX binaries. */
+#define irix_elf_check_arch(hdr) \
+({ \
+ int __res = 0; \
+ struct elfhdr *__h = (hdr); \
+ \
+ if ((__h->e_machine != EM_MIPS) && (__h->e_machine != EM_MIPS)) \
+ __res = -ENOEXEC; \
+ \
+ __res; \
+})
/*
* These are used to set parameters in the core dumps.