PERFORCE change 104738 for review
Oleksandr Tymoshenko
gonzo at FreeBSD.org
Mon Aug 21 22:34:39 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=104738
Change 104738 by gonzo at gonzo_hideout on 2006/08/21 22:33:43
o Get rid of x86_64 bits.
o Fixed Elf32_Auxinfo struct: a_un should contain a_ptr
and a_fcn fields.
o Added MIPS-specific relocations from NetBSD tree.
o ELF_TARGET_DATA considers target endianess.
Affected files ...
.. //depot/projects/mips2/src/sys/mips/include/elf.h#3 edit
Differences ...
==== //depot/projects/mips2/src/sys/mips/include/elf.h#3 (text+ko) ====
@@ -1,3 +1,5 @@
+/* $NetBSD: elf_machdep.h,v 1.10 2005/12/11 12:18:09 christos Exp $ */
+
/*-
* Copyright (c) 1996-1997 John D. Polstra.
* All rights reserved.
@@ -40,9 +42,9 @@
#include <sys/elf64.h> /* Definitions common to all 64 bit architectures. */
#include <sys/elf_generic.h>
-#define ELF_ARCH EM_X86_64
+#define ELF_ARCH EM_MIPS
-#define ELF_MACHINE_OK(x) ((x) == EM_X86_64)
+#define ELF_MACHINE_OK(x) ((x) == EM_MIPS)
/*
* Auxiliary vector entries for passing information to the interpreter.
@@ -54,6 +56,8 @@
int a_type; /* Entry type. */
union {
int a_val; /* Integer value. */
+ void *a_ptr; /* Address. */
+ void (*a_fcn)(void); /* Function pointer (not used). */
} a_un;
} Elf32_Auxinfo;
@@ -103,36 +107,55 @@
#define AT_COUNT 15 /* Count of defined aux entry types. */
+/* mips relocs. */
+
+#define R_MIPS_NONE 0
+#define R_MIPS_16 1
+#define R_MIPS_32 2
+#define R_MIPS_REL32 3
+#define R_MIPS_REL R_MIPS_REL32
+#define R_MIPS_26 4
+#define R_MIPS_HI16 5 /* high 16 bits of symbol value */
+#define R_MIPS_LO16 6 /* low 16 bits of symbol value */
+#define R_MIPS_GPREL16 7 /* GP-relative reference */
+#define R_MIPS_LITERAL 8 /* Reference to literal section */
+#define R_MIPS_GOT16 9 /* Reference to global offset table */
+#define R_MIPS_GOT R_MIPS_GOT16
+#define R_MIPS_PC16 10 /* 16 bit PC relative reference */
+#define R_MIPS_CALL16 11 /* 16 bit call thru glbl offset tbl */
+#define R_MIPS_CALL R_MIPS_CALL16
+#define R_MIPS_GPREL32 12
+
+/* 13, 14, 15 are not defined at this point. */
+#define R_MIPS_UNUSED1 13
+#define R_MIPS_UNUSED2 14
+#define R_MIPS_UNUSED3 15
+
/*
- * Relocation types.
+ * The remaining relocs are apparently part of the 64-bit Irix ELF ABI.
*/
+#define R_MIPS_SHIFT5 16
+#define R_MIPS_SHIFT6 17
-#define R_X86_64_NONE 0 /* No relocation. */
-#define R_X86_64_64 1 /* Add 64 bit symbol value. */
-#define R_X86_64_PC32 2 /* PC-relative 32 bit signed sym value. */
-#define R_X86_64_GOT32 3 /* PC-relative 32 bit GOT offset. */
-#define R_X86_64_PLT32 4 /* PC-relative 32 bit PLT offset. */
-#define R_X86_64_COPY 5 /* Copy data from shared object. */
-#define R_X86_64_GLOB_DAT 6 /* Set GOT entry to data address. */
-#define R_X86_64_JMP_SLOT 7 /* Set GOT entry to code address. */
-#define R_X86_64_RELATIVE 8 /* Add load address of shared object. */
-#define R_X86_64_GOTPCREL 9 /* Add 32 bit signed pcrel offset to GOT. */
-#define R_X86_64_32 10 /* Add 32 bit zero extended symbol value */
-#define R_X86_64_32S 11 /* Add 32 bit sign extended symbol value */
-#define R_X86_64_16 12 /* Add 16 bit zero extended symbol value */
-#define R_X86_64_PC16 13 /* Add 16 bit signed extended pc relative symbol value */
-#define R_X86_64_8 14 /* Add 8 bit zero extended symbol value */
-#define R_X86_64_PC8 15 /* Add 8 bit signed extended pc relative symbol value */
-#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */
-#define R_X86_64_DTPOFF64 17 /* Offset in TLS block */
-#define R_X86_64_TPOFF64 18 /* Offset in static TLS block */
-#define R_X86_64_TLSGD 19 /* PC relative offset to GD GOT entry */
-#define R_X86_64_TLSLD 20 /* PC relative offset to LD GOT entry */
-#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */
-#define R_X86_64_GOTTPOFF 22 /* PC relative offset to IE GOT entry */
-#define R_X86_64_TPOFF32 23 /* Offset in static TLS block */
-
-#define R_X86_64_COUNT 24 /* Count of defined relocation types. */
+#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_CALL_HI16 30
+#define R_MIPS_CALL_LO16 31
+#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_RELGOT 36
/* Define "machine" characteristics */
#if __ELF_WORD_SIZE == 32
@@ -140,8 +163,14 @@
#else
#define ELF_TARG_CLASS ELFCLASS64
#endif
+
+#ifdef __MIPSEB__
+#define ELF_TARG_DATA ELFDATA2MSB
+#else
#define ELF_TARG_DATA ELFDATA2LSB
-#define ELF_TARG_MACH EM_X86_64
+#endif
+
+#define ELF_TARG_MACH EM_MIPS
#define ELF_TARG_VER 1
#endif /* !_MACHINE_ELF_H_ */
More information about the p4-projects
mailing list