summaryrefslogtreecommitdiffstats
path: root/sys/mips
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2008-12-16 20:07:47 +0000
committerimp <imp@FreeBSD.org>2008-12-16 20:07:47 +0000
commita69ce4ce83e926af1a998bb93813a262c5edff91 (patch)
treef224624898d9085234448d2ba1871e55920f20c0 /sys/mips
parent961b89a6c204db633924480ac85804d4d94dcd76 (diff)
downloadFreeBSD-src-a69ce4ce83e926af1a998bb93813a262c5edff91.zip
FreeBSD-src-a69ce4ce83e926af1a998bb93813a262c5edff91.tar.gz
Start to clean up the MIPS elf machine dependent file.
o Add support for compiling elf64 for this file (the rest of the changes are coming later) o Fill in some misssing relocation types. We need to support these in elf_machdep.c's relocation routines eventually, but that's future work too.
Diffstat (limited to 'sys/mips')
-rw-r--r--sys/mips/include/elf.h64
1 files changed, 58 insertions, 6 deletions
diff --git a/sys/mips/include/elf.h b/sys/mips/include/elf.h
index fc1035e..dadda03 100644
--- a/sys/mips/include/elf.h
+++ b/sys/mips/include/elf.h
@@ -40,9 +40,11 @@
/* Information taken from MIPS ABI supplemental */
-#include <sys/elf32.h> /* Definitions common to all 32 bit architectures. */
-
+#ifndef __ELF_WORD_SIZE
#define __ELF_WORD_SIZE 32 /* Used by <sys/elf_generic.h> */
+#endif
+#include <sys/elf32.h> /* Definitions common to all 32 bit architectures. */
+#include <sys/elf64.h> /* Definitions common to all 64 bit architectures. */
#include <sys/elf_generic.h>
#define ELF_ARCH EM_MIPS
@@ -114,6 +116,16 @@ typedef union {
Elf32_Word gt_bytes; /* This many bytes would be used */
} gt_entry; /* Subsequent entries in section */
} Elf32_gptab;
+typedef union {
+ struct {
+ Elf64_Word gt_current_g_value; /* -G val used in compilation */
+ Elf64_Word gt_unused; /* Not used */
+ } gt_header; /* First entry in section */
+ struct {
+ Elf64_Word gt_g_value; /* If this val were used for -G */
+ Elf64_Word gt_bytes; /* This many bytes would be used */
+ } gt_entry; /* Subsequent entries in section */
+} Elf64_gptab;
/*
* Entry found in sections of type SHT_MIPS_REGINFO.
@@ -123,6 +135,11 @@ typedef struct {
Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */
Elf32_Sword ri_gp_value; /* $gp register value */
} Elf32_RegInfo;
+typedef struct {
+ Elf64_Word ri_gprmask; /* General registers used */
+ Elf64_Word ri_cprmask[4]; /* Coprocessor registers used */
+ Elf64_Sword ri_gp_value; /* $gp register value */
+} Elf64_RegInfo;
/*
@@ -147,10 +164,38 @@ typedef struct {
#define R_MIPS_CALLHI16 30 /* upper 16 bit GOT entry for function */
#define R_MIPS_CALLLO16 31 /* lower 16 bit GOT entry for function */
-#define R_TYPE(name) __CONCAT(R_MIPS_,name)
+/*
+ * These are from the 64-bit Irix ELF ABI
+ */
+#define R_MIPS_SHIFT5 16
+#define R_MIPS_SHIFT6 17
+#define R_MIPS_64 18
+#define R_MIPS_GOT_DISP 19
+#define R_MIPS_GOT_PAGE 20
+#define R_MIPS_GOT_OFST 21
+#define R_MIPS_GOT_HI16 22
+#define R_MIPS_GOT_LO16 23
+#define R_MIPS_SUB 24
+#define R_MIPS_INSERT_A 25
+#define R_MIPS_INSERT_B 26
+#define R_MIPS_DELETE 27
+#define R_MIPS_HIGHER 28
+#define R_MIPS_HIGHEST 29
+#define R_MIPS_SCN_DISP 32
+#define R_MIPS_REL16 33
+#define R_MIPS_ADD_IMMEDIATE 34
+#define R_MIPS_PJUMP 35
+#define R_MIPS_ERLGOT 36
+
+#define R_MIPS_max 37
+#define R_TYPE(name) __CONCAT(R_MIPS_,name)
/* Define "machine" characteristics */
+#if __ELF_WORD_SIZE == 32
#define ELF_TARG_CLASS ELFCLASS32
+#else
+#define ELF_TARG_CLASS ELFCLASS64
+#endif
#ifdef __MIPSEB__
#define ELF_TARG_DATA ELFDATA2MSB
#else
@@ -159,23 +204,30 @@ typedef struct {
#define ELF_TARG_MACH EM_MIPS
#define ELF_TARG_VER 1
-
/*
* Auxiliary vector entries for passing information to the interpreter.
*
* The i386 supplement to the SVR4 ABI specification names this "auxv_t",
* but POSIX lays claim to all symbols ending with "_t".
*/
-
typedef struct { /* Auxiliary vector entry on initial stack */
int a_type; /* Entry type. */
union {
- long a_val; /* Integer value. */
+ int a_val; /* Integer value. */
void *a_ptr; /* Address. */
void (*a_fcn)(void); /* Function pointer (not used). */
} a_un;
} Elf32_Auxinfo;
+typedef struct { /* Auxiliary vector entry on initial stack */
+ long a_type; /* Entry type. */
+ union {
+ long a_val; /* Integer value. */
+ void *a_ptr; /* Address. */
+ void (*a_fcn)(void); /* Function pointer (not used). */
+ } a_un;
+} Elf64_Auxinfo;
+
__ElfType(Auxinfo);
/* Values for a_type. */
OpenPOWER on IntegriCloud