elf.h

Go to the documentation of this file.
00001 
00002 /*
00003 
00004   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00005 
00006   This program is free software; you can redistribute it and/or modify it
00007   under the terms of version 2 of the GNU General Public License as
00008   published by the Free Software Foundation.
00009 
00010   This program is distributed in the hope that it would be useful, but
00011   WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00013 
00014   Further, this software is distributed without any warranty that it is
00015   free of the rightful claim of any third person regarding infringement 
00016   or the like.  Any license provided herein, whether implied or 
00017   otherwise, applies only to this software file.  Patent licenses, if 
00018   any, provided herein do not apply to combinations of this program with 
00019   other software, or any other product whatsoever.  
00020 
00021   You should have received a copy of the GNU General Public License along
00022   with this program; if not, write the Free Software Foundation, Inc., 59
00023   Temple Place - Suite 330, Boston MA 02111-1307, USA.
00024 
00025   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00026   Mountain View, CA 94043, or:
00027 
00028   http://www.sgi.com
00029 
00030   For further information regarding this notice, see:
00031 
00032   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00033 
00034 */
00035 
00036 #ifndef _ELF_H
00037 #define _ELF_H 1
00038 
00039 #if defined(__mips) /* MIPS */
00040 
00041 # include <../../usr/include/elf.h>
00042 
00043 #else
00044 
00045 /***************************************************************************/
00046 /* eraxxon: Assume we always want this */
00047 
00048 #if !(defined(__MIPS_AND_IA64_ELF_H))
00049 # define __MIPS_AND_IA64_ELF_H 1
00050 #endif
00051 
00052 /***************************************************************************/
00053 /* eraxxon: Manually declare needed stuff from cdefs.h */
00054 
00055 #ifdef __BEGIN_DECLS
00056 # undef __BEGIN_DECLS
00057 #endif
00058 
00059 #ifdef __END_DECLS
00060 # undef __END_DECLS
00061 #endif
00062 
00063 #ifdef _DOTDOTDOT
00064 # undef _DOTDOTDOT
00065 #endif
00066 
00067 #if defined(__cplusplus)
00068 # define __BEGIN_DECLS  extern "C" {
00069 # define __END_DECLS    };
00070 # define _DOTDOTDOT ...
00071 #else
00072 # define __BEGIN_DECLS
00073 # define __END_DECLS
00074 # define _DOTDOTDOT
00075 #endif
00076 
00077 /***************************************************************************/
00078 
00079 
00080 
00081 __BEGIN_DECLS
00082 
00083 /* Standard ELF types. */
00084 
00085 #include <inttypes.h>
00086 /* #include <stdint.h> */
00087 
00088 /* Type for a 16-bit quantity.  */
00089 typedef uint16_t Elf32_Half;
00090 typedef uint16_t Elf64_Half;
00091 
00092 /* Types for signed and unsigned 32-bit quantities.  */
00093 typedef uint32_t Elf32_Word;
00094 typedef int32_t  Elf32_Sword;
00095 typedef uint32_t Elf64_Word;
00096 typedef int32_t  Elf64_Sword;
00097 
00098 /* Types for signed and unsigned 64-bit quantities.  */
00099 typedef uint64_t Elf32_Xword;
00100 typedef int64_t  Elf32_Sxword;
00101 typedef uint64_t Elf64_Xword;
00102 typedef int64_t  Elf64_Sxword;
00103 
00104 /* Type of addresses.  */
00105 typedef uint32_t Elf32_Addr;
00106 typedef uint64_t Elf64_Addr;
00107 
00108 /* Type of file offsets.  */
00109 typedef uint32_t Elf32_Off;
00110 typedef uint64_t Elf64_Off;
00111 
00112 /* Type for section indices, which are 16-bit quantities.  */
00113 typedef uint16_t Elf32_Section;
00114 typedef uint16_t Elf64_Section;
00115 
00116 /* Type of symbol indices.  */
00117 typedef uint32_t Elf32_Symndx;
00118 typedef uint64_t Elf64_Symndx;
00119 
00120 #if defined(__MIPS_AND_IA64_ELF_H)
00121 typedef unsigned char Elf32_Byte;
00122 typedef unsigned char Elf64_Byte;
00123 #endif
00124 
00125 /* The ELF file header.  This appears at the start of every ELF file.  */
00126 
00127 #define EI_NIDENT (16)
00128 
00129 typedef struct
00130 {
00131   unsigned char e_ident[EI_NIDENT];     /* Magic number and other info */
00132   Elf32_Half    e_type;                 /* Object file type */
00133   Elf32_Half    e_machine;              /* Architecture */
00134   Elf32_Word    e_version;              /* Object file version */
00135   Elf32_Addr    e_entry;                /* Entry point virtual address */
00136   Elf32_Off     e_phoff;                /* Program header table file offset */
00137   Elf32_Off     e_shoff;                /* Section header table file offset */
00138   Elf32_Word    e_flags;                /* Processor-specific flags */
00139   Elf32_Half    e_ehsize;               /* ELF header size in bytes */
00140   Elf32_Half    e_phentsize;            /* Program header table entry size */
00141   Elf32_Half    e_phnum;                /* Program header table entry count */
00142   Elf32_Half    e_shentsize;            /* Section header table entry size */
00143   Elf32_Half    e_shnum;                /* Section header table entry count */
00144   Elf32_Half    e_shstrndx;             /* Section header string table index */
00145 } Elf32_Ehdr;
00146 
00147 typedef struct
00148 {
00149   unsigned char e_ident[EI_NIDENT];     /* Magic number and other info */
00150   Elf64_Half    e_type;                 /* Object file type */
00151   Elf64_Half    e_machine;              /* Architecture */
00152   Elf64_Word    e_version;              /* Object file version */
00153   Elf64_Addr    e_entry;                /* Entry point virtual address */
00154   Elf64_Off     e_phoff;                /* Program header table file offset */
00155   Elf64_Off     e_shoff;                /* Section header table file offset */
00156   Elf64_Word    e_flags;                /* Processor-specific flags */
00157   Elf64_Half    e_ehsize;               /* ELF header size in bytes */
00158   Elf64_Half    e_phentsize;            /* Program header table entry size */
00159   Elf64_Half    e_phnum;                /* Program header table entry count */
00160   Elf64_Half    e_shentsize;            /* Section header table entry size */
00161   Elf64_Half    e_shnum;                /* Section header table entry count */
00162   Elf64_Half    e_shstrndx;             /* Section header string table index */
00163 } Elf64_Ehdr;
00164 
00165 /* Fields in the e_ident array.  The EI_* macros are indices into the
00166    array.  The macros under each EI_* macro are the values the byte
00167    may have.  */
00168 
00169 #define EI_MAG0         0               /* File identification byte 0 index */
00170 #define ELFMAG0         0x7f            /* Magic number byte 0 */
00171 
00172 #define EI_MAG1         1               /* File identification byte 1 index */
00173 #define ELFMAG1         'E'             /* Magic number byte 1 */
00174 
00175 #define EI_MAG2         2               /* File identification byte 2 index */
00176 #define ELFMAG2         'L'             /* Magic number byte 2 */
00177 
00178 #define EI_MAG3         3               /* File identification byte 3 index */
00179 #define ELFMAG3         'F'             /* Magic number byte 3 */
00180 
00181 /* Conglomeration of the identification bytes, for easy testing as a word.  */
00182 #define ELFMAG          "\177ELF"
00183 #define SELFMAG         4
00184 
00185 #define IS_ELF(ehdr)    ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
00186                         (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \
00187                         (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \
00188                         (ehdr).e_ident[EI_MAG3] == ELFMAG3)
00189 
00190 #define EI_CLASS        4               /* File class byte index */
00191 #define ELFCLASSNONE    0               /* Invalid class */
00192 #define ELFCLASS32      1               /* 32-bit objects */
00193 #define ELFCLASS64      2               /* 64-bit objects */
00194 
00195 #define EI_DATA         5               /* Data encoding byte index */
00196 #define ELFDATANONE     0               /* Invalid data encoding */
00197 #define ELFDATA2LSB     1               /* 2's complement, little endian */
00198 #define ELFDATA2MSB     2               /* 2's complement, big endian */
00199 
00200 #define EI_VERSION      6               /* File version byte index */
00201                                         /* Value must be EV_CURRENT */
00202 
00203 #define EI_PAD          7               /* Byte index of padding bytes */
00204 
00205 /* Legal values for e_type (object file type).  */
00206 
00207 #define ET_NONE         0               /* No file type */
00208 #define ET_REL          1               /* Relocatable file */
00209 #define ET_EXEC         2               /* Executable file */
00210 #define ET_DYN          3               /* Shared object file */
00211 #define ET_CORE         4               /* Core file */
00212 #define ET_NUM          5               /* Number of defined types.  */
00213 #define ET_LOPROC       0xff00          /* Processor-specific */
00214 #define ET_HIPROC       0xffff          /* Processor-specific */
00215 
00216 #if defined(__MIPS_AND_IA64_ELF_H)
00217 # define ET_IR  (ET_LOPROC + 0)      /* file is a 32-bit or 64-bit WHIRL file*/
00218 #endif
00219 
00220 /* Legal values for e_machine (architecture).  */
00221 
00222 #define EM_NONE         0               /* No machine */
00223 #define EM_M32          1               /* AT&T WE 32100 */
00224 #define EM_SPARC        2               /* SUN SPARC */
00225 #define EM_386          3               /* Intel 80386 */
00226 #define EM_68K          4               /* Motorola m68k family */
00227 #define EM_88K          5               /* Motorola m88k family */
00228 #define EM_486          6               /* Intel 80486 */
00229 #define EM_860          7               /* Intel 80860 */
00230 #define EM_MIPS         8               /* MIPS R3000 big-endian */
00231 #define EM_S370         9               /* Amdahl */
00232 #define EM_MIPS_RS4_BE 10               /* MIPS R4000 big-endian */
00233 
00234 #if defined(__MIPS_AND_IA64_ELF_H)
00235 /* NOTE THAT THIS VALUE CLASHES WITH AN OFFICIAL ONE JUST ABOVE. */
00236 #define EM_XIA64        10              /* Experimental IA64 objects
00237                                          * used only by the simulator.
00238                                          */
00239 #define EM_IA_64        50              /* Intel IA64 */
00240 #define EM_EAS2_3       0x0406
00241 #endif
00242 
00243 #define EM_SPARC64     11               /* SPARC v9 (not official) 64-bit */
00244 
00245 #define EM_PARISC      15               /* HPPA */
00246 #define EM_PPC         20               /* PowerPC */
00247 
00248 /* If it is necessary to assign new unofficial EM_* values, please
00249    pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the
00250    chances of collision with official or non-GNU unofficial values.  */
00251 
00252 #define EM_ALPHA        0x9026
00253 
00254 /* Legal values for e_version (version).  */
00255 
00256 #define EV_NONE         0               /* Invalid ELF version */
00257 #define EV_CURRENT      1               /* Current version */
00258 
00259 /* Section header.  */
00260 
00261 typedef struct
00262 {
00263   Elf32_Word    sh_name;                /* Section name (string tbl index) */
00264   Elf32_Word    sh_type;                /* Section type */
00265   Elf32_Word    sh_flags;               /* Section flags */
00266   Elf32_Addr    sh_addr;                /* Section virtual addr at execution */
00267   Elf32_Off     sh_offset;              /* Section file offset */
00268   Elf32_Word    sh_size;                /* Section size in bytes */
00269   Elf32_Word    sh_link;                /* Link to another section */
00270   Elf32_Word    sh_info;                /* Additional section information */
00271   Elf32_Word    sh_addralign;           /* Section alignment */
00272   Elf32_Word    sh_entsize;             /* Entry size if section holds table */
00273 } Elf32_Shdr;
00274 
00275 typedef struct
00276 {
00277   Elf64_Word    sh_name;                /* Section name (string tbl index) */
00278   Elf64_Word    sh_type;                /* Section type */
00279   Elf64_Xword   sh_flags;               /* Section flags */
00280   Elf64_Addr    sh_addr;                /* Section virtual addr at execution */
00281   Elf64_Off     sh_offset;              /* Section file offset */
00282   Elf64_Xword   sh_size;                /* Section size in bytes */
00283   Elf64_Word    sh_link;                /* Link to another section */
00284   Elf64_Word    sh_info;                /* Additional section information */
00285   Elf64_Xword   sh_addralign;           /* Section alignment */
00286   Elf64_Xword   sh_entsize;             /* Entry size if section holds table */
00287 } Elf64_Shdr;
00288 
00289 
00290 /* eraxxon: a special section only for IRIX */
00291 #if defined(__mips)
00292 #define MIPS_LBSS       ".lbss"
00293 #endif
00294 
00295 #if defined(__MIPS_AND_IA64_ELF_H)
00296 /* Special section names */
00297 #define ELF_BSS         ".bss"
00298 #define ELF_COMMENT     ".comment"
00299 #define ELF_DATA        ".data"
00300 #define ELF_DATA_PU     ".data_pu"
00301 #define ELF_DEBUG       ".debug"
00302 #define ELF_DYNAMIC     ".dynamic"
00303 #define ELF_DYNSTR      ".dynstr"
00304 #define ELF_DYNSYM      ".dynsym"
00305 #define ELF_MSYM        ".msym"
00306 #define ELF_FINI        ".fini"
00307 #define ELF_GOT         ".got"
00308 #define ELF_PLT         ".plt"
00309 #define ELF_HASH        ".hash"
00310 #define ELF_INIT        ".init"
00311 #define ELF_REL_DATA    ".rel.data"
00312 #define ELF_REL_FINI    ".rel.fini"
00313 #define ELF_REL_INIT    ".rel.init"
00314 #define ELF_REL_DYN     ".rel.dyn"
00315 #define ELF_REL_RODATA  ".rel.rodata"
00316 #define ELF_REL_TEXT    ".rel.text"
00317 #define ELF_RODATA      ".rodata"
00318 #define ELF_RODATA_PU   ".rodata_pu"
00319 #define ELF_SHSTRTAB    ".shstrtab"
00320 #define ELF_STRTAB      ".strtab"
00321 #define ELF_SYMTAB      ".symtab"
00322 #define ELF_TEXT        ".text"
00323 
00324 /*
00325  * special section names
00326  *
00327  *      These are the section names for those sections
00328  *      that exist in both Irix/mips and Irix/ia64 objects.
00329  */
00330 #define MIPS_LIBLIST            ".liblist"
00331 #define MIPS_MSYM               ".msym"
00332 #define MIPS_CONFLICT           ".conflict"
00333 #define MIPS_SDATA              ".sdata"
00334 #define MIPS_SDATA_PU           ".sdata_pu"
00335 #define MIPS_REL_SDATA          ".rel.sdata"
00336 #define MIPS_SRDATA             ".srdata"
00337 #define MIPS_SRDATA_PU          ".srdata_pu"
00338 #define MIPS_RDATA              ".rdata"
00339 #define MIPS_SBSS               ".sbss"
00340 #define MIPS_LIT4               ".lit4"
00341 #define MIPS_LIT8               ".lit8"
00342 #define MIPS_LIT16              ".lit16"
00343 #define MIPS_EVENTS             ".MIPS.events"
00344 #define MIPS_INTERFACES         ".MIPS.interfaces"
00345 #define MIPS_OPTIONS            ".MIPS.options"
00346 #define MIPS_SYMBOL_LIB         ".MIPS.symlib"
00347 #define MIPS_DEBUG_INFO         ".debug_info"
00348 #define MIPS_DEBUG_LINE         ".debug_line"
00349 #define MIPS_DEBUG_ABBREV       ".debug_abbrev"
00350 #define MIPS_DEBUG_FRAME        ".debug_frame"
00351 #define MIPS_DEBUG_ARANGES      ".debug_aranges"
00352 #define MIPS_DEBUG_PUBNAMES     ".debug_pubnames"
00353 #define MIPS_DEBUG_STR          ".debug_str"
00354 #define MIPS_DEBUG_FUNCNAMES    ".debug_funcnames"
00355 #define MIPS_DEBUG_TYPENAMES    ".debug_typenames"
00356 #define MIPS_DEBUG_VARNAMES     ".debug_varnames"
00357 #define MIPS_DEBUG_WEAKNAMES    ".debug_weaknames"
00358 #define MIPS_XLATE              ".MIPS.Xlate"
00359 #define MIPS_XLATE_DEBUG        ".MIPS.Xlate_debug"
00360 #define MIPS_CONTENT            ".MIPS.content"
00361 #define MIPS_WHIRL              ".WHIRL"        /* Mips uses this name       */
00362 
00363 /*
00364  * special section names
00365  *
00366  *      These are the section names for those sections
00367  *      that exist in both Irix/mips and Irix/ia64 objects.
00368  */
00369 #define IA64_LIBLIST            ".liblist"
00370 #define IA64_MSYM               ".msym"
00371 #define IA64_CONFLICT           ".conflict"
00372 #define IA64_SDATA              ".sdata"
00373 #define IA64_REL_SDATA          ".rel.sdata"
00374 #define IA64_SRDATA             ".srdata"
00375 #define IA64_RDATA              ".rdata"
00376 #define IA64_SBSS               ".sbss"
00377 #define IA64_LIT4               ".lit4"
00378 #define IA64_LIT8               ".lit8"
00379 #define IA64_LIT16              ".lit16"
00380 #define IA64_EVENTS             ".IA64.events"
00381 #define IA64_INTERFACES         ".IA64.interfaces"
00382 #define IA64_OPTIONS            ".IA64.options"
00383 #define IA64_SYMBOL_LIB         ".IA64.symlib"
00384 #define IA64_DEBUG_INFO         ".debug_info"
00385 #define IA64_DEBUG_LINE         ".debug_line"
00386 #define IA64_DEBUG_ABBREV       ".debug_abbrev"
00387 #define IA64_DEBUG_FRAME        ".debug_frame"
00388 #define IA64_DEBUG_ARANGES      ".debug_aranges"
00389 #define IA64_DEBUG_PUBNAMES     ".debug_pubnames"
00390 #define IA64_DEBUG_STR          ".debug_str"
00391 #define IA64_DEBUG_FUNCNAMES    ".debug_funcnames"
00392 #define IA64_DEBUG_TYPENAMES    ".debug_typenames"
00393 #define IA64_DEBUG_VARNAMES     ".debug_varnames"
00394 #define IA64_DEBUG_WEAKNAMES    ".debug_weaknames"
00395 #define IA64_XLATE              ".IA64.Xlate"
00396 #define IA64_XLATE_DEBUG        ".IA64.Xlate_debug"
00397 #define IA64_WHIRL              ".IA64.WHIRL"
00398 #define IA64_CONTENT            ".IA64.content"
00399 
00400 
00401 #ifdef __osf__
00402 #define IA64_PACKAGE            ".package"
00403 #define IA64_PACKSYM            ".packsym"
00404 #endif /* __osf__ */
00405 
00406 /*
00407  * special section names
00408  *
00409  *      These are the section names for sections 
00410  *      that are unique to Irix/ia64.
00411  */
00412 #define IA64_ARCHEXT            ".IA_64.archext"
00413 #define IA64_PLTOFF             ".IA_64.pltoff"
00414 #define IA64_UNWIND             ".IA_64.unwind"
00415 #define IA64_UNWIND_INFO        ".IA_64.unwind_info"
00416 
00417 #define ELF64_FSZ_ADDR          8
00418 #define ELF64_FSZ_HALF          2
00419 #define ELF64_FSZ_OFF           8
00420 #define ELF64_FSZ_SWORD         4
00421 #define ELF64_FSZ_WORD          4
00422 #define ELF64_FSZ_SXWORD        8
00423 #define ELF64_FSZ_XWORD         8
00424 
00425 #define ELF32_FSZ_ADDR  4
00426 #define ELF32_FSZ_HALF  2
00427 #define ELF32_FSZ_OFF   4
00428 #define ELF32_FSZ_SWORD 4
00429 #define ELF32_FSZ_WORD  4
00430 
00431 /* Content kind -- valid for ELF-32 and ELF-64: */
00432 typedef enum {
00433     CK_NULL     = 0,        /* Invalid, same as EK_NULL */
00434     CK_DEFAULT  = 0x30,     /* Default type of data for section */
00435     CK_ALIGN    = 0x31,     /* Alignment for described range */
00436     CK_INSTR    = 0x32,     /* Instructions */
00437     CK_DATA     = 0x33,     /* Non-address data */
00438     CK_SADDR_32 = 0x34,     /* Simple 32-bit addresses */
00439     CK_GADDR_32 = 0x35,     /* GP-relative 32-bit addresses */
00440     CK_CADDR_32 = 0x36,     /* Complex 32-bit addresses */
00441     CK_SADDR_64 = 0x37,     /* Simple 64-bit addresses */
00442     CK_GADDR_64 = 0x38,     /* GP-relative 64-bit addresses */
00443     CK_CADDR_64 = 0x39,     /* Complex 64-bit addresses */
00444     CK_NO_XFORM = 0x3a,     /* No transformations allowed in this range */
00445     CK_NO_REORDER = 0x3b,   /* No reordering allowed in this range */
00446     CK_GP_GROUP = 0x3c,     /* Text/data in range with length given by
00447                                second argument references GP group given
00448                                by first. */
00449     CK_STUBS    = 0x3d      /* Text in range is stub code. ULEB */
00450 } Elf_MIPS_Content_Kind;
00451 
00452 typedef struct
00453 {
00454         Elf32_Word      hwp_flags1;     /* extra flags */
00455         Elf32_Word      hwp_flags2;     /* extra flags */
00456 } Elf_Options_Hw;
00457 
00458 /*
00459  *      Elf_Options.kind                Options descriptor kinds
00460  */
00461 #define ODK_NULL                 0      /* Undefined */
00462 #define ODK_MIPS_REGINFO         1      /* MIPS Register usage information */
00463 #define ODK_REGINFO         1      /* MIPS Register usage information */
00464 #define ODK_MIPS_EXCEPTIONS      2      /* MIPS Exception processing options  */
00465 #define ODK_EXCEPTIONS           2      /* MIPS Exception processing options  */
00466 #define ODK_PAD                  3      /* Section padding options */
00467 #define ODK_MIPS_HWPATCH         4      /* MIPS Hardware workarounds performed*/
00468 #define ODK_HWPATCH              4      /* MIPS Hardware workarounds performed*/
00469 #define ODK_FILL                 5      /* The fill value used by the linker */
00470 #define ODK_TAGS                 6      /* Space for desktop tools to write */
00471 #define ODK_MIPS_HWAND           7      /* HW workarounds.'AND' when merging */
00472 #define ODK_HWAND                7      /* HW workarounds.'AND' when merging */
00473 #define ODK_MIPS_HWOR            8      /* HW workarounds.'OR'  when merging */
00474 #define ODK_HWOR                 8      /* HW workarounds.'OR'  when merging */
00475 #define ODK_GP_GROUP             9      /* GP group for text/data sections */
00476 #define ODK_IDENT               10      /* ID information */
00477 #define ODK_IA64_REGINFO        11      /* TO BE CHANGED! */
00478 #define ODK_PAGESIZE            12      /* Alternate segment page size */
00479 
00480 
00481 #define ODK_IA64_EXCEPTIONS     12      /* NOT USED! */
00482 #define ODK_IA64_HWAND          13      /* NOT USED! */
00483 #define ODK_IA64_HWOR           14      /* NOT USED! */
00484 
00485 /*
00486  *      Elf_Options.kind == ODK_MIPS_EXCEPTIONS 
00487  *
00488  *      masks for Elf_Options.info
00489  */
00490 #define OEX_PAGE0       0x10000 /* page zero must be mapped */
00491 #define OEX_SMM         0x20000 /* Force sequential memory mode? */
00492 #define OEX_FPDBUG      0x40000 /* Force floating point debug mode? */
00493 #define OEX_PRECISEFP   OEX_FPDBUG
00494 #define OEX_DISMISS     0x80000 /* Dismiss invalid address faults? */
00495 #define OEX_FPU_MIN     0x1f    /* FPE's which MUST be enabled */
00496 #define OEX_FPU_MAX     0x1f00  /* FPE's which MAY be enabled */
00497 #define OEX_FPU_INVAL   0x10
00498 #define OEX_FPU_DIV0    0x08
00499 #define OEX_FPU_OFLO    0x04
00500 #define OEX_FPU_UFLO    0x02
00501 #define OEX_FPU_INEX    0x01
00502 
00503 /*
00504  *      Elf_Options.kind == ODK_MIPS_HWPATCH
00505  *
00506  *      masks for Elf_Options.info
00507  */
00508 #define OHW_R4KEOP      0x1     /* R4000 end-of-page patch */
00509 #define OHW_R8KPFETCH   0x2     /* may need R8000 prefetch patch */
00510 #define OHW_R5KEOP      0x4     /* R5000 end-of-page patch */
00511 #define OHW_R5KCVTL     0x8     /* R5000 cvt.[ds].l bug.  clean=1 */
00512 #define OHW_R10KLDL     0x10    /* R10000 requires LDL patch    */
00513 
00514 /*
00515  *      Elf_Options.kind == ODK_MIPS_HWOR
00516  *
00517  *      masks for Elf_Options.info
00518  */
00519 #define OHWO0_FIXADE    0x00000001      /* Object requires FIXADE call */
00520 
00521 /*
00522  *      Elf_Options.kind == ODK_PAD
00523  *
00524  *      masks for Elf_Options.info
00525  */
00526 #define OPAD_PREFIX     0x1     
00527 #define OPAD_POSTFIX    0x2
00528 #define OPAD_SYMBOL     0x4
00529 
00530 /*
00531  *      Elf_Options.kind == ODK_GP_GROUP
00532  *
00533  *      masks for Elf_Options.info
00534  */
00535 #define OGP_GROUP       0x0000ffff      /* GP group number */
00536 #define OGP_SELF        0x00010000      /* Self-contained GP groups */
00537 #endif
00538 
00539 
00540 /* Special section indices.  */
00541 
00542 #define SHN_UNDEF       0               /* Undefined section */
00543 #define SHN_LORESERVE   0xff00          /* Start of reserved indices */
00544 #define SHN_LOPROC      0xff00          /* Start of processor-specific */
00545 #define SHN_HIPROC      0xff1f          /* End of processor-specific */
00546 #define SHN_ABS         0xfff1          /* Associated symbol is absolute */
00547 #define SHN_COMMON      0xfff2          /* Associated symbol is common */
00548 #define SHN_HIRESERVE   0xffff          /* End of reserved indices */
00549 
00550 /* Legal values for sh_type (section type).  */
00551 
00552 #define SHT_NULL        0               /* Section header table entry unused */
00553 #define SHT_PROGBITS    1               /* Program data */
00554 #define SHT_SYMTAB      2               /* Symbol table */
00555 #define SHT_STRTAB      3               /* String table */
00556 #define SHT_RELA        4               /* Relocation entries with addends */
00557 #define SHT_HASH        5               /* Symbol hash table */
00558 #define SHT_DYNAMIC     6               /* Dynamic linking information */
00559 #define SHT_NOTE        7               /* Notes */
00560 #define SHT_NOBITS      8               /* Program space with no data (bss) */
00561 #define SHT_REL         9               /* Relocation entries, no addends */
00562 #define SHT_SHLIB       10              /* Reserved */
00563 #define SHT_DYNSYM      11              /* Dynamic linker symbol table */
00564 #define SHT_NUM         12              /* Number of defined types.  */
00565 #define SHT_LOSUNW      0x6ffffffd      /* Sun-specific low bound.  */
00566 #define SHT_GNU_verdef  0x6ffffffd      /* Version definition section.  */
00567 #define SHT_GNU_verneed 0x6ffffffe      /* Version needs section.  */
00568 #define SHT_GNU_versym  0x6fffffff      /* Version symbol table.  */
00569 #define SHT_HISUNW      0x6fffffff      /* Sun-specific high bound.  */
00570 #define SHT_LOPROC      0x70000000      /* Start of processor-specific */
00571 #define SHT_HIPROC      0x7fffffff      /* End of processor-specific */
00572 #define SHT_LOUSER      0x80000000      /* Start of application-specific */
00573 #define SHT_HIUSER      0x8fffffff      /* End of application-specific */
00574 
00575 /* Legal values for sh_flags (section flags).  */
00576 
00577 #define SHF_WRITE       (1 << 0)        /* Writable */
00578 #define SHF_ALLOC       (1 << 1)        /* Occupies memory during execution */
00579 #define SHF_EXECINSTR   (1 << 2)        /* Executable */
00580 #define SHF_MASKPROC    0xf0000000      /* Processor-specific */
00581 
00582 /* Symbol table entry.  */
00583 
00584 typedef struct
00585 {
00586   Elf32_Word    st_name;                /* Symbol name (string tbl index) */
00587   Elf32_Addr    st_value;               /* Symbol value */
00588   Elf32_Word    st_size;                /* Symbol size */
00589   unsigned char st_info;                /* Symbol type and binding */
00590   unsigned char st_other;               /* No defined meaning, 0 */
00591   Elf32_Section st_shndx;               /* Section index */
00592 } Elf32_Sym;
00593 
00594 typedef struct
00595 {
00596   Elf64_Word    st_name;                /* Symbol name (string tbl index) */
00597   unsigned char st_info;                /* Symbol type and binding */
00598   unsigned char st_other;               /* No defined meaning, 0 */
00599   Elf64_Section st_shndx;               /* Section index */
00600   Elf64_Addr    st_value;               /* Symbol value */
00601   Elf64_Xword   st_size;                /* Symbol size */
00602 } Elf64_Sym;
00603 
00604 /* Special section index.  */
00605 
00606 #define SHN_UNDEF       0               /* No section, undefined symbol.  */
00607 
00608 /* How to extract and insert information held in the st_info field.  */
00609 
00610 #define ELF32_ST_BIND(val)              (((unsigned char) (val)) >> 4)
00611 #define ELF32_ST_TYPE(val)              ((val) & 0xf)
00612 #define ELF32_ST_INFO(bind, type)       (((bind) << 4) + ((type) & 0xf))
00613 
00614 /* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field.  */
00615 #define ELF64_ST_BIND(val)              ELF32_ST_BIND (val)
00616 #define ELF64_ST_TYPE(val)              ELF32_ST_TYPE (val)
00617 #define ELF64_ST_INFO(bind, type)       ELF32_ST_INFO ((bind), (type))
00618 
00619 /* Legal values for ST_BIND subfield of st_info (symbol binding).  */
00620 
00621 #define STB_LOCAL       0               /* Local symbol */
00622 #define STB_GLOBAL      1               /* Global symbol */
00623 #define STB_WEAK        2               /* Weak symbol */
00624 #define STB_NUM         3               /* Number of defined types.  */
00625 #define STB_LOPROC      13              /* Start of processor-specific */
00626 #define STB_HIPROC      15              /* End of processor-specific */
00627 
00628 /* Legal values for ST_TYPE subfield of st_info (symbol type).  */
00629 
00630 #define STT_NOTYPE      0               /* Symbol type is unspecified */
00631 #define STT_OBJECT      1               /* Symbol is a data object */
00632 #define STT_FUNC        2               /* Symbol is a code object */
00633 #define STT_SECTION     3               /* Symbol associated with a section */
00634 #define STT_FILE        4               /* Symbol's name is file name */
00635 #define STT_NUM         5               /* Number of defined types.  */
00636 #define STT_LOPROC      13              /* Start of processor-specific */
00637 #define STT_HIPROC      15              /* End of processor-specific */
00638 
00639 
00640 /* Symbol table indices are found in the hash buckets and chain table
00641    of a symbol hash table section.  This special index value indicates
00642    the end of a chain, meaning no further symbols are found in that bucket.  */
00643 
00644 #define STN_UNDEF       0               /* End of a chain.  */
00645 
00646 
00647 /* Relocation table entry without addend (in section of type SHT_REL).  */
00648 
00649 typedef struct
00650 {
00651   Elf32_Addr    r_offset;               /* Address */
00652   Elf32_Word    r_info;                 /* Relocation type and symbol index */
00653 } Elf32_Rel;
00654 
00655 #if defined(__MIPS_AND_IA64_ELF_H)
00656 #if defined(_MIPSEB)
00657 typedef struct
00658 {
00659   Elf64_Addr    r_offset;
00660   Elf64_Word    r_sym;                  /* Symbol index */
00661   Elf64_Byte    r_ssym;                 /* Special symbol */
00662   Elf64_Byte    r_type3;                /* 3rd relocation op type */
00663   Elf64_Byte    r_type2;                /* 2nd relocation op type */
00664   Elf64_Byte    r_type;                 /* 1st relocation op type */
00665 } Elf64_Rel;
00666 
00667 typedef struct {
00668   Elf64_Addr    r_offset;
00669   Elf64_Word    r_sym;                  /* Symbol index */
00670   Elf64_Byte    r_ssym;                 /* Special symbol */
00671   Elf64_Byte    r_type3;                /* 3rd relocation op type */
00672   Elf64_Byte    r_type2;                /* 2nd relocation op type */
00673   Elf64_Byte    r_type;                 /* 1st relocation op type */
00674   Elf64_Sxword  r_addend;
00675 } Elf64_Rela;
00676 #else /* !defined(_MIPSEB) */
00677 typedef struct
00678 {
00679   Elf64_Addr    r_offset;
00680   Elf64_Byte    r_type;                 /* 1st relocation op type */
00681   Elf64_Byte    r_type2;                /* 2nd relocation op type */
00682   Elf64_Byte    r_type3;                /* 3rd relocation op type */
00683   Elf64_Byte    r_ssym;                 /* Special symbol */
00684   Elf64_Word    r_sym;                  /* Symbol index */
00685 } Elf64_Rel;
00686 
00687 typedef struct {
00688   Elf64_Addr    r_offset;
00689   Elf64_Byte    r_type;                 /* 1st relocation op type */
00690   Elf64_Byte    r_type2;                /* 2nd relocation op type */
00691   Elf64_Byte    r_type3;                /* 3rd relocation op type */
00692   Elf64_Byte    r_ssym;                 /* Special symbol */
00693   Elf64_Word    r_sym;                  /* Symbol index */
00694   Elf64_Sxword  r_addend;
00695 } Elf64_Rela;
00696 #endif /* defined(_MIPSEB) */
00697 typedef struct
00698 {
00699         Elf64_Byte      kind;           /* determines interpretation of the */
00700                                         /* variable part of descriptor      */
00701         Elf64_Byte      size;           /* size of descriptor, incl. header */
00702         Elf64_Section   section;        /* section header index of section  */
00703                                         /* affected, 0 for global options   */
00704         Elf64_Word      info;           /* Kind-specific information        */
00705 } Elf_Options;
00706 
00707 /* Values for the r_ssym field: */
00708 typedef enum {
00709     RSS_UNDEF   = 0,    /* Undefined */
00710     RSS_GP      = 1,    /* Context pointer (gp) value */
00711     RSS_GP0     = 2,    /* gp value used to create object being relocated */
00712     RSS_LOC     = 3     /* Address of location being relocated */
00713 } Elf64_Rel_Ssym;
00714 #else
00715 /* I have seen two different definitions of the Elf64_Rel and
00716    Elf64_Rela structures, so we'll leave them out until Novell (or
00717    whoever) gets their act together.  */
00718 /* The following, at least, is used on Sparc v9, MIPS, and Alpha.  */
00719 
00720 typedef struct
00721 {
00722   Elf64_Addr    r_offset;               /* Address */
00723   Elf64_Xword   r_info;                 /* Relocation type and symbol index */
00724 } Elf64_Rel;
00725 
00726 typedef struct
00727 {
00728   Elf64_Addr    r_offset;               /* Address */
00729   Elf64_Xword   r_info;                 /* Relocation type and symbol index */
00730   Elf64_Sxword  r_addend;               /* Addend */
00731 } Elf64_Rela;
00732 #endif
00733 
00734 /* Relocation table entry with addend (in section of type SHT_RELA).  */
00735 
00736 typedef struct
00737 {
00738   Elf32_Addr    r_offset;               /* Address */
00739   Elf32_Word    r_info;                 /* Relocation type and symbol index */
00740   Elf32_Sword   r_addend;               /* Addend */
00741 } Elf32_Rela;
00742 
00743 /* How to extract and insert information held in the r_info field.  */
00744 
00745 #define ELF32_R_SYM(val)                ((val) >> 8)
00746 #define ELF32_R_TYPE(val)               ((val) & 0xff)
00747 #define ELF32_R_INFO(sym, type)         (((sym) << 8) + ((type) & 0xff))
00748 
00749 #define ELF64_R_SYM(i)                  ((i) >> 32)
00750 #define ELF64_R_TYPE(i)                 ((i) & 0xffffffff)
00751 #define ELF64_R_INFO(sym,type)          (((sym) << 32) + (type))
00752 
00753 /* Program segment header.  */
00754 
00755 typedef struct
00756 {
00757   Elf32_Word    p_type;                 /* Segment type */
00758   Elf32_Off     p_offset;               /* Segment file offset */
00759   Elf32_Addr    p_vaddr;                /* Segment virtual address */
00760   Elf32_Addr    p_paddr;                /* Segment physical address */
00761   Elf32_Word    p_filesz;               /* Segment size in file */
00762   Elf32_Word    p_memsz;                /* Segment size in memory */
00763   Elf32_Word    p_flags;                /* Segment flags */
00764   Elf32_Word    p_align;                /* Segment alignment */
00765 } Elf32_Phdr;
00766 
00767 typedef struct
00768 {
00769   Elf64_Word    p_type;                 /* Segment type */
00770   Elf64_Word    p_flags;                /* Segment flags */
00771   Elf64_Off     p_offset;               /* Segment file offset */
00772   Elf64_Addr    p_vaddr;                /* Segment virtual address */
00773   Elf64_Addr    p_paddr;                /* Segment physical address */
00774   Elf64_Xword   p_filesz;               /* Segment size in file */
00775   Elf64_Xword   p_memsz;                /* Segment size in memory */
00776   Elf64_Xword   p_align;                /* Segment alignment */
00777 } Elf64_Phdr;
00778 
00779 /* Legal values for p_type (segment type).  */
00780 
00781 #define PT_NULL         0               /* Program header table entry unused */
00782 #define PT_LOAD         1               /* Loadable program segment */
00783 #define PT_DYNAMIC      2               /* Dynamic linking information */
00784 #define PT_INTERP       3               /* Program interpreter */
00785 #define PT_NOTE         4               /* Auxiliary information */
00786 #define PT_SHLIB        5               /* Reserved */
00787 #define PT_PHDR         6               /* Entry for header table itself */
00788 #define PT_NUM          7               /* Number of defined types.  */
00789 #define PT_LOPROC       0x70000000      /* Start of processor-specific */
00790 #define PT_HIPROC       0x7fffffff      /* End of processor-specific */
00791 
00792 /* Legal values for p_flags (segment flags).  */
00793 
00794 #define PF_X            (1 << 0)        /* Segment is executable */
00795 #define PF_W            (1 << 1)        /* Segment is writable */
00796 #define PF_R            (1 << 2)        /* Segment is readable */
00797 #define PF_MASKPROC     0xf0000000      /* Processor-specific */
00798 
00799 /* Legal values for note segment descriptor types for core files. */
00800 
00801 #define NT_PRSTATUS     1               /* Contains copy of prstatus struct */
00802 #define NT_FPREGSET     2               /* Contains copy of fpregset struct */
00803 #define NT_PRPSINFO     3               /* Contains copy of prpsinfo struct */
00804 
00805 /* Legal values for the  note segment descriptor types for object files.  */
00806 
00807 #define NT_VERSION      1               /* Contains a version string.  */
00808 
00809 
00810 /* Dynamic section entry.  */
00811 
00812 typedef struct
00813 {
00814   Elf32_Sword   d_tag;                  /* Dynamic entry type */
00815   union
00816     {
00817       Elf32_Word d_val;                 /* Integer value */
00818       Elf32_Addr d_ptr;                 /* Address value */
00819     } d_un;
00820 } Elf32_Dyn;
00821 
00822 typedef struct
00823 {
00824   Elf64_Sxword  d_tag;                  /* Dynamic entry type */
00825   union
00826     {
00827       Elf64_Xword d_val;                /* Integer value */
00828       Elf64_Addr d_ptr;                 /* Address value */
00829     } d_un;
00830 } Elf64_Dyn;
00831 
00832 /* Legal values for d_tag (dynamic entry type).  */
00833 
00834 #define DT_NULL         0               /* Marks end of dynamic section */
00835 #define DT_NEEDED       1               /* Name of needed library */
00836 #define DT_PLTRELSZ     2               /* Size in bytes of PLT relocs */
00837 #define DT_PLTGOT       3               /* Processor defined value */
00838 #define DT_HASH         4               /* Address of symbol hash table */
00839 #define DT_STRTAB       5               /* Address of string table */
00840 #define DT_SYMTAB       6               /* Address of symbol table */
00841 #define DT_RELA         7               /* Address of Rela relocs */
00842 #define DT_RELASZ       8               /* Total size of Rela relocs */
00843 #define DT_RELAENT      9               /* Size of one Rela reloc */
00844 #define DT_STRSZ        10              /* Size of string table */
00845 #define DT_SYMENT       11              /* Size of one symbol table entry */
00846 #define DT_INIT         12              /* Address of init function */
00847 #define DT_FINI         13              /* Address of termination function */
00848 #define DT_SONAME       14              /* Name of shared object */
00849 #define DT_RPATH        15              /* Library search path */
00850 #define DT_SYMBOLIC     16              /* Start symbol search here */
00851 #define DT_REL          17              /* Address of Rel relocs */
00852 #define DT_RELSZ        18              /* Total size of Rel relocs */
00853 #define DT_RELENT       19              /* Size of one Rel reloc */
00854 #define DT_PLTREL       20              /* Type of reloc in PLT */
00855 #define DT_DEBUG        21              /* For debugging; unspecified */
00856 #define DT_TEXTREL      22              /* Reloc might modify .text */
00857 #define DT_JMPREL       23              /* Address of PLT relocs */
00858 #define DT_NUM          24              /* Number used */
00859 #define DT_LOPROC       0x70000000      /* Start of processor-specific */
00860 #define DT_HIPROC       0x7fffffff      /* End of processor-specific */
00861 #define DT_PROCNUM      DT_MIPS_NUM     /* Most used by any processor */
00862 
00863 /* The versioning entry types.  The next are defined as part of the
00864    GNU extension.  */
00865 #define DT_VERSYM       0x6ffffff0
00866 
00867 /* These were chosen by Sun.  */
00868 #define DT_VERDEF       0x6ffffffc      /* Address of version definition
00869                                            table */
00870 #define DT_VERDEFNUM    0x6ffffffd      /* Number of version definitions */
00871 #define DT_VERNEED      0x6ffffffe      /* Address of table with needed
00872                                            versions */
00873 #define DT_VERNEEDNUM   0x6fffffff      /* Number of needed versions */
00874 #define DT_VERSIONTAGIDX(tag)   (DT_VERNEEDNUM - (tag)) /* Reverse order! */
00875 #define DT_VERSIONTAGNUM 16
00876 
00877 /* Sun added these machine-independent extensions in the "processor-specific"
00878    range.  Be compatible.  */
00879 #define DT_AUXILIARY    0x7ffffffd      /* Shared object to load before self */
00880 #define DT_FILTER       0x7fffffff      /* Shared object to get values from */
00881 #define DT_EXTRATAGIDX(tag)     ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)
00882 #define DT_EXTRANUM     3
00883 
00884 /* Version definition sections.  */
00885 
00886 typedef struct
00887 {
00888   Elf32_Half    vd_version;             /* Version revision */
00889   Elf32_Half    vd_flags;               /* Version information */
00890   Elf32_Half    vd_ndx;                 /* Version Index */
00891   Elf32_Half    vd_cnt;                 /* Number of associated aux entries */
00892   Elf32_Word    vd_hash;                /* Version name hash value */
00893   Elf32_Word    vd_aux;                 /* Offset in bytes to verdaux array */
00894   Elf32_Word    vd_next;                /* Offset in bytes to next verdef
00895                                            entry */
00896 } Elf32_Verdef;
00897 
00898 /* Legal values for vd_version (version revision).  */
00899 #define VER_DEF_NONE    0               /* No version */
00900 #define VER_DEF_CURRENT 1               /* Current version */
00901 #define VER_DEF_NUM     2               /* Given version number */
00902 
00903 /* Legal values for vd_flags (version information flags).  */
00904 #define VER_FLG_BASE    0x1             /* Version definition of file itself */
00905 #define VER_FLG_WEAK    0x2             /* Weak version identifier */
00906 
00907 /* Auxialiary version information.  */
00908 
00909 typedef struct
00910 {
00911   Elf32_Addr    vda_name;               /* Version or dependency names */
00912   Elf32_Word    vda_next;               /* Offset in bytes to next verdaux
00913                                            entry */
00914 } Elf32_Verdaux;
00915 
00916 /* Version dependency section.  */
00917 
00918 typedef struct
00919 {
00920   Elf32_Half    vn_version;             /* Version of structure */
00921   Elf32_Half    vn_cnt;                 /* Number of associated aux entries */
00922   Elf32_Addr    vn_file;                /* Offset of filename for this
00923                                            dependency */
00924   Elf32_Word    vn_aux;                 /* Offset in bytes to vernaux array */
00925   Elf32_Word    vn_next;                /* Offset in bytes to next verneed
00926                                            entry */
00927 } Elf32_Verneed;
00928 
00929 /* Legal values for vn_version (version revision).  */
00930 #define VER_NEED_NONE    0              /* No version */
00931 #define VER_NEED_CURRENT 1              /* Current version */
00932 #define VER_NEED_NUM     2              /* Given version number */
00933 
00934 /* Auxiliary needed version information.  */
00935 
00936 typedef struct
00937 {
00938   Elf32_Word    vna_hash;               /* Hash value of dependency name */
00939   Elf32_Half    vna_flags;              /* Dependency specific information */
00940   Elf32_Half    vna_other;              /* Unused */
00941   Elf32_Addr    vna_name;               /* Dependency name string offset */
00942   Elf32_Word    vna_next;               /* Offset in bytes to next vernaux
00943                                            entry */
00944 } Elf32_Vernaux;
00945 
00946 /* Legal values for vna_flags.  */
00947 #define VER_FLG_WEAK    0x2             /* Weak verison identifier */
00948 
00949 
00950 /* Auxiliary vector.  */
00951 
00952 /* This vector is normally only used by the program interpreter.  The
00953    usual definition in an ABI supplement uses the name auxv_t.  The
00954    vector is not usually defined in a standard <elf.h> file, but it
00955    can't hurt.  We rename it to avoid conflicts.  The sizes of these
00956    types are an arrangement between the exec server and the program
00957    interpreter, so we don't fully specify them here.  */
00958 
00959 typedef struct
00960 {
00961   int a_type;                   /* Entry type */
00962   union
00963     {
00964       long int a_val;           /* Integer value */
00965       void *a_ptr;              /* Pointer value */
00966       void (*a_fcn) (void);     /* Function pointer value */
00967     } a_un;
00968 } Elf32_auxv_t;
00969 
00970 typedef struct
00971 {
00972   long int a_type;              /* Entry type */
00973   union
00974     {
00975       long int a_val;           /* Integer value */
00976       void *a_ptr;              /* Pointer value */
00977       void (*a_fcn) (void);     /* Function pointer value */
00978     } a_un;
00979 } Elf64_auxv_t;
00980 
00981 /* Legal values for a_type (entry type).  */
00982 
00983 #define AT_NULL         0               /* End of vector */
00984 #define AT_IGNORE       1               /* Entry should be ignored */
00985 #define AT_EXECFD       2               /* File descriptor of program */
00986 #define AT_PHDR         3               /* Program headers for program */
00987 #define AT_PHENT        4               /* Size of program header entry */
00988 #define AT_PHNUM        5               /* Number of program headers */
00989 #define AT_PAGESZ       6               /* System page size */
00990 #define AT_BASE         7               /* Base address of interpreter */
00991 #define AT_FLAGS        8               /* Flags */
00992 #define AT_ENTRY        9               /* Entry point of program */
00993 #define AT_NOTELF       10              /* Program is not ELF */
00994 #define AT_UID          11              /* Real uid */
00995 #define AT_EUID         12              /* Effective uid */
00996 #define AT_GID          13              /* Real gid */
00997 #define AT_EGID         14              /* Effective gid */
00998 
00999 /* Motorola 68k specific definitions.  */
01000 
01001 /* m68k relocs.  */
01002 
01003 #define R_68K_NONE      0               /* No reloc */
01004 #define R_68K_32        1               /* Direct 32 bit  */
01005 #define R_68K_16        2               /* Direct 16 bit  */
01006 #define R_68K_8         3               /* Direct 8 bit  */
01007 #define R_68K_PC32      4               /* PC relative 32 bit */
01008 #define R_68K_PC16      5               /* PC relative 16 bit */
01009 #define R_68K_PC8       6               /* PC relative 8 bit */
01010 #define R_68K_GOT32     7               /* 32 bit PC relative GOT entry */
01011 #define R_68K_GOT16     8               /* 16 bit PC relative GOT entry */
01012 #define R_68K_GOT8      9               /* 8 bit PC relative GOT entry */
01013 #define R_68K_GOT32O    10              /* 32 bit GOT offset */
01014 #define R_68K_GOT16O    11              /* 16 bit GOT offset */
01015 #define R_68K_GOT8O     12              /* 8 bit GOT offset */
01016 #define R_68K_PLT32     13              /* 32 bit PC relative PLT address */
01017 #define R_68K_PLT16     14              /* 16 bit PC relative PLT address */
01018 #define R_68K_PLT8      15              /* 8 bit PC relative PLT address */
01019 #define R_68K_PLT32O    16              /* 32 bit PLT offset */
01020 #define R_68K_PLT16O    17              /* 16 bit PLT offset */
01021 #define R_68K_PLT8O     18              /* 8 bit PLT offset */
01022 #define R_68K_COPY      19              /* Copy symbol at runtime */
01023 #define R_68K_GLOB_DAT  20              /* Create GOT entry */
01024 #define R_68K_JMP_SLOT  21              /* Create PLT entry */
01025 #define R_68K_RELATIVE  22              /* Adjust by program base */
01026 #define R_68K_NUM       23
01027 
01028 /* Intel 80386 specific definitions.  */
01029 
01030 /* i386 relocs.  */
01031 
01032 #define R_386_NONE      0               /* No reloc */
01033 #define R_386_32        1               /* Direct 32 bit  */
01034 #define R_386_PC32      2               /* PC relative 32 bit */
01035 #define R_386_GOT32     3               /* 32 bit GOT entry */
01036 #define R_386_PLT32     4               /* 32 bit PLT address */
01037 #define R_386_COPY      5               /* Copy symbol at runtime */
01038 #define R_386_GLOB_DAT  6               /* Create GOT entry */
01039 #define R_386_JMP_SLOT  7               /* Create PLT entry */
01040 #define R_386_RELATIVE  8               /* Adjust by program base */
01041 #define R_386_GOTOFF    9               /* 32 bit offset to GOT */
01042 #define R_386_GOTPC     10              /* 32 bit PC relative offset to GOT */
01043 #define R_386_NUM       11
01044 
01045 /* Intel IA64 specific definitions. */
01046 enum {
01047 
01048 /*----------------------------------------------------------------------------
01049  *  Relocation TYPE     = value   Field                 Calculation
01050  *----------------------------------------------------------------------------
01051  */
01052 
01053     R_IA_64_NONE        = 0x00, /* None                 None            */
01054 
01055     /* unused:  0x01 .. 0x20                                            */
01056 
01057     R_IA_64_IMM14       = 0x21, /* instr: immediate14   S+A             */
01058     R_IA_64_IMM22       = 0x22, /* instr: immediate22   S+A             */
01059     R_IA_64_IMM64       = 0x23, /* instr: immediate64   S+A             */
01060     R_IA_64_DIR32MSB    = 0x24, /* word32 MSB           S+A             */
01061     R_IA_64_DIR32LSB    = 0x25, /* word32 LSB           S+A             */
01062     R_IA_64_DIR64MSB    = 0x26, /* word64 MSB           S+A             */
01063     R_IA_64_DIR64LSB    = 0x27, /* word64 LSB           S+A             */
01064 
01065     /* unused:  0x28 .. 0x29                                            */
01066 
01067     R_IA_64_GPREL22     = 0x2a, /* instr: immediate22   @gprel(S+A)     */
01068     R_IA_64_GPREL64I    = 0x2b, /* instr: immediate64   @gprel(S+A)     */
01069 
01070     /* unused:  0x2c .. 0x2d                                            */
01071 
01072     R_IA_64_GPREL64MSB  = 0x2e, /* word64 MSB           @gprel(S+A)     */
01073     R_IA_64_GPREL64LSB  = 0x2f, /* word64 LSB           @gprel(S+A)     */
01074 
01075     /* unused:  0x30 .. 0x31                                            */
01076 
01077     R_IA_64_LTOFF22     = 0x32, /* instr: immediate22   @ltoff(S+A)     */
01078     R_IA_64_LTOFF64I    = 0x33, /* instr: immediate64   @ltoff(S+A)     */
01079 
01080     /* unused:  0x34 .. 0x39                                            */
01081 
01082     R_IA_64_PLTOFF22    = 0x3a, /* instr: immediate22   @pltoff(S+A)    */
01083     R_IA_64_PLTOFF64I   = 0x3b, /* instr: immediate64   @pltoff(S+A)    */
01084 
01085     /* unused:  0x3c .. 0x3d                                            */
01086 
01087     R_IA_64_PLTOFF64MSB = 0x3e, /* word64 MSB           @pltoff(S+A)    */
01088     R_IA_64_PLTOFF64LSB = 0x3f, /* wordL4 MSB           @pltoff(S+A)    */
01089 
01090     /* unused:  0x40 .. 0x42                                            */
01091 
01092     R_IA_64_FPTR64I     = 0x43, /* instr: immediate64   @fptr(S+A)      */
01093     R_IA_64_FPTR32MSB   = 0x44, /* word32 MSB           @fptr(S+A)      */
01094     R_IA_64_FPTR32LSB   = 0x45, /* word32 LSB           @fptr(S+A)      */
01095     R_IA_64_FPTR64MSB   = 0x46, /* word64 MSB           @fptr(S+A)      */
01096     R_IA_64_FPTR64LSB   = 0x47, /* word64 LSB           @fptr(S+A)      */
01097 
01098     /* unused:  0x48 .. 0x48                                            */
01099 
01100     R_IA_64_PCREL21B    = 0x49, /* instr: imm21 (form1) S+A-P           */
01101     R_IA_64_PCREL21M    = 0x4a, /* instr: imm21 (form2) S+A-P           */
01102     R_IA_64_PCREL21F    = 0x4b, /* instr: imm21 (form3) S+A-P           */
01103     R_IA_64_PCREL32MSB  = 0x4c, /* word32 MSB           S+A-P           */
01104     R_IA_64_PCREL32LSB  = 0x4d, /* word32 LSB           S+A-P           */
01105     R_IA_64_PCREL64MSB  = 0x4e, /* word64 MSB           S+A-P           */
01106     R_IA_64_PCREL64LSB  = 0x4f, /* word64 LSB           S+A-P           */
01107 
01108     /* unused:  0x50 .. 0x51                                            */
01109 
01110     R_IA_64_LTOFF_FPTR22 = 0x52,/* instr: immediate22   @ltoff(@fptr(S+A)) */
01111     R_IA_64_LTOFF_FPTR64I= 0x53,/* instr: immediate64   @ltoff(@fptr(S+A)) */
01112 
01113     /* unused:  0x54 .. 0x5b                                            */
01114 
01115     R_IA_64_SEGREL32MSB = 0x5c, /* word32 MSB           @segrel(S+A)    */
01116     R_IA_64_SEGREL32LSB = 0x5d, /* word32 LSB           @segrel(S+A)    */
01117     R_IA_64_SEGREL64MSB = 0x5e, /* word64 MSB           @segrel(S+A)    */
01118     R_IA_64_SEGREL64LSB = 0x5f, /* word64 LSB           @segrel(S+A)    */
01119 
01120     /* unused:  0x60 .. 0x63                                            */
01121 
01122     R_IA_64_SECREL32MSB = 0x64, /* word32 MSB           @secrel(S+A)    */
01123     R_IA_64_SECREL32LSB = 0x65, /* word32 LSB           @secrel(S+A)    */
01124     R_IA_64_SECREL64MSB = 0x66, /* word64 MSB           @secrel(S+A)    */
01125     R_IA_64_SECREL64LSB = 0x67, /* word64 LSB           @secrel(S+A)    */
01126 
01127     /* unused:  0x68 .. 0x6b                                            */
01128 
01129     R_IA_64_REL32MSB    = 0x6c, /* word32 MSB           BD+C            */
01130     R_IA_64_REL32LSB    = 0x6d, /* word32 LSB           BD+C            */
01131     R_IA_64_REL64MSB    = 0x6e, /* word64 MSB           BD+C            */
01132     R_IA_64_REL64LSB    = 0x6f, /* word64 LSB           BD+C            */
01133     R_IA_64_LTV32MSB    = 0x70, /* word32 MSB           S+A [note 2]    */
01134     R_IA_64_LTV32LSB    = 0x71, /* word32 LSB           S+A [note 2]    */
01135     R_IA_64_LTV64MSB    = 0x72, /* word64 MSB           S+A [note 2]    */
01136     R_IA_64_LTV64LSB    = 0x73, /* word64 LSB           S+A [note 2]    */
01137 
01138     /* unused:  0x74 .. 0x7f                                            */
01139 
01140     R_IA_64_IPLTMSB     = 0x80, /* func desc MSB        [note 3]        */
01141     R_IA_64_IPLTLSB     = 0x81, /* func desc LSB        [note 3]        */
01142 
01143     /* unused:  0x82 .. 0xff                                            */
01144 
01145     R_IA_64_END_        = 0x82  /* R_IA_64_END_ is not a relocation type.
01146                                  * It marks the end of the list of types.
01147                                  */
01148 }; 
01149 
01150 /* SUN SPARC specific definitions.  */
01151 
01152 /* SPARC relocs.  */
01153 
01154 #define R_SPARC_NONE    0               /* No reloc */
01155 #define R_SPARC_8       1               /* Direct 8 bit */
01156 #define R_SPARC_16      2               /* Direct 16 bit */
01157 #define R_SPARC_32      3               /* Direct 32 bit */
01158 #define R_SPARC_DISP8   4               /* PC relative 8 bit */
01159 #define R_SPARC_DISP16  5               /* PC relative 16 bit */
01160 #define R_SPARC_DISP32  6               /* PC relative 32 bit */
01161 #define R_SPARC_WDISP30 7               /* PC relative 30 bit shifted */
01162 #define R_SPARC_WDISP22 8               /* PC relative 22 bit shifted */
01163 #define R_SPARC_HI22    9               /* High 22 bit */
01164 #define R_SPARC_22      10              /* Direct 22 bit */
01165 #define R_SPARC_13      11              /* Direct 13 bit */
01166 #define R_SPARC_LO10    12              /* Truncated 10 bit */
01167 #define R_SPARC_GOT10   13              /* Truncated 10 bit GOT entry */
01168 #define R_SPARC_GOT13   14              /* 13 bit GOT entry */
01169 #define R_SPARC_GOT22   15              /* 22 bit GOT entry shifted */
01170 #define R_SPARC_PC10    16              /* PC relative 10 bit truncated */
01171 #define R_SPARC_PC22    17              /* PC relative 22 bit shifted */
01172 #define R_SPARC_WPLT30  18              /* 30 bit PC relative PLT address */
01173 #define R_SPARC_COPY    19              /* Copy symbol at runtime */
01174 #define R_SPARC_GLOB_DAT 20             /* Create GOT entry */
01175 #define R_SPARC_JMP_SLOT 21             /* Create PLT entry */
01176 #define R_SPARC_RELATIVE 22             /* Adjust by program base */
01177 #define R_SPARC_UA32    23              /* Direct 32 bit unaligned */
01178 #define R_SPARC_NUM     24
01179 
01180 /* MIPS R3000 specific definitions.  */
01181 
01182 /* Legal values for e_flags field of Elf32_Ehdr.  */
01183 
01184 #define EF_MIPS_NOREORDER 1             /* A .noreorder directive was used */
01185 #define EF_MIPS_PIC       2             /* Contains PIC code */
01186 #define EF_MIPS_CPIC      4             /* Uses PIC calling sequence */
01187 #define EF_MIPS_ARCH      0xf0000000    /* MIPS architecture level */
01188 
01189 #if defined(__MIPS_AND_IA64_ELF_H)
01190 /*
01191  *  Temporary version number for formats prior to formal release.
01192  *  e_ident[EI_TVERSION]
01193  */
01194 #define EI_TVERSION 15
01195 #define EV_T_CURRENT 1
01196 
01197 #define EF_IRIX_ABI64           0x00000010      
01198         /* If the bit is set   (1) then this is a 64bit ABI file
01199          * If the bit is clear (0) then this is a 32bit ABI file.
01200          *
01201          * If set, this is a 64bit ABI elf file using a LP64 data model.
01202          * And if this is a WHIRL file, (ie. e_type == ET_IR) then this 
01203          * holds 64bit-format WHIRL code.
01204          *
01205          * Similarly, if not set, this is a 32bit ABI elf file using a ILP32 
01206          * data model.  And if it is a WHIRL file, (ie. e_type == ET_IR) this 
01207          * holds 32bit format WHIRL code.
01208          *
01209          * NOTE: In the past, we implied 32bit ABI vs. 64bit ABI from
01210          * the value of the ELFCLASS32 or ELFCLASS64.  
01211          */
01212 #define EF_MIPS_OPSEX           EF_MIPS_NOREORDER
01213 #define EF_MIPS_XGOT            0x00000008
01214 #define EF_MIPS_OPTIONS_FIRST   0x00000080 
01215 /* obsolete names */
01216 #define EF_MIPS_UGEN_ALLOC      EF_MIPS_XGOT
01217 #define EF_MIPS_UGEN_RESERVED   EF_MIPS_64BIT_WHIRL
01218 
01219 #define EF_MIPS_ABI64           EF_IRIX_ABI64
01220         /* see explanation above for EF_IRIX_ABI64 */
01221 
01222 #define EF_MIPS_64BIT_WHIRL     EF_MIPS_ABI64
01223         /* This is here for compatibility with pre-v7.4 compiler objects. */
01224 
01225 #define EF_MIPS_ABI2            0x00000020 
01226         /* indicates n32 as opposed to o32 */
01227 
01228 /*
01229  *      The EF_MIPS_ARCH field of e_flags describes the ISA of the object.
01230  *              size:   4 bits
01231  *              type:   int
01232  */
01233 #define EF_MIPS_ARCH            0xf0000000      /* mask: 4 bit field */
01234 #define EF_MIPS_ARCH_1          0x00000000
01235 #define EF_MIPS_ARCH_2          0x10000000
01236 #define EF_MIPS_ARCH_3          0x20000000
01237 #define EF_MIPS_ARCH_4          0x30000000
01238 #define EF_MIPS_ARCH_5          0x40000000
01239 #define EF_MIPS_ARCH_6          0x50000000
01240 
01241 /*
01242  *      The EF_MIPS_ARCH_ASE field of e_flags describes the set of 
01243  *      Application Specific Extensions used by the object.
01244  *              size:   4 bits
01245  *              type:   bit-field
01246  */
01247 #define EF_MIPS_ARCH_ASE        0x0f000000      /* mask: 4 bit field    */
01248 #define EF_MIPS_ARCH_ASE_MDMX   0x08000000      /* multi-media extensions*/
01249 #define EF_MIPS_ARCH_ASE_M16    0x04000000      /* MIPS16 isa extensions */
01250 
01251 /*
01252  *      Please reserve these 8 bits of e_flags for future
01253  *      expansion of the EF_MIPS_ARCH_ASE field;  increasing
01254  *      the field from 4 bits to 12 bits.
01255  *      
01256  *              0x00ff0000      
01257  *      
01258  *      If and when we expand it, we'll redefine the EF_MIPS_ARCH_ASE 
01259  *      macro to be:
01260  *      
01261  *              0x0fff0000.
01262  */
01263 
01264 /*
01265  * e_flags -- used by Irix on Intel
01266  */
01267 #define EF_IA64_PIC             0x00000002
01268         /* Uses PIC calling conventions.  This code can be part of
01269          * either an a.out or a dso.
01270          */
01271 
01272 #define EF_IA64_CPIC            0x00000004
01273         /* Uses CPIC (ie. Call PIC) calling conventions.  
01274          * This is not currently used in Irix/ia64, but we'll reserve
01275          * the bit for future use.
01276          */
01277 
01278 #define EF_IA64_ARCH            0xff000000
01279         /* Reserved by Intel for architecture version identifier.
01280          * Intended to indicate the minimum level of the architecture
01281          * required by the object code.  Currently, the only valid
01282          * value for this field is 0x00 
01283          */
01284 #define EF_IA64_ABI64           EF_IRIX_ABI64   /* 0x00000010           */
01285         /* If the bit is set   (1) then this is a 64bit ABI file
01286          * If the bit is clear (0) then this is a 32bit ABI file.
01287          * See explanation in /usr/include/sys/elf.h
01288          */
01289 
01290 /* 
01291  * Random constants
01292  */
01293 
01294 #define _TEXT_ALIGN 0x10000
01295 #define _DATA_ALIGN 0x10000
01296 #define ELF_IRIX_MAXPGSZ (64*1024)
01297 #define ELF_IRIX_MINPGSZ (0x1000)
01298 
01299 #define ELF_IA64_MAXPGSZ ELF_IRIX_MAXPGSZ
01300 #define ELF_IA64_MINPGSZ ELF_IRIX_MINPGSZ
01301 
01302 #define ELF_MIPS_MAXPGSZ ELF_IRIX_MAXPGSZ
01303 #define ELF_MIPS_MINPGSZ ELF_IRIX_MINPGSZ
01304 
01305 typedef struct
01306 {
01307         Elf64_Word      l_name;
01308         Elf64_Word      l_time_stamp;
01309         Elf64_Word      l_checksum;
01310         Elf64_Word      l_version;
01311         Elf64_Word      l_flags;
01312 } Elf64_Lib;
01313 #endif
01314 
01315 /* Legal values for MIPS architecture level.  */
01316 
01317 #define E_MIPS_ARCH_1     0x00000000    /* -mips1 code.  */
01318 #define E_MIPS_ARCH_2     0x10000000    /* -mips2 code.  */
01319 #define E_MIPS_ARCH_3     0x20000000    /* -mips3 code.  */
01320 
01321 /* 
01322  * special p_flags
01323  */
01324 
01325 #define PF_MIPS_LOCAL           0x10000000
01326 
01327 /* Special section indices.  */
01328 
01329 #define SHN_MIPS_ACOMMON 0xff00         /* Allocated common symbols */
01330 #define SHN_MIPS_TEXT    0xff01         /* Allocated test symbols.  */
01331 #define SHN_MIPS_DATA    0xff02         /* Allocated data symbols.  */
01332 #define SHN_MIPS_SCOMMON 0xff03         /* Small common symbols */
01333 #define SHN_MIPS_SUNDEFINED 0xff04      /* Small undefined symbols */
01334 
01335 /* Legal values for sh_type field of Elf32_Shdr.  */
01336 
01337 #define SHT_MIPS_LIBLIST  0x70000000    /* Shared objects used in link */
01338 #define SHT_MIPS_CONFLICT 0x70000002    /* Conflicting symbols */
01339 #define SHT_MIPS_GPTAB    0x70000003    /* Global data area sizes */
01340 #define SHT_MIPS_UCODE    0x70000004    /* Reserved for SGI/MIPS compilers */
01341 #define SHT_MIPS_DEBUG    0x70000005    /* MIPS ECOFF debugging information */
01342 #define SHT_MIPS_REGINFO  0x70000006    /* Register usage information */
01343 #define SHT_MIPS_OPTIONS  0x7000000d    /* Miscellaneous options.  */
01344 #define SHT_MIPS_DWARF    0x7000001e    /* DWARF debugging information.  */
01345 #define SHT_MIPS_EVENTS   0x70000021    /* Event section.  */
01346 #define SHT_MIPS_XLATE    0x70000024
01347 #define SHT_MIPS_XLATE_DEBUG 0x70000025
01348 #define SHT_MIPS_WHIRL       0x70000026
01349 #define SHT_MIPS_XLATE_OLD   0x70000028
01350 
01351 /* Legal values for sh_flags field of Elf32_Shdr.  */
01352 
01353 #define SHF_MIPS_GPREL  0x10000000      /* Must be part of global data area */
01354 
01355 #if defined(__MIPS_AND_IA64_ELF_H)
01356 #define SHT_IRIX_LIBLIST        (SHT_LOPROC + 0)
01357 #define SHT_IRIX_MSYM           (SHT_LOPROC + 1)
01358 #define SHT_IRIX_CONFLICT       (SHT_LOPROC + 2)
01359 #define SHT_IRIX_GPTAB          (SHT_LOPROC + 3)
01360 #define SHT_IRIX_UCODE          (SHT_LOPROC + 4)
01361 #define SHT_IRIX_DEBUG          (SHT_LOPROC + 5)
01362 #define SHT_IRIX_REGINFO        (SHT_LOPROC + 6)
01363 
01364 #ifdef __osf__
01365 #define SHT_IRIX_PACKAGE        (SHT_LOPROC + 7)
01366 #define SHT_IRIX_PACKSYM        (SHT_LOPROC + 8)
01367 #endif /* __osf__ */
01368 
01369 #define SHT_IRIX_RELD           (SHT_LOPROC + 9)
01370 #define SHT_IRIX_DONTUSE        (SHT_LOPROC + 10)
01371 
01372 #define SHT_IRIX_IFACE          (SHT_LOPROC + 11)
01373 #define SHT_IRIX_CONTENT        (SHT_LOPROC + 12)
01374 #define SHT_IRIX_OPTIONS        (SHT_LOPROC + 13)
01375 
01376 #define SHT_IRIX_SHDR           (SHT_LOPROC + 16)
01377 #define SHT_IRIX_FDESC          (SHT_LOPROC + 17)
01378 #define SHT_IRIX_EXTSYM         (SHT_LOPROC + 18)
01379 #define SHT_IRIX_DENSE          (SHT_LOPROC + 19)
01380 #define SHT_IRIX_PDESC          (SHT_LOPROC + 20)
01381 #define SHT_IRIX_LOCSYM         (SHT_LOPROC + 21)
01382 #define SHT_IRIX_AUXSYM         (SHT_LOPROC + 22)
01383 #define SHT_IRIX_OPTSYM         (SHT_LOPROC + 23)
01384 #define SHT_IRIX_LOCSTR         (SHT_LOPROC + 24)
01385 #define SHT_IRIX_LINE           (SHT_LOPROC + 25)
01386 #define SHT_IRIX_RFDESC         (SHT_LOPROC + 26)
01387 
01388 #define SHT_IRIX_DELTASYM       (SHT_LOPROC + 27)
01389 #define SHT_IRIX_DELTAINST      (SHT_LOPROC + 28)
01390 #define SHT_IRIX_DELTACLASS     (SHT_LOPROC + 29)
01391 
01392 #define SHT_IRIX_DWARF          (SHT_LOPROC + 30)
01393 #define SHT_IRIX_DELTADECL      (SHT_LOPROC + 31)
01394 #define SHT_IRIX_SYMBOL_LIB     (SHT_LOPROC + 32)
01395 #define SHT_IRIX_EVENTS         (SHT_LOPROC + 33)
01396 #define SHT_IRIX_TRANSLATE      (SHT_LOPROC + 34)
01397 #define SHT_IRIX_PIXIE          (SHT_LOPROC + 35)
01398 #define SHT_IRIX_XLATE          (SHT_LOPROC + 36)
01399 #define SHT_IRIX_XLATE_DEBUG    (SHT_LOPROC + 37)
01400 #define SHT_IRIX_WHIRL          (SHT_LOPROC + 38)
01401 #define SHT_IRIX_EH_REGION      (SHT_LOPROC + 39)
01402 #define SHT_IRIX_XLATE_OLD      (SHT_LOPROC + 40)
01403 #define SHT_IRIX_PDR_EXCEPTION  (SHT_LOPROC + 41)
01404 
01405 /* The next five section types are valid only on irix/ia64  */
01406 #define SHT_IRIX_EXT            (SHT_LOPROC + 42)
01407 #define SHT_IRIX_UNWIND         (SHT_LOPROC + 43)
01408 #define SHT_IRIX_UNWIND_INFO    (SHT_LOPROC + 44)
01409 #define SHT_IRIX_PLT            (SHT_LOPROC + 45)
01410 #define SHT_IRIX_PLTOFF         (SHT_LOPROC + 46)
01411 #define SHT_IA64_UNWIND         SHT_IRIX_UNWIND         
01412 #define SHT_IA64_UNWIND_INFO    SHT_IRIX_UNWIND_INFO    
01413 #define SHT_IA64_OPTIONS        SHT_IRIX_OPTIONS
01414 
01415 
01416 #define SHT_IRIX_NUM            47
01417         /* SHT_IRIX_NUM is one more than the highest offset to SHT_LOCPROC;
01418          * it is the number of extensions, but is *NOT* a section type.
01419          */
01420 
01421 #define SHT_MIPS_MSYM           SHT_IRIX_MSYM
01422 #define SHT_MIPS_CONTENT        SHT_IRIX_CONTENT
01423 
01424 #define SHT_MIPS_DELTADECL      SHT_IRIX_DELTADECL
01425 #define SHT_MIPS_SYMBOL_LIB     SHT_IRIX_SYMBOL_LIB
01426 #define SHT_MIPS_TRANSLATE      SHT_IRIX_TRANSLATE
01427 #define SHT_MIPS_PIXIE          SHT_IRIX_PIXIE
01428 #define SHT_MIPS_EH_REGION      SHT_IRIX_EH_REGION
01429 #define SHT_MIPS_PDR_EXCEPTION  SHT_IRIX_PDR_EXCEPTION
01430 
01431 #define SHT_MIPS_SHDR           SHT_IRIX_SHDR
01432 #define SHT_MIPS_FDESC          SHT_IRIX_FDESC
01433 #define SHT_MIPS_EXTSYM         SHT_IRIX_EXTSYM
01434 #define SHT_MIPS_DENSE          SHT_IRIX_DENSE
01435 #define SHT_MIPS_PDESC          SHT_IRIX_PDESC
01436 #define SHT_MIPS_LOCSYM         SHT_IRIX_LOCSYM
01437 #define SHT_MIPS_AUXSYM         SHT_IRIX_AUXSYM
01438 #define SHT_MIPS_OPTSYM         SHT_IRIX_OPTSYM
01439 #define SHT_MIPS_LOCSTR         SHT_IRIX_LOCSTR
01440 #define SHT_MIPS_LINE           SHT_IRIX_LINE
01441 #define SHT_MIPS_RFDESC         SHT_IRIX_RFDESC
01442 
01443 #define SHT_MIPS_DONTUSE        SHT_IRIX_DONTUSE
01444 
01445 /*
01446  * sh_flags
01447  *
01448  *      We'll try and use the same flags for both irix/mips and irix/ia64.
01449  *      If this ever becomes a problem, we'll have to split them into
01450  *      two different namespaces.
01451  */
01452 #define SHF_IRIX_GPREL          0x10000000
01453 #define SHF_IRIX_MERGE          0x20000000
01454 #define SHF_IRIX_ADDR           0x40000000      /* Reserved for future  */
01455 #define SHF_IRIX_STRINGS        0x80000000      /* Reserved for future  */
01456 #define SHF_IRIX_NOSTRIP        0x08000000
01457 #define SHF_IRIX_LOCAL          0x04000000
01458 #define SHF_IRIX_NAMES          0x02000000      /* Reserved for future  */
01459 #define SHF_IRIX_NODUPE         0x01000000      /* Reserved for future  */
01460 
01461 #define SHF_MIPS_MERGE          SHF_IRIX_MERGE
01462 #define SHF_MIPS_ADDR           SHF_IRIX_ADDR
01463 #define SHF_MIPS_STRINGS        SHF_IRIX_STRINGS
01464 #define SHF_MIPS_NOSTRIP        SHF_IRIX_NOSTRIP
01465 #define SHF_MIPS_LOCAL          SHF_IRIX_LOCAL
01466 #define SHF_MIPS_NAMES          SHF_IRIX_NAMES
01467 #define SHF_MIPS_NODUPE         SHF_IRIX_NODUPE
01468 
01469 #define SHT_MIPS_IFACE          SHT_IRIX_IFACE
01470 
01471 /* ====================================================================
01472  *
01473  * Symbol table
01474  *
01475  * ====================================================================
01476  */
01477 
01478 /*
01479  * Special Irix st_other
01480  */
01481 #define STO_DEFAULT             0x0
01482 #define STO_INTERNAL            0x1
01483 #define STO_HIDDEN              0x2
01484 #define STO_PROTECTED           0x3
01485 #define STO_OPTIONAL            0x4
01486 #define STO_SC_ALIGN_UNUSED     0xff    /* No longer used               */
01487 
01488 /*
01489  * Special Irix st_info
01490  */
01491 #define STB_SPLIT_COMMON        (STB_LOPROC+0)
01492 
01493 /* ====================================================================
01494  *
01495  * Section Headers
01496  *
01497  * ====================================================================
01498  */
01499 
01500 /* 
01501  * Special Irix section indices
01502  */
01503 
01504 #define SHN_IRIX_ACOMMON        (SHN_LOPROC + 0)
01505 #define SHN_IRIX_TEXT           (SHN_LOPROC + 1)
01506 #define SHN_IRIX_DATA           (SHN_LOPROC + 2)
01507 #define SHN_IRIX_SCOMMON        (SHN_LOPROC + 3)
01508 #define SHN_IRIX_SUNDEFINED     (SHN_LOPROC + 4)
01509 #define SHN_IRIX_LCOMMON        (SHN_LOPROC + 5)
01510 #define SHN_IRIX_LUNDEFINED     (SHN_LOPROC + 6)
01511 
01512 /* 
01513  * Special mips section indices
01514  */
01515 
01516 #define SHN_MIPS_LCOMMON        SHN_IRIX_LCOMMON
01517 #define SHN_MIPS_LUNDEFINED     SHN_IRIX_LUNDEFINED
01518 
01519 
01520 /* Event kind -- valid for ELF-32 and ELF-64: */
01521 typedef enum {
01522     EK_NULL = 0x00,         /* No valid information */
01523     EK_ADDR_RESET = 0x01,   /* Reset offset into associated text section */
01524     EK_INCR_LOC_EXT = 0x02, /* Increment offset into associated text section */
01525     EK_ENTRY = 0x03,        /* Subprogram entrypoint */
01526     EK_IF_ENTRY = 0x04,     /* Subprogram entrypoint with associated interface offset */
01527     EK_EXIT = 0x05,         /* Subprogram exit */
01528     EK_PEND = 0x06,         /* Subprogram end (last instruction) */
01529 
01530     EK_SWITCH_32 = 0x7,     /* jr for switch stmt, table entries are 32bit */
01531     EK_SWITCH_64 = 0x8,     /* jr for switch stmt, table entries are 64bit */
01532     EK_DUMMY = 0x09,        /* empty slot */
01533 
01534     EK_BB_START = 0x0a,     /* Basic block beginning */
01535     EK_INCR_LOC_UNALIGNED = 0x0b,    /* Increment unaligned byte offset */
01536     EK_GP_PROLOG_HI = 0x0c, /* Establish high 16bits of GP */
01537     EK_GP_PROLOG_LO = 0x0d, /* Establish low 16bits of GP */
01538     EK_GOT_PAGE = 0x0e,     /* Compact relocation: GOT page pointer */
01539     EK_GOT_OFST = 0x0f,     /* Compact relocation: GOT page offset */
01540     EK_HI = 0x10,           /* Compact relocation: high 16bits of abs. addr */
01541     EK_LO = 0x11,           /* Compact relocation: low 16bits of abs. addr */
01542     EK_64_HIGHEST = 0x12,   /* Compact relocation: most significant 16 bits
01543                                of a 64bit absolute address */
01544     EK_64_HIGHER = 0x13,    /* Compact relocation: second most significant
01545                                16 bits of a 64bit absolute address */
01546     EK_64_HIGH = 0x14,      /* Compact relocation: third most significant
01547                                16 bits of a 64bit absolute address */
01548     EK_64_LOW = 0x15,       /* Compact relocation: least significant 16 bits
01549                                of a 64bit absolute address */
01550     EK_GPREL = 0x16,        /* Compact relocation: GP relative reference */
01551 
01552     EK_DEF = 0x17,          /* Define new event kind format */
01553 
01554     EK_FCALL_LOCAL = 0x18,      /* point-of-call (jalr) to a local procedure */
01555     EK_FCALL_EXTERN = 0x19,     /* jalr to extern procedure (small got case) */
01556     EK_FCALL_EXTERN_BIG = 0x1a, /* jalr to extern procedure (large got case) */
01557     EK_FCALL_MULT = 0x1b,       /* jalr to more than one procedure */
01558     EK_FCALL_MULT_PARTIAL = 0x1c, /* jalr to multiple + unknown procedures */
01559 
01560     EK_LTR_FCALL = 0x1d,        /* jalr to rld lazy-text res.  index of
01561                                    symbol associated. */
01562     EK_PCREL_GOT0 = 0x1e,       /* immediate is hi 16 bits of 32-bit
01563                                    constant.  Argument is offset to lo,
01564                                    in instructions, not bytes*/
01565 
01566     /* The following events are reserved for supporting Purify-type tools: */
01567     EK_MEM_COPY_LOAD = 0x1f,    /* load only for copying data */
01568     EK_MEM_COPY_STORE = 0x20,   /* store only for copying data --
01569                                    LEB128 operand is word offset to
01570                                    paired load */
01571     EK_MEM_PARTIAL_LOAD = 0x21, /* load for reference to a subset of bytes --
01572                                    BYTE operand's 8 bits indicate which
01573                                    bytes are actually used */
01574     EK_MEM_EAGER_LOAD = 0x22,   /* load is speculative */
01575     EK_MEM_VALID_LOAD = 0x23,   /* load of data known to be valid */
01576 
01577                                   
01578                 /*
01579                  * Yet to be defined kinds with no fields (like EK_EXIT)
01580                  */
01581     EK_CK_UNUSED_NONE_0 = 0x50, /*  */
01582     EK_CK_UNUSED_NONE_1 = 0x51, /*  */
01583     EK_CK_UNUSED_NONE_2 = 0x52, /*  */
01584     EK_CK_UNUSED_NONE_3 = 0x53, /*  */
01585     EK_CK_UNUSED_NONE_4 = 0x54, /*  */
01586 
01587                 /*
01588                  * Yet to be defined kinds with 1 16 bit field
01589                  */
01590     EK_CK_UNUSED_16BIT_0 = 0x55,
01591     EK_CK_UNUSED_16BIT_1 = 0x56,
01592     EK_CK_UNUSED_16BIT_2 = 0x57, /*  */
01593     EK_CK_UNUSED_16BIT_3 = 0x58, /*  */
01594     EK_CK_UNUSED_16BIT_4 = 0x59, /*  */
01595 
01596                 /*
01597                  * Yet to be defined kinds with 1 32 bit field
01598                  */
01599     EK_CK_UNUSED_32BIT_0 = 0x5a, /*  */
01600     EK_CK_UNUSED_32BIT_1 = 0x5b, /*  */
01601     EK_CK_UNUSED_32BIT_2 = 0x5c, /*  */
01602 
01603                 /*
01604                  * Yet to be defined kinds with 1 64 bit field
01605                  */
01606 
01607     EK_CK_UNUSED_64BIT_0 = 0x5d,
01608     EK_CK_UNUSED_64BIT_1 = 0x5e,
01609     EK_CK_UNUSED_64BIT_2 = 0x5f, /*  */
01610     EK_CK_UNUSED_64BIT_3 = 0x60, /*  */
01611     EK_CK_UNUSED_64BIT_4 = 0x61, /*  */
01612 
01613                 /*
01614                  * Yet to be defined kinds with 1 uleb128 field
01615                  */
01616     EK_CK_UNUSED_ULEB128_0 = 0x62, /* */
01617     EK_CK_UNUSED_ULEB128_1 = 0x63, /*  */
01618     EK_CK_UNUSED_ULEB128_2 = 0x64, /*  */
01619     EK_CK_UNUSED_ULEB128_3 = 0x65, /*  */
01620     EK_CK_UNUSED_ULEB128_4 = 0x66, /*  */
01621     EK_CK_UNUSED_ULEB128_5 = 0x67, /*  */
01622     EK_CK_UNUSED_ULEB128_6 = 0x68, /*  */
01623     EK_CK_UNUSED_ULEB128_7 = 0x69, /*  */
01624     EK_CK_UNUSED_ULEB128_8 = 0x6a, /*  */
01625     EK_CK_UNUSED_ULEB128_9 = 0x6b, /*  */
01626 
01627 
01628     EK_INCR_LOC = 0x80      /* Increment offset into associated text section */
01629 
01630 } Elf_MIPS_Event_Kind;
01631 typedef Elf_MIPS_Event_Kind Elf_Event_Kind;
01632 
01633 /* The following defines list the various types of operands that are 
01634  * supported with the EK_DEF event kind.
01635  */
01636 #define EK_DEF_UCHAR    (1)         /* unsigned char (8 bits) */
01637 #define EK_DEF_USHORT   (2)         /* unsigned short (16 bits) */
01638 #define EK_DEF_UINT     (3)         /* unsigned int (32 bits) */
01639 #define EK_DEF_ULONG    (4)         /* unsigned long (64 bits) */
01640 #define EK_DEF_ULEB128  (5)         /* unsigned LEB128 encoded number */
01641 #define EK_DEF_CHAR     (6)         /* signed char (8 bits) */
01642 #define EK_DEF_SHORT    (7)         /* signed short (16 bits) */
01643 #define EK_DEF_INT      (8)         /* signed int (32 bits) */
01644 #define EK_DEF_LONG     (9)         /* signed long (64 bits) */
01645 #define EK_DEF_LEB128   (10)        /* signed LEB128 encoded number */
01646 #define EK_DEF_STRING   (11)        /* null terminated string */
01647 #define EK_DEF_VAR      (12)        /* variable length field: the first 2
01648                                        bytes is an unsigned short
01649                                        specifying the total number of bytes
01650                                        of this field including the first 2
01651                                        bytes */
01652 #define CK_DEF EK_DEF
01653 
01654 #define R_MIPS_GPREL            7
01655 
01656 typedef struct {
01657     Elf64_Word symbol;          /* symbol table index of subprogram, or 0 */
01658     Elf64_Half attrs;           /* Attributes: See list below */
01659     Elf64_Byte pcnt;            /* Parameter count */
01660     Elf64_Byte fpmask;          /* bit on indicates an FP parameter register */
01661 } Elf_Ifd;
01662 
01663 typedef Elf_Ifd Elf_Interface_Descriptor;  /* for compatibility */
01664 
01665 /* Flags that can be set in the 'attrs' field of Elf_Interface_Descriptor */
01666 #define SA_PROTOTYPED   0x8000  /* Does def or ref have prototype ? */
01667 #define SA_VARARGS      0x4000  /* Is this a varargs subprogram ? */
01668 #define SA_PIC          0x2000  /* Are memory references PIC? */
01669 #define SA_DSO_ENTRY    0x1000  /* Is subprogram valid DSO entry? */
01670 #define SA_ADDRESSED    0x0800  /* Is subprogram address taken? */
01671 #define SA_FUNCTION     0x0400  /* Does subprogram return a result? */
01672 #define SA_NESTED       0x0200  /* Is subprogram nested? */
01673 #define SA_IGNORE_ERROR 0x0100  /* Ignore consistency errors? */
01674 #define SA_DEFINITION   0x0080  /* Is this a definition (no just call)? */
01675 #define SA_AT_FREE      0x0040  /* Is the at register free at all branches? */
01676 #define SA_FREE_REGS    0x0020  /* Free register mask precedes parm profile */
01677 #define SA_PARAMETERS   0x0010  /* Parameter profile follows descriptor? */
01678 #define SA_ALTINTERFACE 0x0008  /* Alternate descriptor follows? */
01679 
01680 /* Fundamental Parameter Types */
01681 #define FT_unknown         0x0000
01682 #define FT_signed_char     0x0001
01683 #define FT_unsigned_char   0x0002
01684 #define FT_signed_short    0x0003
01685 #define FT_unsigned_short  0x0004
01686 #define FT_signed_int32    0x0005
01687 #define FT_unsigned_int32  0x0006
01688 #define FT_signed_int64    0x0007
01689 #define FT_unsigned_int64  0x0008
01690 #define FT_pointer32       0x0009
01691 #define FT_pointer64       0x000a
01692 #define FT_float32         0x000b
01693 #define FT_float64         0x000c
01694 #define FT_float128        0x000d
01695 #define FT_complex64       0x000e
01696 #define FT_complex128      0x000f
01697 #define FT_complex256      0x0010
01698 #define FT_void            0x0011
01699 #define FT_bool32          0x0012
01700 #define FT_bool64          0x0013
01701 #define FT_label32         0x0014
01702 #define FT_label64         0x0015
01703 #define FT_struct          0x0020
01704 #define FT_union           0x0021
01705 #define FT_enum            0x0022
01706 #define FT_typedef         0x0023
01707 #define FT_set             0x0024
01708 #define FT_range           0x0025
01709 #define FT_member_ptr      0x0026
01710 #define FT_virtual_ptr     0x0027
01711 #define FT_class           0x0028
01712 
01713 /* Parameter Qualifiers (aka Modifiers)  */
01714 #define MOD_pointer_to     0x01
01715 #define MOD_reference_to   0x02
01716 #define MOD_const          0x03
01717 #define MOD_volatile       0x04
01718 #define MOD_function       0x80
01719 #define MOD_array_of       0x81
01720 
01721 /* Parameter descriptor masks */
01722 #define PDM_TYPE        0x00ff  /* Fundamental type of parameter */
01723 #define PDM_REFERENCE   0x4000  /* Reference parameter ? */
01724 #define PDM_SIZE        0x2000  /* Followed by explicit 32-bit byte count? */
01725 #define PDM_Qualifiers  0x0f00  /* Count of type qualifiers << 8 */
01726 
01727 /* Parameter descriptor mask flags */
01728 #define PDMF_REFERENCE  0x40
01729 #define PDMF_SIZE       0x20
01730 #define PDMF_Qualifiers 0x0f
01731 #endif
01732 
01733 /* Entries found in sections of type SHT_MIPS_GPTAB.  */
01734 
01735 typedef union
01736 {
01737   struct
01738     {
01739       Elf32_Word gt_current_g_value;    /* -G value used for compilation */
01740       Elf32_Word gt_unused;             /* Not used */
01741     } gt_header;                        /* First entry in section */
01742   struct
01743     {
01744       Elf32_Word gt_g_value;            /* If this value were used for -G */
01745       Elf32_Word gt_bytes;              /* This many bytes would be used */
01746     } gt_entry;                         /* Subsequent entries in section */
01747 } Elf32_gptab;
01748 
01749 /* Entry found in sections of type SHT_MIPS_REGINFO.  */
01750 
01751 typedef struct
01752 {
01753   Elf32_Word    ri_gprmask;             /* General registers used */
01754   Elf32_Word    ri_cprmask[4];          /* Coprocessor registers used */
01755   Elf32_Sword   ri_gp_value;            /* $gp register value */
01756 } Elf32_RegInfo;
01757 
01758 typedef struct
01759 {
01760         Elf64_Word      ri_gprmask;     /* mask of general regs used */
01761         Elf64_Word      ri_pad;         /* for alignment */
01762         Elf64_Word      ri_cprmask[4];  /* mask of cop regs used */
01763         Elf64_Addr      ri_gp_value;    /* initial value of gp */
01764 } Elf64_RegInfo;
01765 
01766 /* MIPS relocs.  */
01767 
01768 #define R_MIPS_NONE     0               /* No reloc */
01769 #define R_MIPS_16       1               /* Direct 16 bit */
01770 #define R_MIPS_32       2               /* Direct 32 bit */
01771 #define R_MIPS_REL32    3               /* PC relative 32 bit */
01772 #define R_MIPS_26       4               /* Direct 26 bit shifted */
01773 #define R_MIPS_HI16     5               /* High 16 bit */
01774 #define R_MIPS_LO16     6               /* Low 16 bit */
01775 #define R_MIPS_GPREL16  7               /* GP relative 16 bit */
01776 #define R_MIPS_LITERAL  8               /* 16 bit literal entry */
01777 #define R_MIPS_GOT16    9               /* 16 bit GOT entry */
01778 #define R_MIPS_PC16     10              /* PC relative 16 bit */
01779 #define R_MIPS_CALL16   11              /* 16 bit GOT entry for function */
01780 #define R_MIPS_GPREL32  12              /* GP relative 32 bit */
01781 #define R_MIPS_NUM      13
01782 #define R_MIPS_SHIFT5           16
01783 #define R_MIPS_SHIFT6           17
01784 #define R_MIPS_64               18
01785 #define R_MIPS_GOT_DISP         19
01786 #define R_MIPS_GOT_PAGE         20
01787 #define R_MIPS_GOT_OFST         21
01788 #define R_MIPS_GOT_HI16         22
01789 #define R_MIPS_GOT_LO16         23
01790 #define R_MIPS_SUB              24
01791 #define R_MIPS_INSERT_A         25
01792 #define R_MIPS_INSERT_B         26
01793 #define R_MIPS_DELETE           27
01794 #define R_MIPS_HIGHER           28
01795 #define R_MIPS_HIGHEST          29
01796 #define R_MIPS_CALL_HI16        30
01797 #define R_MIPS_CALL_LO16        31
01798 #define R_MIPS_SCN_DISP         32
01799 #define R_MIPS_REL16            33
01800 #define R_MIPS_ADD_IMMEDIATE    34
01801 #define R_MIPS_PJUMP            35
01802 #define R_MIPS_RELGOT           36
01803 #define R_MIPS_JALR             37
01804 
01805 
01806 #define _R_MIPS_COUNT_          38      /* Number of relocations */
01807         /* _R_MIPS_COUNT_ is not a relocation type, it is
01808         ** a count of relocation types. 
01809         ** Must be one greater than the highest relocation
01810         ** type.
01811         */
01812 
01813 /* Legal values for p_type field of Elf32_Phdr.  */
01814 
01815 #define PT_MIPS_REGINFO 0x70000000      /* Register usage information */
01816 
01817 /* 
01818  * Program header types defined by Intel
01819  */
01820 
01821 #define PT_IA64_ARCHEXT                 (PT_LOPROC + 0)
01822         /* This segment contains SHT_IA64_EXT sections.  If this entry
01823          * is present, it must precede all entries of type PT_LOAD
01824          */
01825 #define PT_IA64_UNWIND                  (PT_LOPROC + 1)
01826         /* This segment contains stack unwind tables.
01827          */
01828 
01829 /*
01830  * Program header types defined by Irix/ia64
01831  */
01832 #define PT_IA64_OPTIONS                 (PT_LOPROC + 2)
01833         /* This segment contains the options section.  By putting
01834          * the option section into a special segment, it makes it
01835          * easy for the kernel, exec, and/or rld to quickly find
01836          * the option section.
01837          */
01838 
01839 /* 
01840  * special p_flags
01841  */
01842 
01843 #define PF_IA64_NORECOV         0x80000000
01844         /* This segment contains SHT_IA64_NORECOV sections 
01845          */
01846 /* #define PF_IA64_LOCAL                0x10000000 */
01847         /* This segment is local to a thread.
01848          * 
01849          * --------   WARNING:  DO NOT USE PF_IA64_LOCAL ------------
01850          *
01851          * Currently, it is only .data sections (and .bss ?)
01852          * that can marked as LOCAL.   Because of this, it
01853          * seems reasonable that we should not use a p_flag but,
01854          * rather, should create new p_types for any local sections.
01855          *
01856          * The decision has not yet be made on this issue.
01857          *
01858          * TBD: Should PF_IA64_LOCAL be a flag or new p_type ?
01859          *
01860          */
01861 
01862 /* Legal values for d_tag field of Elf32_Dyn.  */
01863 
01864 #define DT_MIPS_RLD_VERSION  0x70000001 /* Runtime linker interface version */
01865 #define DT_MIPS_TIME_STAMP   0x70000002 /* Timestamp */
01866 #define DT_MIPS_ICHECKSUM    0x70000003 /* Checksum */
01867 #define DT_MIPS_IVERSION     0x70000004 /* Version string (string tbl index) */
01868 #define DT_MIPS_FLAGS        0x70000005 /* Flags */
01869 #define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */
01870 #define DT_MIPS_MSYM            0x70000007
01871 #define DT_MIPS_CONFLICT     0x70000008 /* Address of CONFLICT section */
01872 #define DT_MIPS_LIBLIST      0x70000009 /* Address of LIBLIST section */
01873 #define DT_MIPS_LOCAL_GOTNO  0x7000000a /* Number of local GOT entries */
01874 #define DT_MIPS_CONFLICTNO   0x7000000b /* Number of CONFLICT entries */
01875 #define DT_MIPS_LIBLISTNO    0x70000010 /* Number of LIBLIST entries */
01876 #define DT_MIPS_SYMTABNO     0x70000011 /* Number of DYNSYM entries */
01877 #define DT_MIPS_UNREFEXTNO   0x70000012 /* First external DYNSYM */
01878 #define DT_MIPS_GOTSYM       0x70000013 /* First GOT entry in DYNSYM */
01879 #define DT_MIPS_HIPAGENO     0x70000014 /* Number of GOT page table entries */
01880 #define DT_MIPS_RLD_MAP      0x70000016 /* Address of run time loader map.  */
01881 #define DT_MIPS_NUM          0x17
01882 
01883 /* Legal values for DT_MIPS_FLAG Elf32_Dyn entry.  */
01884 
01885 #define RHF_NONE                   0            /* No flags */
01886 #define RHF_QUICKSTART             (1 << 0)     /* Use quickstart */
01887 #define RHF_NOTPOT                 (1 << 1)     /* Hash size not power of 2 */
01888 #define RHF_NO_LIBRARY_REPLACEMENT (1 << 2)     /* Ignore LD_LIBRARY_PATH */
01889 
01890 /* Entries found in sections of type SHT_MIPS_LIBLIST.  */
01891 
01892 typedef struct
01893 {
01894   Elf32_Word    l_name;                 /* Name (string table index) */
01895   Elf32_Word    l_time_stamp;           /* Timestamp */
01896   Elf32_Word    l_checksum;             /* Checksum */
01897   Elf32_Word    l_version;              /* Interface version */
01898   Elf32_Word    l_flags;                /* Flags */
01899 } Elf32_Lib;
01900 
01901 /* Legal values for l_flags.  */
01902 
01903 #define LL_EXACT_MATCH    (1 << 0)      /* Require exact match */
01904 #define LL_IGNORE_INT_VER (1 << 1)      /* Ignore interface version */
01905 
01906 #if defined(__MIPS_AND_IA64_ELF_H)
01907 /*
01908  * l_flags  These flags exist in each liblist entry.
01909  * The dynamic section flag bit RHF_SGI_ONLY
01910  * must be on for most of these to be honored by rld(1).
01911  * LL_DELAY_LOAD is honored regardless of RHF_SGI_ONLY.
01912  * If RHF_SGI_ONLY is not on no version matches are done
01913  * (just as if LL_IGNORE_INT_VER were on).
01914  * 
01915  * Recall that a liblist entry has a version string with a single version,
01916  * while the dynamic section on a DSO has a version string with
01917  * possibly multiple versions listed (separated by :).  man dso for
01918  * more details on multiple versions.
01919  *
01920  * By default version matches do NOT consider the minor version number.
01921  *
01922  * LL_EXACT_MATCH means (if on) that only a DSO with exactly the
01923  * checksum and timestamp and version from the liblist entry
01924  * (which were gotten at static-link time but might have
01925  * been updated by rqs(1)) will match.
01926  *
01927  * LL_REQUIRE_MINOR means (if on) that the version match must
01928  * match the minor version number.
01929  *
01930  * LL_NONE is just a convenient name requesting the default checks.
01931  *
01932  * LL_DELAY_LOAD means  (if on) that  rld will not load the DSO
01933  * refered to by the liblist entry till something in the DSO
01934  * is called.
01935  *
01936  * LL_EXPORTS is ignored by rld. It informs that ld exported symbols 
01937  * from the liblist-entry DSO into the main DSO (that this
01938  * liblist entry is part of).
01939  *
01940  * LL_IGNORE_INT_VER means (if on) that all version checks
01941  * should be suppressed and the DSO accepted based on
01942  * name alone.
01943  *
01944  * LL_DELTA means that the DSO referenced is Delta C++.
01945  *
01946  */
01947 
01948 #define LL_NONE                 0
01949 #define LL_REQUIRE_MINOR        0x4
01950 #define LL_EXPORTS              0x8
01951 #define LL_DELAY_LOAD           0x10
01952 
01953 #define LL_DELTA                0x20
01954 
01955                         /* RHF_QUICKSTART is turned on by ld if
01956                            ld determines that at link time the
01957                            object is quickstartable.
01958                         */
01959                         /* RHF_NOTPOT bit non-zero if elf hash 
01960                            table element count
01961                            is NOT a Power Of Two 
01962                            If 0, rld uses mask, else rld uses %
01963                            (mod) operator to turn hash into index.
01964                         */
01965                         /* RHF_NO_LIBRARY_REPLACEMENT
01966                            is set by ld -no_library_replacement
01967                            and tells rld not to  honor _RLD*_ROOT
01968                            or _RLD*_PATH environment variables.
01969                            from the time detected (during the
01970                            program execution).
01971                         */
01972 
01973 #define RHF_NO_MOVE                 0x00000008
01974                         /* If RHF_NO_MOVE  is on and a DSO is moved
01975                            from the address it was linked at, rld
01976                            will give a fatal error and exit.
01977                            If it was a dlopen()-type call, the call
01978                            will fail (but the app will not exit).
01979                         */
01980 #define RHF_SGI_ONLY                0x00000010
01981                         /* RHF_SGI_ONLY enables various flags, such as the
01982                            liblist flags so that rld pays
01983                            attention tothe flags
01984                         */
01985 
01986 
01987 #define RHF_GUARANTEE_INIT          0x00000020
01988                         /* RHF_GUARANTEE_INIT, if on, provokes a fatal
01989                            error if rld detects a call into a DSO
01990                            for which the -init code has not been run.
01991 
01992                            This could happen if dso B has dso C on B's
01993                            liblist and DSO C's init code calls something
01994                            int DSO B and DSO B has RHF_GUARANTEE_INIT on.
01995                            This was designed to help implement C++ 
01996                            initializations in an early C++ release (5.3?).
01997                            Not used by C++ for quite some time.
01998                         */
01999 #define RHF_DELTA_C_PLUS_PLUS       0x00000040
02000                         /* RHF_DELTA_C_PLUS_PLUS tells rld that the
02001                            executable/DSO is Delta C++.
02002                         */
02003 #define RHF_GUARANTEE_START_INIT    0x00000080
02004                         /* RHF_GUARANTEE_START_INIT, if on, causes rld to
02005                            run a target DSO's -init  code
02006                            in result of a call into that DSO.
02007 
02008                            This could happen if dso B has dso C on B's
02009                            liblist and DSO C's init code calls something
02010                            int DSO B and DSO B has 
02011                            RHF_GUARANTEE_START_INIT on.
02012                            rld will start running DSO C's -init code and
02013                            when that calls a DSO  B function, 
02014                            DSO B's -init code is run before the
02015                            call to B is allowed to run.
02016                         */
02017 
02018 #define RHF_PIXIE                   0x00000100
02019                 /* RHF_PIXIE is set in pixified DSOs/executables.
02020                    Notifies rld(1) to do special handling of
02021                    dlopen() strings and to save/restore pixie
02022                    registers (which save/restore is actually not
02023                    needed as of SpeedShop 1.3).
02024                 */
02025 
02026         
02027 #define RHF_DEFAULT_DELAY_LOAD      0x00000200
02028                         /* If DSO B is linked into  DSO A
02029                            and RHF_DEFAULT_DELAY_LOAD is on in DSO B,
02030                            ld will mark (in the liblist of DSO A) that
02031                            DSO B should be delay-loaded by rld, not
02032                            loaded at the same time A is.
02033                            (data-dependencies may turn the delay-load off).
02034                         */
02035 #define RHF_REQUICKSTART            0x00000400
02036                         /* If RHF_REQUICKSTART is on, rqs will
02037                            process the object. If off, 
02038                            rqs will not process the object unless
02039                            -force_requickstart  option used.
02040                            Set by ld or rqs.
02041                            ld sets it if ld believes the object should
02042                            allow rqs-ing.  -abi objects do not have
02043                            this turned on by ld.
02044                         */
02045 #define RHF_REQUICKSTARTED          0x00000800
02046                         /* RHF_REQUICKSTARTED  bit non-zero if
02047                            rqs has processed the object
02048                            Set by rqs.
02049                         */
02050 #define RHF_CORD                    0x00001000
02051                         /* RHF_CORD bit is non-zero if
02052                            the object  has been cord(1)ed
02053                            set by cord.
02054                         */
02055 #define RHF_NO_UNRES_UNDEF          0x00002000
02056                         /* RHF_NO_UNRES_UNDEF is non-zero if
02057                            every external symbol is resolved
02058                            (ie, no externals are undefined)
02059                            Set by ld or rqs.
02060                         */
02061 #define RHF_RLD_ORDER_SAFE          0x00004000
02062                         /* If on, RHF_RLD_ORDER_SAFE tells rld it
02063                            can stop searching for UNDEFineds to
02064                            resolve when the
02065                            first non-ABS, non-UNDEF is found
02066                            (saving time in rld).
02067                            Set by ld.
02068                         */
02069 
02070 #define DT_IRIX_LTR                     0x70000033
02071 #define DT_IRIX_LPT                     0x70000034
02072 #define DT_IRIX_LPT_IDX                 0x70000035
02073 #define DT_IRIX_LPT_NO                  0x70000036
02074 #define DT_IRIX_PLT                     0x70000037
02075 #define DT_IRIX_PLT_NON_PREEMPT_IDX     0x70000038
02076 #define DT_IRIX_PLT_NON_PREEMPT_NO      0x70000039
02077 #define DT_IRIX_PLT_IN_DYNSYM_IDX       0x7000003A
02078 #define DT_IRIX_PLT_IN_DYMSYM_NO        0x7000003B
02079 #define DT_IRIX_PLT_PROTECTED_IDX       0x7000003C
02080 #define DT_IRIX_PLT_PROTECTED_NO        0x7000003D
02081 #define DT_IRIX_PLT_PREEMPT_IDX         0x7000003E
02082 #define DT_IRIX_PLT_PREEMPT_NO          0x7000003F
02083 #define DT_IRIX_DLT                     0x70000040
02084 #define DT_IRIX_DLT_NON_PREEMPT_IDX     0x70000041
02085 #define DT_IRIX_DLT_NON_PREEMPT_NO      0x70000042
02086 #define DT_IRIX_DLT_IN_DYNSYM_IDX       0x70000043
02087 #define DT_IRIX_DLT_IN_DYMSYM_NO        0x70000044
02088 #define DT_IRIX_DLT_PROTECTED_IDX       0x70000045
02089 #define DT_IRIX_DLT_PROTECTED_NO        0x70000046
02090 #define DT_IRIX_DLT_PREEMPT_IDX         0x70000047
02091 #define DT_IRIX_DLT_PREEMPT_NO          0x70000048
02092 #define DT_IRIX_DSYM_PLT_IDX            0x70000049
02093 #define DT_IRIX_DSYM_DLT_IDX            0x7000004A
02094 
02095 /* ====================================================================
02096  *
02097  * .dynamic Section
02098  *
02099  * --- WARNING ---- WARNING ---- WARNING ---- WARNING ---- WARNING ----
02100  *
02101  *      TBD:  The .dynamic section has not yet been prepared for
02102  *            use in both Irix/mips and Irix/ia64
02103  *
02104  *      I believe that most of the tags will be the same in both
02105  *      Irix/mips and Irix/ia64, but it still needs to be reviewed.
02106  *      
02107  *      For now, we'll document them only in mips/elf.h
02108  * ====================================================================
02109  */
02110 
02111 #ifndef __osf__
02112 
02113 #define DT_MIPS_70000015        0x70000015        /* reserved */
02114 
02115 /*
02116  *      The following tags are for DELTA_C_PLUS_PLUS only
02117  *      and are obsolete.  
02118  */
02119 #if     (defined(_DELTA_C_PLUS_PLUS) && (_DELTA_C_PLUS_PLUS==1))
02120 
02121 #define DT_MIPS_DELTA_CLASS     0x70000017      /* DCC class definitions      */
02122 #define DT_MIPS_DELTA_CLASS_NO  0x70000018      /* No. DCC class definitions  */
02123 #define DT_MIPS_DELTA_INSTANCE  0x70000019      /* DCC class instances        */
02124 #define DT_MIPS_DELTA_INSTANCE_NO 0x7000001A    /* No. DCC class instances    */
02125 #define DT_MIPS_DELTA_RELOC     0x7000001B      /* DCC relocations            */
02126 #define DT_MIPS_DELTA_RELOC_NO  0x7000001C      /* No.  DCC relocations       */
02127 #define DT_MIPS_DELTA_SYM       0x7000001D      /* DCC symbols Refered to by
02128                                                  * DCC relocations            */
02129 #define DT_MIPS_DELTA_SYM_NO    0x7000001E      /* No. DCC symbols            */
02130 #define DT_MIPS_DELTA_CLASSSYM  0x70000020      /* DCC class declarations     */
02131 #define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021    /* No. DCC class declarations */
02132 
02133 #endif  /* _DELTA_C_PLUS_PLUS */
02134 
02135 
02136 #define DT_MIPS_CXX_FLAGS       0x70000022      /* Flags:  C++ flavor         */
02137 #define DT_MIPS_PIXIE_INIT      0x70000023      /* Init code for pixie        */
02138 #define DT_MIPS_SYMBOL_LIB      0x70000024
02139 #define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025
02140 #define DT_MIPS_LOCAL_GOTIDX    0x70000026
02141 #define DT_MIPS_HIDDEN_GOTIDX   0x70000027
02142 #define DT_MIPS_PROTECTED_GOTIDX 0x70000028
02143 #define DT_MIPS_OPTIONS         0x70000029      /* Address of .options        */
02144 #define DT_MIPS_INTERFACE       0x7000002a      /* Address of .interface      */
02145 #define DT_MIPS_DYNSTR_ALIGN    0x7000002b
02146 #define DT_MIPS_INTERFACE_SIZE  0x7000002c      /* size of the .interface     */
02147 #define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Addr of rld_text_resolve  */
02148 #define DT_MIPS_PERF_SUFFIX     0x7000002e      /* suffix to be added to dso
02149                                                  * name before dlopen() call  */
02150 #define DT_MIPS_COMPACT_SIZE    0x7000002f      /* (O32)Size of .compact_rel  */
02151 #define DT_MIPS_GP_VALUE        0x70000030      /* gp value for aux gots      */
02152 #define DT_MIPS_AUX_DYNAMIC     0x70000031      /* Address of aux .dynamic    */
02153 
02154 #else  /* __osf__ */
02155 
02156 #define DT_MIPS_PACKAGE         0x70000014
02157 #define DT_MIPS_PACKAGENO       0x70000015
02158 #define DT_MIPS_PACKSYM         0x70000016
02159 #define DT_MIPS_PACKSYMNO       0x70000017
02160 #define DT_MIPS_IMPACKNO        0x70000018
02161 #define DT_MIPS_EXPACKNO        0x70000019
02162 #define DT_MIPS_IMPSYMNO        0x7000001A
02163 #define DT_MIPS_EXPSYMNO        0x7000001B
02164 #ifndef DT_MIPS_HIPAGENO /* eraxxon alpha hack */
02165 #define DT_MIPS_HIPAGENO        0x7000001C
02166 #endif
02167 
02168 #endif /* __osf__ */
02169 /*
02170  *      Elf_Options.kind == ODK_IA64_REGINFO
02171  *
02172  *      masks for Elf_Options.info
02173  */
02174 typedef struct 
02175 {
02176         Elf64_Addr      ri_gp_value;    /* initial value of gp          */
02177 
02178         /* TBD: define rest of Elf_IA64_RegInfo record  */
02179 
02180 }
02181 Elf_IA64_RegInfo;
02182 #endif
02183 
02184 /* Entries found in sections of type SHT_MIPS_CONFLICT.  */
02185 
02186 typedef Elf32_Addr Elf32_Conflict;
02187 
02188 typedef Elf64_Addr Elf64_Conflict;
02189 
02190 extern Elf64_Conflict   _ConflictList64 [];
02191 
02192 #define RLD_VERSION            1
02193 
02194 
02195 /* HPPA specific definitions.  */
02196 
02197 /* Legal values for sh_type field of Elf32_Shdr.  */
02198 
02199 #define SHT_PARISC_GOT          0x70000000 /* GOT for external data.  */
02200 #define SHT_PARISC_ARCH         0x70000001 /* Architecture extensions.  */
02201 #define SHT_PARISC_GLOBAL       0x70000002 /* Definition of $global$.  */
02202 #define SHT_PARISC_MILLI        0x70000003 /* Millicode routines.  */
02203 #define SHT_PARISC_UNWIND       0x70000004 /* Unwind information.  */
02204 #define SHT_PARISC_PLT          0x70000005 /* Procedure linkage table.  */
02205 #define SHT_PARISC_SDATA        0x70000006 /* Short initialized data.  */
02206 #define SHT_PARISC_SBSS         0x70000007 /* Short uninitialized data.  */
02207 #define SHT_PARISC_SYMEXTN      0x70000008 /* Argument/relocation info.  */
02208 #define SHT_PARISC_STUBS        0x70000009 /* Linker stubs.  */
02209 
02210 /* Legal values for sh_flags field of Elf32_Shdr.  */
02211 
02212 #define SHF_PARISC_SHORT        0x20000000 /* Section with short addressing. */
02213 
02214 /* Legal values for ST_TYPE subfield of st_info (symbol type).  */
02215 
02216 #define STT_PARISC_MILLICODE    13      /* Millicode function entry point.  */
02217 
02218 
02219 /* Alpha specific declarations.  */
02220 
02221 /* Alpha relocs.  */
02222 
02223 #define R_ALPHA_NONE            0       /* No reloc */
02224 #define R_ALPHA_REFLONG         1       /* Direct 32 bit */
02225 #define R_ALPHA_REFQUAD         2       /* Direct 64 bit */
02226 #define R_ALPHA_GPREL32         3       /* GP relative 32 bit */
02227 #define R_ALPHA_LITERAL         4       /* GP relative 16 bit w/optimization */
02228 #define R_ALPHA_LITUSE          5       /* Optimization hint for LITERAL */
02229 #define R_ALPHA_GPDISP          6       /* Add displacement to GP */
02230 #define R_ALPHA_BRADDR          7       /* PC+4 relative 23 bit shifted */
02231 #define R_ALPHA_HINT            8       /* PC+4 relative 16 bit shifted */
02232 #define R_ALPHA_SREL16          9       /* PC relative 16 bit */
02233 #define R_ALPHA_SREL32          10      /* PC relative 32 bit */
02234 #define R_ALPHA_SREL64          11      /* PC relative 64 bit */
02235 #define R_ALPHA_OP_PUSH         12      /* OP stack push */
02236 #define R_ALPHA_OP_STORE        13      /* OP stack pop and store */
02237 #define R_ALPHA_OP_PSUB         14      /* OP stack subtract */
02238 #define R_ALPHA_OP_PRSHIFT      15      /* OP stack right shift */
02239 #define R_ALPHA_GPVALUE         16
02240 #define R_ALPHA_GPRELHIGH       17
02241 #define R_ALPHA_GPRELLOW        18
02242 #define R_ALPHA_IMMED_GP_16     19
02243 #define R_ALPHA_IMMED_GP_HI32   20
02244 #define R_ALPHA_IMMED_SCN_HI32  21
02245 #define R_ALPHA_IMMED_BR_HI32   22
02246 #define R_ALPHA_IMMED_LO32      23
02247 #define R_ALPHA_COPY            24      /* Copy symbol at runtime */
02248 #define R_ALPHA_GLOB_DAT        25      /* Create GOT entry */
02249 #define R_ALPHA_JMP_SLOT        26      /* Create PLT entry */
02250 #define R_ALPHA_RELATIVE        27      /* Adjust by program base */
02251 #define R_ALPHA_NUM             28
02252 
02253 __END_DECLS
02254 
02255 
02256 #endif /* MIPS */
02257 
02258 /***************************************************************************/
02259 
02260 #ifndef EM_IA_64
02261 # define EM_IA_64 50  /* from Linux <elf.h> */
02262 #endif
02263 
02264 /* from be/com/ipa_lno_file.cxx  (extra comment: Change SHT_MIPS_NUM to 42.) */
02265 #define SHT_MIPS_IPALNO  (SHT_LOPROC + 42)
02266 
02267 /* from be/com/ia64/sections.cxx */
02268 #define SHF_IA_64_SHORT SHF_MIPS_GPREL
02269 
02270 /***************************************************************************/
02271 
02272 #endif  /* elf.h */

Generated on Wed Jan 28 04:37:26 2009 for OpenADFortTk (extended to Open64) by  doxygen 1.5.7.1