patch-2.4.19 linux-2.4.19/include/asm-mips/elf.h

Next file: linux-2.4.19/include/asm-mips/errno.h
Previous file: linux-2.4.19/include/asm-mips/ds1286.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.18/include/asm-mips/elf.h linux-2.4.19/include/asm-mips/elf.h
@@ -10,6 +10,17 @@
 #define ELF_NGREG	45
 #define ELF_NFPREG	33
 
+/* ELF header e_flags defines. MIPS architecture level. */
+#define EF_MIPS_ARCH_1      0x00000000  /* -mips1 code.  */
+#define EF_MIPS_ARCH_2      0x10000000  /* -mips2 code.  */
+#define EF_MIPS_ARCH_3      0x20000000  /* -mips3 code.  */
+#define EF_MIPS_ARCH_4      0x30000000  /* -mips4 code.  */
+#define EF_MIPS_ARCH_5      0x40000000  /* -mips5 code.  */
+#define EF_MIPS_ARCH_32     0x60000000  /* MIPS32 code.  */
+#define EF_MIPS_ARCH_64     0x70000000  /* MIPS64 code.  */
+#define EF_MIPS_ARCH_32R2   0x80000000  /* MIPS32 code.  */
+#define EF_MIPS_ARCH_64R2   0x90000000  /* MIPS64 code.  */
+
 typedef unsigned long elf_greg_t;
 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 
@@ -17,8 +28,7 @@
 typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
 
 /*
- * This is used to ensure we don't load something for the wrong architecture
- * and also rejects IRIX binaries.
+ * This is used to ensure we don't load something for the wrong architecture.
  */
 #define elf_check_arch(hdr)						\
 ({									\
@@ -27,7 +37,10 @@
 									\
 	if (__h->e_machine != EM_MIPS)					\
 		__res = 0;						\
-	if (__h->e_flags & EF_MIPS_ARCH)				\
+	if (((__h->e_flags & EF_MIPS_ARCH) != EF_MIPS_ARCH_1) &&       	\
+	    ((__h->e_flags & EF_MIPS_ARCH) != EF_MIPS_ARCH_2) &&       	\
+	    ((__h->e_flags & EF_MIPS_ARCH) != EF_MIPS_ARCH_32) &&      	\
+	    ((__h->e_flags & EF_MIPS_ARCH) != EF_MIPS_ARCH_32R2))      	\
 		__res = 0;						\
 									\
 	__res;								\

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