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/8.0/sys/mips/include/elf.h 198283 2009-10-20 13:32:28Z 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 #define __ELF_WORD_SIZE 32      /* Used by <sys/elf_generic.h> */
   45 #endif
   46 #include <sys/elf32.h>  /* Definitions common to all 32 bit architectures. */
   47 #include <sys/elf64.h>  /* Definitions common to all 64 bit architectures. */
   48 #include <sys/elf_generic.h>
   49 
   50 #define ELF_ARCH        EM_MIPS
   51 #define ELF_MACHINE_OK(x) ((x) == EM_MIPS || (x) == EM_MIPS_RS4_BE)
   52 
   53 /* Architecture dependent Segment types - p_type */
   54 #define PT_MIPS_REGINFO         0x70000000 /* Register usage information */
   55 
   56 /* Architecture dependent d_tag field for Elf32_Dyn.  */
   57 #define DT_MIPS_RLD_VERSION     0x70000001 /* Runtime Linker Interface ID */
   58 #define DT_MIPS_TIME_STAMP      0x70000002 /* Timestamp */
   59 #define DT_MIPS_ICHECKSUM       0x70000003 /* Cksum of ext str and com sizes */
   60 #define DT_MIPS_IVERSION        0x70000004 /* Version string (string tbl index) */
   61 #define DT_MIPS_FLAGS           0x70000005 /* Flags */
   62 #define DT_MIPS_BASE_ADDRESS    0x70000006 /* Segment base address */
   63 #define DT_MIPS_CONFLICT        0x70000008 /* Adr of .conflict section */
   64 #define DT_MIPS_LIBLIST         0x70000009 /* Address of .liblist section */
   65 #define DT_MIPS_LOCAL_GOTNO     0x7000000a /* Number of local .GOT entries */
   66 #define DT_MIPS_CONFLICTNO      0x7000000b /* Number of .conflict entries */
   67 #define DT_MIPS_LIBLISTNO       0x70000010 /* Number of .liblist entries */
   68 #define DT_MIPS_SYMTABNO        0x70000011 /* Number of .dynsym entries */
   69 #define DT_MIPS_UNREFEXTNO      0x70000012 /* First external DYNSYM */
   70 #define DT_MIPS_GOTSYM          0x70000013 /* First GOT entry in .dynsym */
   71 #define DT_MIPS_HIPAGENO        0x70000014 /* Number of GOT page table entries */
   72 #define DT_MIPS_RLD_MAP         0x70000016 /* Address of debug map pointer */
   73 
   74 #define DT_PROCNUM (DT_MIPS_RLD_MAP - DT_LOPROC + 1)
   75 
   76 /*
   77  * Legal values for e_flags field of Elf32_Ehdr.
   78  */
   79 #define EF_MIPS_NOREORDER       1               /* .noreorder was used */
   80 #define EF_MIPS_PIC             2               /* Contains PIC code */
   81 #define EF_MIPS_CPIC            4               /* Uses PIC calling sequence */
   82 #define EF_MIPS_ARCH            0xf0000000      /* MIPS architecture level */
   83 
   84 /*
   85  * Mips special sections.
   86  */
   87 #define SHN_MIPS_ACOMMON        0xff00          /* Allocated common symbols */
   88 #define SHN_MIPS_SCOMMON        0xff03          /* Small common symbols */
   89 #define SHN_MIPS_SUNDEFINED     0xff04          /* Small undefined symbols */
   90 
   91 /*
   92  * Legal values for sh_type field of Elf32_Shdr.
   93  */
   94 #define SHT_MIPS_LIBLIST        0x70000000 /* Shared objects used in link */
   95 #define SHT_MIPS_CONFLICT       0x70000002 /* Conflicting symbols */
   96 #define SHT_MIPS_GPTAB          0x70000003 /* Global data area sizes */
   97 #define SHT_MIPS_UCODE          0x70000004 /* Reserved for SGI/MIPS compilers */
   98 #define SHT_MIPS_DEBUG          0x70000005 /* MIPS ECOFF debugging information */
   99 #define SHT_MIPS_REGINFO        0x70000006 /* Register usage information */
  100 
  101 /*
  102  * Legal values for sh_flags field of Elf32_Shdr.
  103  */
  104 #define SHF_MIPS_GPREL          0x10000000 /* Must be part of global data area */
  105 
  106 /*
  107  * Entries found in sections of type SHT_MIPS_GPTAB.
  108  */
  109 typedef union {
  110         struct {
  111                 Elf32_Word gt_current_g_value;  /* -G val used in compilation */
  112                 Elf32_Word gt_unused;   /* Not used */
  113         } gt_header;                    /* First entry in section */
  114         struct {
  115                 Elf32_Word gt_g_value;  /* If this val were used for -G */
  116                 Elf32_Word gt_bytes;    /* This many bytes would be used */
  117         } gt_entry;                     /* Subsequent entries in section */
  118 } Elf32_gptab;
  119 typedef union {
  120         struct {
  121                 Elf64_Word gt_current_g_value;  /* -G val used in compilation */
  122                 Elf64_Word gt_unused;   /* Not used */
  123         } gt_header;                    /* First entry in section */
  124         struct {
  125                 Elf64_Word gt_g_value;  /* If this val were used for -G */
  126                 Elf64_Word gt_bytes;    /* This many bytes would be used */
  127         } gt_entry;                     /* Subsequent entries in section */
  128 } Elf64_gptab;
  129 
  130 /*
  131  * Entry found in sections of type SHT_MIPS_REGINFO.
  132  */
  133 typedef struct {
  134         Elf32_Word      ri_gprmask;     /* General registers used */
  135         Elf32_Word      ri_cprmask[4];  /* Coprocessor registers used */
  136         Elf32_Sword     ri_gp_value;    /* $gp register value */
  137 } Elf32_RegInfo;
  138 typedef struct {
  139         Elf64_Word      ri_gprmask;     /* General registers used */
  140         Elf64_Word      ri_cprmask[4];  /* Coprocessor registers used */
  141         Elf64_Sword     ri_gp_value;    /* $gp register value */
  142 } Elf64_RegInfo;
  143 
  144 
  145 /*
  146  * Mips relocations.
  147  */
  148 
  149 #define R_MIPS_NONE     0       /* No reloc */
  150 #define R_MIPS_16       1       /* Direct 16 bit */
  151 #define R_MIPS_32       2       /* Direct 32 bit */
  152 #define R_MIPS_REL32    3       /* PC relative 32 bit */
  153 #define R_MIPS_26       4       /* Direct 26 bit shifted */
  154 #define R_MIPS_HI16     5       /* High 16 bit */
  155 #define R_MIPS_LO16     6       /* Low 16 bit */
  156 #define R_MIPS_GPREL16  7       /* GP relative 16 bit */
  157 #define R_MIPS_LITERAL  8       /* 16 bit literal entry */
  158 #define R_MIPS_GOT16    9       /* 16 bit GOT entry */
  159 #define R_MIPS_PC16     10      /* PC relative 16 bit */
  160 #define R_MIPS_CALL16   11      /* 16 bit GOT entry for function */
  161 #define R_MIPS_GPREL32  12      /* GP relative 32 bit */
  162 #define R_MIPS_GOTHI16  21      /* GOT HI 16 bit */
  163 #define R_MIPS_GOTLO16  22      /* GOT LO 16 bit */
  164 #define R_MIPS_CALLHI16 30      /* upper 16 bit GOT entry for function */
  165 #define R_MIPS_CALLLO16 31      /* lower 16 bit GOT entry for function */
  166 
  167 /*
  168  * These are from the 64-bit Irix ELF ABI
  169  */
  170 #define R_MIPS_SHIFT5   16
  171 #define R_MIPS_SHIFT6   17
  172 #define R_MIPS_64       18
  173 #define R_MIPS_GOT_DISP 19
  174 #define R_MIPS_GOT_PAGE 20
  175 #define R_MIPS_GOT_OFST 21
  176 #define R_MIPS_GOT_HI16 22
  177 #define R_MIPS_GOT_LO16 23
  178 #define R_MIPS_SUB      24
  179 #define R_MIPS_INSERT_A 25
  180 #define R_MIPS_INSERT_B 26
  181 #define R_MIPS_DELETE   27
  182 #define R_MIPS_HIGHER   28
  183 #define R_MIPS_HIGHEST  29
  184 #define R_MIPS_SCN_DISP 32
  185 #define R_MIPS_REL16    33
  186 #define R_MIPS_ADD_IMMEDIATE 34
  187 #define R_MIPS_PJUMP    35
  188 #define R_MIPS_ERLGOT   36
  189 
  190 #define R_MIPS_max      37
  191 #define R_TYPE(name)            __CONCAT(R_MIPS_,name)
  192 
  193 /* Define "machine" characteristics */
  194 #if __ELF_WORD_SIZE == 32
  195 #define ELF_TARG_CLASS  ELFCLASS32
  196 #else
  197 #define ELF_TARG_CLASS  ELFCLASS64
  198 #endif
  199 #ifdef __MIPSEB__
  200 #define ELF_TARG_DATA   ELFDATA2MSB
  201 #else
  202 #define ELF_TARG_DATA   ELFDATA2LSB
  203 #endif
  204 #define ELF_TARG_MACH   EM_MIPS
  205 #define ELF_TARG_VER    1
  206 
  207 /*
  208  * Auxiliary vector entries for passing information to the interpreter.
  209  *
  210  * The i386 supplement to the SVR4 ABI specification names this "auxv_t",
  211  * but POSIX lays claim to all symbols ending with "_t".
  212  */
  213 typedef struct {        /* Auxiliary vector entry on initial stack */
  214         int     a_type;                 /* Entry type. */
  215         union {
  216                 int     a_val;          /* Integer value. */
  217                 void    *a_ptr;         /* Address. */
  218                 void    (*a_fcn)(void); /* Function pointer (not used). */
  219         } a_un;
  220 } Elf32_Auxinfo;
  221 
  222 typedef struct {        /* Auxiliary vector entry on initial stack */
  223         long    a_type;                 /* Entry type. */
  224         union {
  225                 long    a_val;          /* Integer value. */
  226                 void    *a_ptr;         /* Address. */
  227                 void    (*a_fcn)(void); /* Function pointer (not used). */
  228         } a_un;
  229 } Elf64_Auxinfo;
  230 
  231 __ElfType(Auxinfo);
  232 
  233 /* Values for a_type. */
  234 #define AT_NULL         0       /* Terminates the vector. */
  235 #define AT_IGNORE       1       /* Ignored entry. */
  236 #define AT_EXECFD       2       /* File descriptor of program to load. */
  237 #define AT_PHDR         3       /* Program header of program already loaded. */
  238 #define AT_PHENT        4       /* Size of each program header entry. */
  239 #define AT_PHNUM        5       /* Number of program header entries. */
  240 #define AT_PAGESZ       6       /* Page size in bytes. */
  241 #define AT_BASE         7       /* Interpreter's base address. */
  242 #define AT_FLAGS        8       /* Flags (unused for i386). */
  243 #define AT_ENTRY        9       /* Where interpreter should transfer control. */
  244 #define AT_NOTELF       10      /* Program is not ELF ?? */
  245 #define AT_UID          11      /* Real uid. */
  246 #define AT_EUID         12      /* Effective uid. */
  247 #define AT_GID          13      /* Real gid. */
  248 #define AT_EGID         14      /* Effective gid. */
  249 #define AT_EXECPATH     15      /* Path to the executable. */
  250 
  251 #define AT_COUNT        16      /* Count of defined aux entry types. */
  252 
  253 #define ET_DYN_LOAD_ADDR 0x0120000
  254 
  255 #endif /* !_MACHINE_ELF_H_ */

Cache object: 8fe3b63617d07969a4fde4835fa7e7f8


[ 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.