patch-2.4.0-test4 linux/include/asm-mips64/elf.h

Next file: linux/include/asm-mips64/highmem.h
Previous file: linux/include/asm-mips64/dma.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test3/linux/include/asm-mips64/elf.h linux/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 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.

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)