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 /*-
    2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND BSD-2-Clause-NetBSD
    3  *
    4  * Copyright (c) 2013 M. Warner Losh <imp@FreeBSD.org>
    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  *
   15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   25  * SUCH DAMAGE.
   26  *
   27  * $FreeBSD$
   28  */
   29 
   30 /*-
   31  * Copyright (c) 2013 The NetBSD Foundation, Inc.
   32  * All rights reserved.
   33  *
   34  * Redistribution and use in source and binary forms, with or without
   35  * modification, are permitted provided that the following conditions
   36  * are met:
   37  * 1. Redistributions of source code must retain the above copyright
   38  *    notice, this list of conditions and the following disclaimer.
   39  * 2. Redistributions in binary form must reproduce the above copyright
   40  *    notice, this list of conditions and the following disclaimer in the
   41  *    documentation and/or other materials provided with the distribution.
   42  *
   43  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   44  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   45  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   46  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   47  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   48  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   49  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   50  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   51  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   52  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   53  * POSSIBILITY OF SUCH DAMAGE.
   54  *
   55  * See below starting with the line with $NetBSD...$ for code this applies to.
   56  */
   57 
   58 #ifndef __MIPS_ELF_H
   59 #define __MIPS_ELF_H
   60 
   61 /* FreeBSD specific bits - derived from FreeBSD specific files and changes to old elf.h */
   62 
   63 /*
   64  * Define __ELF_WORD_SIZE based on the ABI, if not defined yet. This sets
   65  * the proper defaults when we're not trying to do 32-bit on 64-bit systems.
   66  * We include both 32 and 64 bit versions so we can support multiple ABIs.
   67  */
   68 #ifndef __ELF_WORD_SIZE
   69 #if defined(__mips_n64)
   70 #define __ELF_WORD_SIZE 64
   71 #else
   72 #define __ELF_WORD_SIZE 32
   73 #endif
   74 #endif
   75 #include <sys/elf32.h>
   76 #include <sys/elf64.h>
   77 #include <sys/elf_generic.h>
   78 
   79 #define ELF_ARCH        EM_MIPS
   80 #define ELF_ARCH32      EM_MIPS
   81 
   82 #define ELF_MACHINE_OK(x)       ((x) == ELF_ARCH)
   83 
   84 /* Define "machine" characteristics */
   85 #if __ELF_WORD_SIZE == 32
   86 #define ELF_TARG_CLASS  ELFCLASS32
   87 #else
   88 #define ELF_TARG_CLASS  ELFCLASS64
   89 #endif
   90 #ifdef __MIPSEB__
   91 #define ELF_TARG_DATA   ELFDATA2MSB
   92 #else
   93 #define ELF_TARG_DATA   ELFDATA2LSB
   94 #endif
   95 #define ELF_TARG_MACH   EM_MIPS
   96 #define ELF_TARG_VER    1
   97 
   98 /*
   99  * Auxiliary vector entries for passing information to the interpreter.
  100  *
  101  * The i386 supplement to the SVR4 ABI specification names this "auxv_t",
  102  * but POSIX lays claim to all symbols ending with "_t".
  103  */
  104 typedef struct {        /* Auxiliary vector entry on initial stack */
  105         int     a_type;                 /* Entry type. */
  106         union {
  107                 int     a_val;          /* Integer value. */
  108 #if defined(__mips_o32) || defined(__mips_n32)
  109                 void    *a_ptr;         /* Address. */
  110                 void    (*a_fcn)(void); /* Function pointer (not used). */
  111 #endif
  112         } a_un;
  113 } Elf32_Auxinfo;
  114 
  115 typedef struct {        /* Auxiliary vector entry on initial stack */
  116         long    a_type;                 /* Entry type. */
  117         union {
  118                 long    a_val;          /* Integer value. */
  119                 void    *a_ptr;         /* Address. */
  120                 void    (*a_fcn)(void); /* Function pointer (not used). */
  121         } a_un;
  122 } Elf64_Auxinfo;
  123 
  124 __ElfType(Auxinfo);
  125 
  126 #define ET_DYN_LOAD_ADDR 0x0120000
  127 
  128 /*
  129  * Constant to mark start of symtab/strtab saved by trampoline
  130  */
  131 #define SYMTAB_MAGIC    0x64656267
  132 
  133 /* from NetBSD's sys/mips/include/elf_machdep.h $NetBSD: elf_machdep.h,v 1.18 2013/05/23 21:39:49 christos Exp $ */
  134 
  135 /* mips relocs. */
  136 
  137 #define R_MIPS_NONE             0
  138 #define R_MIPS_16               1
  139 #define R_MIPS_32               2
  140 #define R_MIPS_REL32            3
  141 #define R_MIPS_REL              R_MIPS_REL32
  142 #define R_MIPS_26               4
  143 #define R_MIPS_HI16             5       /* high 16 bits of symbol value */
  144 #define R_MIPS_LO16             6       /* low 16 bits of symbol value */
  145 #define R_MIPS_GPREL16          7       /* GP-relative reference  */
  146 #define R_MIPS_LITERAL          8       /* Reference to literal section  */
  147 #define R_MIPS_GOT16            9       /* Reference to global offset table */
  148 #define R_MIPS_GOT              R_MIPS_GOT16
  149 #define R_MIPS_PC16             10      /* 16 bit PC relative reference */
  150 #define R_MIPS_CALL16           11      /* 16 bit call thru glbl offset tbl */
  151 #define R_MIPS_CALL             R_MIPS_CALL16
  152 #define R_MIPS_GPREL32          12
  153 
  154 /* 13, 14, 15 are not defined at this point. */
  155 #define R_MIPS_UNUSED1          13
  156 #define R_MIPS_UNUSED2          14
  157 #define R_MIPS_UNUSED3          15
  158 
  159 /*
  160  * The remaining relocs are apparently part of the 64-bit Irix ELF ABI.
  161  */
  162 #define R_MIPS_SHIFT5           16
  163 #define R_MIPS_SHIFT6           17
  164 
  165 #define R_MIPS_64               18
  166 #define R_MIPS_GOT_DISP         19
  167 #define R_MIPS_GOT_PAGE         20
  168 #define R_MIPS_GOT_OFST         21
  169 #define R_MIPS_GOT_HI16         22
  170 #define R_MIPS_GOT_LO16         23
  171 #define R_MIPS_SUB              24
  172 #define R_MIPS_INSERT_A         25
  173 #define R_MIPS_INSERT_B         26
  174 #define R_MIPS_DELETE           27
  175 #define R_MIPS_HIGHER           28
  176 #define R_MIPS_HIGHEST          29
  177 #define R_MIPS_CALL_HI16        30
  178 #define R_MIPS_CALL_LO16        31
  179 #define R_MIPS_SCN_DISP         32
  180 #define R_MIPS_REL16            33
  181 #define R_MIPS_ADD_IMMEDIATE    34
  182 #define R_MIPS_PJUMP            35
  183 #define R_MIPS_RELGOT           36
  184 #define R_MIPS_JALR             37
  185 /* TLS relocations */
  186 
  187 #define R_MIPS_TLS_DTPMOD32     38      /* Module number 32 bit */
  188 #define R_MIPS_TLS_DTPREL32     39      /* Module-relative offset 32 bit */
  189 #define R_MIPS_TLS_DTPMOD64     40      /* Module number 64 bit */
  190 #define R_MIPS_TLS_DTPREL64     41      /* Module-relative offset 64 bit */
  191 #define R_MIPS_TLS_GD           42      /* 16 bit GOT offset for GD */
  192 #define R_MIPS_TLS_LDM          43      /* 16 bit GOT offset for LDM */
  193 #define R_MIPS_TLS_DTPREL_HI16  44      /* Module-relative offset, high 16 bits */
  194 #define R_MIPS_TLS_DTPREL_LO16  45      /* Module-relative offset, low 16 bits */
  195 #define R_MIPS_TLS_GOTTPREL     46      /* 16 bit GOT offset for IE */
  196 #define R_MIPS_TLS_TPREL32      47      /* TP-relative offset, 32 bit */
  197 #define R_MIPS_TLS_TPREL64      48      /* TP-relative offset, 64 bit */
  198 #define R_MIPS_TLS_TPREL_HI16   49      /* TP-relative offset, high 16 bits */
  199 #define R_MIPS_TLS_TPREL_LO16   50      /* TP-relative offset, low 16 bits */
  200 
  201 #define R_MIPS_max              51
  202 
  203 #define R_TYPE(name)            __CONCAT(R_MIPS_,name)
  204 
  205 #define R_MIPS16_min            100
  206 #define R_MIPS16_26             100
  207 #define R_MIPS16_GPREL          101
  208 #define R_MIPS16_GOT16          102
  209 #define R_MIPS16_CALL16         103
  210 #define R_MIPS16_HI16           104
  211 #define R_MIPS16_LO16           105
  212 #define R_MIPS16_max            106
  213 
  214 #define R_MIPS_COPY             126
  215 #define R_MIPS_JUMP_SLOT        127
  216 
  217 #endif /* __MIPS_ELF_H */

Cache object: 11cc74d671d93bf8c830dd3ad2733dfb


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