The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/mips/include/elf.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $OpenBSD: elf_abi.h,v 1.1 1998/01/28 11:14:41 pefo Exp $ */
    2 
    3 /*-
    4  * Copyright (c) 1996 Per Fogelstrom
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  * 1. Redistributions of source code must retain the above copyright
   10  *    notice, this list of conditions and the following disclaimer.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  * 3. All advertising materials mentioning features or use of this software
   15  *    must display the following acknowledgement:
   16  *      This product includes software developed under OpenBSD by
   17  *      Per Fogelstrom.
   18  * 4. The name of the author may not be used to endorse or promote products
   19  *    derived from this software without specific prior written permission.
   20  *
   21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
   22  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   23  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
   25  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   31  * SUCH DAMAGE.
   32  *
   33  *      JNPR: elf.h,v 1.4 2006/12/02 09:53:40 katta
   34  * $FreeBSD: releng/9.0/sys/mips/include/elf.h 217097 2011-01-07 14:22:34Z kib $
   35  *
   36  */
   37 
   38 #ifndef _MACHINE_ELF_H_
   39 #define _MACHINE_ELF_H_
   40 
   41 /* Information taken from MIPS ABI supplemental */
   42 
   43 #ifndef __ELF_WORD_SIZE
   44 #if defined(__mips_n64)
   45 #define __ELF_WORD_SIZE 64      /* Used by <sys/elf_generic.h> */
   46 #else
   47 #define __ELF_WORD_SIZE 32      /* Used by <sys/elf_generic.h> */
   48 #endif
   49 #endif
   50 #include <sys/elf32.h>  /* Definitions common to all 32 bit architectures. */
   51 #include <sys/elf64.h>  /* Definitions common to all 64 bit architectures. */
   52 #include <sys/elf_generic.h>
   53 
   54 #define ELF_ARCH        EM_MIPS
   55 #define ELF_MACHINE_OK(x) ((x) == EM_MIPS || (x) == EM_MIPS_RS4_BE)
   56 
   57 /* Architecture dependent Segment types - p_type */
   58 #define PT_MIPS_REGINFO         0x70000000 /* Register usage information */
   59 
   60 /* Architecture dependent d_tag field for Elf32_Dyn.  */
   61 #define DT_MIPS_RLD_VERSION     0x70000001 /* Runtime Linker Interface ID */
   62 #define DT_MIPS_TIME_STAMP      0x70000002 /* Timestamp */
   63 #define DT_MIPS_ICHECKSUM       0x70000003 /* Cksum of ext str and com sizes */
   64 #define DT_MIPS_IVERSION        0x70000004 /* Version string (string tbl index) */
   65 #define DT_MIPS_FLAGS           0x70000005 /* Flags */
   66 #define DT_MIPS_BASE_ADDRESS    0x70000006 /* Segment base address */
   67 #define DT_MIPS_CONFLICT        0x70000008 /* Adr of .conflict section */
   68 #define DT_MIPS_LIBLIST         0x70000009 /* Address of .liblist section */
   69 #define DT_MIPS_LOCAL_GOTNO     0x7000000a /* Number of local .GOT entries */
   70 #define DT_MIPS_CONFLICTNO      0x7000000b /* Number of .conflict entries */
   71 #define DT_MIPS_LIBLISTNO       0x70000010 /* Number of .liblist entries */
   72 #define DT_MIPS_SYMTABNO        0x70000011 /* Number of .dynsym entries */
   73 #define DT_MIPS_UNREFEXTNO      0x70000012 /* First external DYNSYM */
   74 #define DT_MIPS_GOTSYM          0x70000013 /* First GOT entry in .dynsym */
   75 #define DT_MIPS_HIPAGENO        0x70000014 /* Number of GOT page table entries */
   76 #define DT_MIPS_RLD_MAP         0x70000016 /* Address of debug map pointer */
   77 
   78 #define DT_PROCNUM (DT_MIPS_RLD_MAP - DT_LOPROC + 1)
   79 
   80 /*
   81  * Legal values for e_flags field of Elf32_Ehdr.
   82  */
   83 #define EF_MIPS_NOREORDER       1               /* .noreorder was used */
   84 #define EF_MIPS_PIC             2               /* Contains PIC code */
   85 #define EF_MIPS_CPIC            4               /* Uses PIC calling sequence */
   86 #define EF_MIPS_ARCH            0xf0000000      /* MIPS architecture level */
   87 
   88 /*
   89  * Mips special sections.
   90  */
   91 #define SHN_MIPS_ACOMMON        0xff00          /* Allocated common symbols */
   92 #define SHN_MIPS_SCOMMON        0xff03          /* Small common symbols */
   93 #define SHN_MIPS_SUNDEFINED     0xff04          /* Small undefined symbols */
   94 
   95 /*
   96  * Legal values for sh_type field of Elf32_Shdr.
   97  */
   98 #define SHT_MIPS_LIBLIST        0x70000000 /* Shared objects used in link */
   99 #define SHT_MIPS_CONFLICT       0x70000002 /* Conflicting symbols */
  100 #define SHT_MIPS_GPTAB          0x70000003 /* Global data area sizes */
  101 #define SHT_MIPS_UCODE          0x70000004 /* Reserved for SGI/MIPS compilers */
  102 #define SHT_MIPS_DEBUG          0x70000005 /* MIPS ECOFF debugging information */
  103 #define SHT_MIPS_REGINFO        0x70000006 /* Register usage information */
  104 
  105 /*
  106  * Legal values for sh_flags field of Elf32_Shdr.
  107  */
  108 #define SHF_MIPS_GPREL          0x10000000 /* Must be part of global data area */
  109 
  110 /*
  111  * Entries found in sections of type SHT_MIPS_GPTAB.
  112  */
  113 typedef union {
  114         struct {
  115                 Elf32_Word gt_current_g_value;  /* -G val used in compilation */
  116                 Elf32_Word gt_unused;   /* Not used */
  117         } gt_header;                    /* First entry in section */
  118         struct {
  119                 Elf32_Word gt_g_value;  /* If this val were used for -G */
  120                 Elf32_Word gt_bytes;    /* This many bytes would be used */
  121         } gt_entry;                     /* Subsequent entries in section */
  122 } Elf32_gptab;
  123 typedef union {
  124         struct {
  125                 Elf64_Word gt_current_g_value;  /* -G val used in compilation */
  126                 Elf64_Word gt_unused;   /* Not used */
  127         } gt_header;                    /* First entry in section */
  128         struct {
  129                 Elf64_Word gt_g_value;  /* If this val were used for -G */
  130                 Elf64_Word gt_bytes;    /* This many bytes would be used */
  131         } gt_entry;                     /* Subsequent entries in section */
  132 } Elf64_gptab;
  133 
  134 /*
  135  * Entry found in sections of type SHT_MIPS_REGINFO.
  136  */
  137 typedef struct {
  138         Elf32_Word      ri_gprmask;     /* General registers used */
  139         Elf32_Word      ri_cprmask[4];  /* Coprocessor registers used */
  140         Elf32_Sword     ri_gp_value;    /* $gp register value */
  141 } Elf32_RegInfo;
  142 typedef struct {
  143         Elf64_Word      ri_gprmask;     /* General registers used */
  144         Elf64_Word      ri_cprmask[4];  /* Coprocessor registers used */
  145         Elf64_Sword     ri_gp_value;    /* $gp register value */
  146 } Elf64_RegInfo;
  147 
  148 
  149 /*
  150  * Mips relocations.
  151  */
  152 
  153 #define R_MIPS_NONE     0       /* No reloc */
  154 #define R_MIPS_16       1       /* Direct 16 bit */
  155 #define R_MIPS_32       2       /* Direct 32 bit */
  156 #define R_MIPS_REL32    3       /* PC relative 32 bit */
  157 #define R_MIPS_26       4       /* Direct 26 bit shifted */
  158 #define R_MIPS_HI16     5       /* High 16 bit */
  159 #define R_MIPS_LO16     6       /* Low 16 bit */
  160 #define R_MIPS_GPREL16  7       /* GP relative 16 bit */
  161 #define R_MIPS_LITERAL  8       /* 16 bit literal entry */
  162 #define R_MIPS_GOT16    9       /* 16 bit GOT entry */
  163 #define R_MIPS_PC16     10      /* PC relative 16 bit */
  164 #define R_MIPS_CALL16   11      /* 16 bit GOT entry for function */
  165 #define R_MIPS_GPREL32  12      /* GP relative 32 bit */
  166 #define R_MIPS_GOTHI16  21      /* GOT HI 16 bit */
  167 #define R_MIPS_GOTLO16  22      /* GOT LO 16 bit */
  168 #define R_MIPS_CALLHI16 30      /* upper 16 bit GOT entry for function */
  169 #define R_MIPS_CALLLO16 31      /* lower 16 bit GOT entry for function */
  170 
  171 /*
  172  * These are from the 64-bit Irix ELF ABI
  173  */
  174 #define R_MIPS_SHIFT5   16
  175 #define R_MIPS_SHIFT6   17
  176 #define R_MIPS_64       18
  177 #define R_MIPS_GOT_DISP 19
  178 #define R_MIPS_GOT_PAGE 20
  179 #define R_MIPS_GOT_OFST 21
  180 #define R_MIPS_GOT_HI16 22
  181 #define R_MIPS_GOT_LO16 23
  182 #define R_MIPS_SUB      24
  183 #define R_MIPS_INSERT_A 25
  184 #define R_MIPS_INSERT_B 26
  185 #define R_MIPS_DELETE   27
  186 #define R_MIPS_HIGHER   28
  187 #define R_MIPS_HIGHEST  29
  188 #define R_MIPS_SCN_DISP 32
  189 #define R_MIPS_REL16    33
  190 #define R_MIPS_ADD_IMMEDIATE 34
  191 #define R_MIPS_PJUMP    35
  192 #define R_MIPS_ERLGOT   36
  193 
  194 #define R_MIPS_max      37
  195 #define R_TYPE(name)            __CONCAT(R_MIPS_,name)
  196 
  197 /* Define "machine" characteristics */
  198 #if __ELF_WORD_SIZE == 32
  199 #define ELF_TARG_CLASS  ELFCLASS32
  200 #else
  201 #define ELF_TARG_CLASS  ELFCLASS64
  202 #endif
  203 #ifdef __MIPSEB__
  204 #define ELF_TARG_DATA   ELFDATA2MSB
  205 #else
  206 #define ELF_TARG_DATA   ELFDATA2LSB
  207 #endif
  208 #define ELF_TARG_MACH   EM_MIPS
  209 #define ELF_TARG_VER    1
  210 
  211 /*
  212  * Auxiliary vector entries for passing information to the interpreter.
  213  *
  214  * The i386 supplement to the SVR4 ABI specification names this "auxv_t",
  215  * but POSIX lays claim to all symbols ending with "_t".
  216  */
  217 typedef struct {        /* Auxiliary vector entry on initial stack */
  218         int     a_type;                 /* Entry type. */
  219         union {
  220                 int     a_val;          /* Integer value. */
  221                 void    *a_ptr;         /* Address. */
  222                 void    (*a_fcn)(void); /* Function pointer (not used). */
  223         } a_un;
  224 } Elf32_Auxinfo;
  225 
  226 typedef struct {        /* Auxiliary vector entry on initial stack */
  227         long    a_type;                 /* Entry type. */
  228         union {
  229                 long    a_val;          /* Integer value. */
  230                 void    *a_ptr;         /* Address. */
  231                 void    (*a_fcn)(void); /* Function pointer (not used). */
  232         } a_un;
  233 } Elf64_Auxinfo;
  234 
  235 __ElfType(Auxinfo);
  236 
  237 /* Values for a_type. */
  238 #define AT_NULL         0       /* Terminates the vector. */
  239 #define AT_IGNORE       1       /* Ignored entry. */
  240 #define AT_EXECFD       2       /* File descriptor of program to load. */
  241 #define AT_PHDR         3       /* Program header of program already loaded. */
  242 #define AT_PHENT        4       /* Size of each program header entry. */
  243 #define AT_PHNUM        5       /* Number of program header entries. */
  244 #define AT_PAGESZ       6       /* Page size in bytes. */
  245 #define AT_BASE         7       /* Interpreter's base address. */
  246 #define AT_FLAGS        8       /* Flags (unused for i386). */
  247 #define AT_ENTRY        9       /* Where interpreter should transfer control. */
  248 #define AT_NOTELF       10      /* Program is not ELF ?? */
  249 #define AT_UID          11      /* Real uid. */
  250 #define AT_EUID         12      /* Effective uid. */
  251 #define AT_GID          13      /* Real gid. */
  252 #define AT_EGID         14      /* Effective gid. */
  253 #define AT_EXECPATH     15      /* Path to the executable. */
  254 #define AT_CANARY       16      /* Canary for SSP */
  255 #define AT_CANARYLEN    17      /* Length of the canary. */
  256 #define AT_OSRELDATE    18      /* OSRELDATE. */
  257 #define AT_NCPUS        19      /* Number of CPUs. */
  258 #define AT_PAGESIZES    20      /* Pagesizes. */
  259 #define AT_PAGESIZESLEN 21      /* Number of pagesizes. */
  260 #define AT_STACKPROT    23      /* Initial stack protection. */
  261 
  262 #define AT_COUNT        24      /* Count of defined aux entry types. */
  263 
  264 #define ET_DYN_LOAD_ADDR 0x0120000
  265 
  266 /*
  267  * Constant to mark start of symtab/strtab saved by trampoline
  268  */
  269 #define SYMTAB_MAGIC    0x64656267
  270 
  271 #endif /* !_MACHINE_ELF_H_ */

Cache object: 9c523ad1147f6c19e733e07c1217788e


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.