patch-2.4.0-test4 linux/include/asm-mips/elf.h
Next file: linux/include/asm-mips/highmem.h
Previous file: linux/include/asm-mips/bootinfo.h
Back to the patch index
Back to the overall index
- Lines: 36
- Date:
Tue Jul 11 15:43:45 2000
- Orig file:
v2.4.0-test3/linux/include/asm-mips/elf.h
- Orig date:
Tue May 23 15:31:36 2000
diff -u --recursive --new-file v2.4.0-test3/linux/include/asm-mips/elf.h linux/include/asm-mips/elf.h
@@ -15,9 +15,33 @@
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.
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)