]> Pileus Git - ~andy/linux/blobdiff - include/asm-mips/elf.h
Merge ../linux-2.6 by hand
[~andy/linux] / include / asm-mips / elf.h
index bb031f3cd4db4cefb277b8547eb5678fdcaf23d6..7420f12742bb92c5d6d41068d8b2f1e8f772e51b 100644 (file)
@@ -2,6 +2,8 @@
  * 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.
+ *
+ * Much of this is taken from binutils and GNU libc ...
  */
 #ifndef _ASM_ELF_H
 #define _ASM_ELF_H
@@ -17,6 +19,8 @@
 #define EF_MIPS_ARCH_5         0x40000000      /* -mips5 code.  */
 #define EF_MIPS_ARCH_32                0x50000000      /* MIPS32 code.  */
 #define EF_MIPS_ARCH_64                0x60000000      /* MIPS64 code.  */
+#define EF_MIPS_ARCH_32R2      0x70000000      /* MIPS32 R2 code.  */
+#define EF_MIPS_ARCH_64R2      0x80000000      /* MIPS64 R2 code.  */
 
 /* The ABI of a file. */
 #define EF_MIPS_ABI_O32                0x00001000      /* O32 ABI.  */
 #define R_MIPS_LOVENDOR                100
 #define R_MIPS_HIVENDOR                127
 
-#define SHN_MIPS_ACCOMON       0xff00
+#define SHN_MIPS_ACCOMON       0xff00          /* Allocated common symbols */
+#define SHN_MIPS_TEXT          0xff01          /* Allocated test symbols.  */
+#define SHN_MIPS_DATA          0xff02          /* Allocated data symbols.  */
+#define SHN_MIPS_SCOMMON       0xff03          /* Small common symbols */
+#define SHN_MIPS_SUNDEFINED    0xff04          /* Small undefined symbols */
 
 #define SHT_MIPS_LIST          0x70000000
 #define SHT_MIPS_CONFLICT      0x70000002
@@ -193,33 +201,76 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
 
 #ifdef __KERNEL__
 
+struct mips_abi;
+
+extern struct mips_abi mips_abi;
+extern struct mips_abi mips_abi_32;
+extern struct mips_abi mips_abi_n32;
+
 #ifdef CONFIG_32BIT
 
-#define SET_PERSONALITY(ex, ibcs2)                     \
-do {                                                   \
-       if (ibcs2)                                      \
-               set_personality(PER_SVR4);              \
-       set_personality(PER_LINUX);                     \
+#define SET_PERSONALITY(ex, ibcs2)                                     \
+do {                                                                   \
+       if (ibcs2)                                                      \
+               set_personality(PER_SVR4);                              \
+       set_personality(PER_LINUX);                                     \
+                                                                       \
+       current->thread.abi = &mips_abi;                                \
 } while (0)
 
 #endif /* CONFIG_32BIT */
 
 #ifdef CONFIG_64BIT
 
-#define SET_PERSONALITY(ex, ibcs2)                             \
-do {   current->thread.mflags &= ~MF_ABI_MASK;                 \
-       if ((ex).e_ident[EI_CLASS] == ELFCLASS32) {             \
-               if ((((ex).e_flags & EF_MIPS_ABI2) != 0) &&     \
-                    ((ex).e_flags & EF_MIPS_ABI) == 0)         \
-                       current->thread.mflags |= MF_N32;       \
-               else                                            \
-                       current->thread.mflags |= MF_O32;       \
-       } else                                                  \
-               current->thread.mflags |= MF_N64;               \
-       if (ibcs2)                                              \
-               set_personality(PER_SVR4);                      \
-       else if (current->personality != PER_LINUX32)           \
-               set_personality(PER_LINUX);                     \
+#ifdef CONFIG_MIPS32_N32
+#define __SET_PERSONALITY32_N32()                                      \
+       do {                                                            \
+               current->thread.mflags |= MF_N32;                       \
+               current->thread.abi = &mips_abi_n32;                    \
+       } while (0)
+#else
+#define __SET_PERSONALITY32_N32()                                      \
+       do { } while (0)
+#endif
+
+#ifdef CONFIG_MIPS32_O32
+#define __SET_PERSONALITY32_O32()                                      \
+       do {                                                            \
+               current->thread.mflags |= MF_O32;                       \
+               current->thread.abi = &mips_abi_32;                     \
+       } while (0)
+#else
+#define __SET_PERSONALITY32_O32()                                      \
+       do { } while (0)
+#endif
+
+#ifdef CONFIG_MIPS32_COMPAT
+#define __SET_PERSONALITY32(ex)                                                \
+do {                                                                   \
+       if ((((ex).e_flags & EF_MIPS_ABI2) != 0) &&                     \
+            ((ex).e_flags & EF_MIPS_ABI) == 0)                         \
+               __SET_PERSONALITY32_N32();                              \
+       else                                                            \
+               __SET_PERSONALITY32_O32();                              \
+} while (0)
+#else
+#define __SET_PERSONALITY32(ex)        do { } while (0)
+#endif
+
+#define SET_PERSONALITY(ex, ibcs2)                                     \
+do {                                                                   \
+       current->thread.mflags &= ~MF_ABI_MASK;                         \
+       if ((ex).e_ident[EI_CLASS] == ELFCLASS32)                       \
+               __SET_PERSONALITY32(ex);                                \
+       else {                                                          \
+               current->thread.mflags |= MF_N64;                       \
+               current->thread.abi = &mips_abi;                        \
+       }                                                               \
+                                                                       \
+       if (ibcs2)                                                      \
+               set_personality(PER_SVR4);                              \
+       else if (current->personality != PER_LINUX32)                   \
+               set_personality(PER_LINUX);                             \
 } while (0)
 
 #endif /* CONFIG_64BIT */