Back to index

cell-binutils  2.17cvs20070401
mips.h
Go to the documentation of this file.
00001 /* MIPS ELF support for BFD.
00002    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
00003    2003, 2004, 2005
00004    Free Software Foundation, Inc.
00005 
00006    By Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>, from
00007    information in the System V Application Binary Interface, MIPS
00008    Processor Supplement.
00009 
00010 This file is part of BFD, the Binary File Descriptor library.
00011 
00012 This program is free software; you can redistribute it and/or modify
00013 it under the terms of the GNU General Public License as published by
00014 the Free Software Foundation; either version 2 of the License, or
00015 (at your option) any later version.
00016 
00017 This program is distributed in the hope that it will be useful,
00018 but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 GNU General Public License for more details.
00021 
00022 You should have received a copy of the GNU General Public License
00023 along with this program; if not, write to the Free Software
00024 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00025 
00026 /* This file holds definitions specific to the MIPS ELF ABI.  Note
00027    that most of this is not actually implemented by BFD.  */
00028 
00029 #ifndef _ELF_MIPS_H
00030 #define _ELF_MIPS_H
00031 
00032 #include "elf/reloc-macros.h"
00033 
00034 /* Relocation types.  */
00035 START_RELOC_NUMBERS (elf_mips_reloc_type)
00036   RELOC_NUMBER (R_MIPS_NONE, 0)
00037   RELOC_NUMBER (R_MIPS_16, 1)
00038   RELOC_NUMBER (R_MIPS_32, 2)             /* In Elf 64: alias R_MIPS_ADD */
00039   RELOC_NUMBER (R_MIPS_REL32, 3)   /* In Elf 64: alias R_MIPS_REL */
00040   RELOC_NUMBER (R_MIPS_26, 4)
00041   RELOC_NUMBER (R_MIPS_HI16, 5)
00042   RELOC_NUMBER (R_MIPS_LO16, 6)
00043   RELOC_NUMBER (R_MIPS_GPREL16, 7) /* In Elf 64: alias R_MIPS_GPREL */
00044   RELOC_NUMBER (R_MIPS_LITERAL, 8)
00045   RELOC_NUMBER (R_MIPS_GOT16, 9)   /* In Elf 64: alias R_MIPS_GOT */
00046   RELOC_NUMBER (R_MIPS_PC16, 10)
00047   RELOC_NUMBER (R_MIPS_CALL16, 11) /* In Elf 64: alias R_MIPS_CALL */
00048   RELOC_NUMBER (R_MIPS_GPREL32, 12)
00049   /* The remaining relocs are defined on Irix, although they are not
00050      in the MIPS ELF ABI.  */
00051   RELOC_NUMBER (R_MIPS_UNUSED1, 13)
00052   RELOC_NUMBER (R_MIPS_UNUSED2, 14)
00053   RELOC_NUMBER (R_MIPS_UNUSED3, 15)
00054   RELOC_NUMBER (R_MIPS_SHIFT5, 16)
00055   RELOC_NUMBER (R_MIPS_SHIFT6, 17)
00056   RELOC_NUMBER (R_MIPS_64, 18)
00057   RELOC_NUMBER (R_MIPS_GOT_DISP, 19)
00058   RELOC_NUMBER (R_MIPS_GOT_PAGE, 20)
00059   RELOC_NUMBER (R_MIPS_GOT_OFST, 21)
00060   RELOC_NUMBER (R_MIPS_GOT_HI16, 22)
00061   RELOC_NUMBER (R_MIPS_GOT_LO16, 23)
00062   RELOC_NUMBER (R_MIPS_SUB, 24)
00063   RELOC_NUMBER (R_MIPS_INSERT_A, 25)
00064   RELOC_NUMBER (R_MIPS_INSERT_B, 26)
00065   RELOC_NUMBER (R_MIPS_DELETE, 27)
00066   RELOC_NUMBER (R_MIPS_HIGHER, 28)
00067   RELOC_NUMBER (R_MIPS_HIGHEST, 29)
00068   RELOC_NUMBER (R_MIPS_CALL_HI16, 30)
00069   RELOC_NUMBER (R_MIPS_CALL_LO16, 31)
00070   RELOC_NUMBER (R_MIPS_SCN_DISP, 32)
00071   RELOC_NUMBER (R_MIPS_REL16, 33)
00072   RELOC_NUMBER (R_MIPS_ADD_IMMEDIATE, 34)
00073   RELOC_NUMBER (R_MIPS_PJUMP, 35)
00074   RELOC_NUMBER (R_MIPS_RELGOT, 36)
00075   RELOC_NUMBER (R_MIPS_JALR, 37)
00076   /* TLS relocations.  */
00077   RELOC_NUMBER (R_MIPS_TLS_DTPMOD32, 38)
00078   RELOC_NUMBER (R_MIPS_TLS_DTPREL32, 39)
00079   RELOC_NUMBER (R_MIPS_TLS_DTPMOD64, 40)
00080   RELOC_NUMBER (R_MIPS_TLS_DTPREL64, 41)
00081   RELOC_NUMBER (R_MIPS_TLS_GD, 42)
00082   RELOC_NUMBER (R_MIPS_TLS_LDM, 43)
00083   RELOC_NUMBER (R_MIPS_TLS_DTPREL_HI16, 44)
00084   RELOC_NUMBER (R_MIPS_TLS_DTPREL_LO16, 45)
00085   RELOC_NUMBER (R_MIPS_TLS_GOTTPREL, 46)
00086   RELOC_NUMBER (R_MIPS_TLS_TPREL32, 47)
00087   RELOC_NUMBER (R_MIPS_TLS_TPREL64, 48)
00088   RELOC_NUMBER (R_MIPS_TLS_TPREL_HI16, 49)
00089   RELOC_NUMBER (R_MIPS_TLS_TPREL_LO16, 50)
00090   RELOC_NUMBER (R_MIPS_GLOB_DAT, 51)
00091   FAKE_RELOC (R_MIPS_max, 52)
00092   /* These relocs are used for the mips16.  */
00093   FAKE_RELOC (R_MIPS16_min, 100)
00094   RELOC_NUMBER (R_MIPS16_26, 100)
00095   RELOC_NUMBER (R_MIPS16_GPREL, 101)
00096   RELOC_NUMBER (R_MIPS16_GOT16, 102)
00097   RELOC_NUMBER (R_MIPS16_CALL16, 103)
00098   RELOC_NUMBER (R_MIPS16_HI16, 104)
00099   RELOC_NUMBER (R_MIPS16_LO16, 105)
00100   FAKE_RELOC (R_MIPS16_max, 106)
00101   /* These relocations are specific to VxWorks.  */
00102   RELOC_NUMBER (R_MIPS_COPY, 126)
00103   RELOC_NUMBER (R_MIPS_JUMP_SLOT, 127)
00104   /* This was a GNU extension used by embedded-PIC.  It was co-opted by
00105      mips-linux for exception-handling data.  It is no longer used, but
00106      should continue to be supported by the linker for backward
00107      compatibility.  (GCC stopped using it in May, 2004.)  */
00108   RELOC_NUMBER (R_MIPS_PC32, 248)
00109   /* FIXME: this relocation is used internally by gas.  */
00110   RELOC_NUMBER (R_MIPS_GNU_REL16_S2, 250)
00111   /* These are GNU extensions to enable C++ vtable garbage collection.  */
00112   RELOC_NUMBER (R_MIPS_GNU_VTINHERIT, 253)
00113   RELOC_NUMBER (R_MIPS_GNU_VTENTRY, 254)
00114 END_RELOC_NUMBERS (R_MIPS_maxext)
00115 
00116 /* Processor specific flags for the ELF header e_flags field.  */
00117 
00118 /* At least one .noreorder directive appears in the source.  */
00119 #define EF_MIPS_NOREORDER   0x00000001
00120 
00121 /* File contains position independent code.  */
00122 #define EF_MIPS_PIC         0x00000002
00123 
00124 /* Code in file uses the standard calling sequence for calling
00125    position independent code.  */
00126 #define EF_MIPS_CPIC        0x00000004
00127 
00128 /* ???  Unknown flag, set in IRIX 6's BSDdup2.o in libbsd.a.  */
00129 #define EF_MIPS_XGOT        0x00000008
00130 
00131 /* Code in file uses UCODE (obsolete) */
00132 #define EF_MIPS_UCODE              0x00000010
00133 
00134 /* Code in file uses new ABI (-n32 on Irix 6).  */
00135 #define EF_MIPS_ABI2        0x00000020
00136 
00137 /* Process the .MIPS.options section first by ld */
00138 #define EF_MIPS_OPTIONS_FIRST      0x00000080
00139 
00140 /* Architectural Extensions used by this file */
00141 #define EF_MIPS_ARCH_ASE    0x0f000000
00142 
00143 /* Use MDMX multimedia extensions */
00144 #define EF_MIPS_ARCH_ASE_MDMX      0x08000000
00145 
00146 /* Use MIPS-16 ISA extensions */
00147 #define EF_MIPS_ARCH_ASE_M16       0x04000000
00148 
00149 /* Indicates code compiled for a 64-bit machine in 32-bit mode.
00150    (regs are 32-bits wide.) */
00151 #define EF_MIPS_32BITMODE       0x00000100
00152 
00153 /* Four bit MIPS architecture field.  */
00154 #define EF_MIPS_ARCH        0xf0000000
00155 
00156 /* -mips1 code.  */
00157 #define E_MIPS_ARCH_1              0x00000000
00158 
00159 /* -mips2 code.  */
00160 #define E_MIPS_ARCH_2              0x10000000
00161 
00162 /* -mips3 code.  */
00163 #define E_MIPS_ARCH_3              0x20000000
00164 
00165 /* -mips4 code.  */
00166 #define E_MIPS_ARCH_4              0x30000000
00167 
00168 /* -mips5 code.  */
00169 #define E_MIPS_ARCH_5           0x40000000
00170 
00171 /* -mips32 code.  */
00172 #define E_MIPS_ARCH_32          0x50000000
00173 
00174 /* -mips64 code.  */
00175 #define E_MIPS_ARCH_64          0x60000000
00176 
00177 /* -mips32r2 code.  */
00178 #define E_MIPS_ARCH_32R2        0x70000000
00179 
00180 /* -mips64r2 code.  */
00181 #define E_MIPS_ARCH_64R2        0x80000000
00182 
00183 /* The ABI of the file.  Also see EF_MIPS_ABI2 above. */
00184 #define EF_MIPS_ABI         0x0000F000
00185 
00186 /* The original o32 abi. */
00187 #define E_MIPS_ABI_O32          0x00001000
00188 
00189 /* O32 extended to work on 64 bit architectures */
00190 #define E_MIPS_ABI_O64          0x00002000
00191 
00192 /* EABI in 32 bit mode */
00193 #define E_MIPS_ABI_EABI32       0x00003000
00194 
00195 /* EABI in 64 bit mode */
00196 #define E_MIPS_ABI_EABI64       0x00004000
00197 
00198 
00199 /* Machine variant if we know it.  This field was invented at Cygnus,
00200    but it is hoped that other vendors will adopt it.  If some standard
00201    is developed, this code should be changed to follow it. */
00202 
00203 #define EF_MIPS_MACH        0x00FF0000
00204 
00205 /* Cygnus is choosing values between 80 and 9F;
00206    00 - 7F should be left for a future standard;
00207    the rest are open. */
00208 
00209 #define E_MIPS_MACH_3900    0x00810000
00210 #define E_MIPS_MACH_4010    0x00820000
00211 #define E_MIPS_MACH_4100    0x00830000
00212 #define E_MIPS_MACH_4650    0x00850000
00213 #define E_MIPS_MACH_4120    0x00870000
00214 #define E_MIPS_MACH_4111    0x00880000
00215 #define E_MIPS_MACH_SB1         0x008a0000
00216 #define E_MIPS_MACH_5400    0x00910000
00217 #define E_MIPS_MACH_5500    0x00980000
00218 #define E_MIPS_MACH_9000    0x00990000
00219 
00220 /* Processor specific section indices.  These sections do not actually
00221    exist.  Symbols with a st_shndx field corresponding to one of these
00222    values have a special meaning.  */
00223 
00224 /* Defined and allocated common symbol.  Value is virtual address.  If
00225    relocated, alignment must be preserved.  */
00226 #define SHN_MIPS_ACOMMON    0xff00
00227 
00228 /* Defined and allocated text symbol.  Value is virtual address.
00229    Occur in the dynamic symbol table of Alpha OSF/1 and Irix 5 executables.  */
00230 #define SHN_MIPS_TEXT              0xff01
00231 
00232 /* Defined and allocated data symbol.  Value is virtual address.
00233    Occur in the dynamic symbol table of Alpha OSF/1 and Irix 5 executables.  */
00234 #define SHN_MIPS_DATA              0xff02
00235 
00236 /* Small common symbol.  */
00237 #define SHN_MIPS_SCOMMON    0xff03
00238 
00239 /* Small undefined symbol.  */
00240 #define SHN_MIPS_SUNDEFINED 0xff04
00241 
00242 /* Processor specific section types.  */
00243 
00244 /* Section contains the set of dynamic shared objects used when
00245    statically linking.  */
00246 #define SHT_MIPS_LIBLIST    0x70000000
00247 
00248 /* I'm not sure what this is, but it's used on Irix 5.  */
00249 #define SHT_MIPS_MSYM              0x70000001
00250 
00251 /* Section contains list of symbols whose definitions conflict with
00252    symbols defined in shared objects.  */
00253 #define SHT_MIPS_CONFLICT   0x70000002
00254 
00255 /* Section contains the global pointer table.  */
00256 #define SHT_MIPS_GPTAB             0x70000003
00257 
00258 /* Section contains microcode information.  The exact format is
00259    unspecified.  */
00260 #define SHT_MIPS_UCODE             0x70000004
00261 
00262 /* Section contains some sort of debugging information.  The exact
00263    format is unspecified.  It's probably ECOFF symbols.  */
00264 #define SHT_MIPS_DEBUG             0x70000005
00265 
00266 /* Section contains register usage information.  */
00267 #define SHT_MIPS_REGINFO    0x70000006
00268 
00269 /* ??? */
00270 #define SHT_MIPS_PACKAGE    0x70000007
00271 
00272 /* ??? */
00273 #define SHT_MIPS_PACKSYM    0x70000008
00274 
00275 /* ??? */
00276 #define SHT_MIPS_RELD              0x70000009
00277 
00278 /* Section contains interface information.  */
00279 #define SHT_MIPS_IFACE             0x7000000b
00280 
00281 /* Section contains description of contents of another section.  */
00282 #define SHT_MIPS_CONTENT    0x7000000c
00283 
00284 /* Section contains miscellaneous options.  */
00285 #define SHT_MIPS_OPTIONS    0x7000000d
00286 
00287 /* ??? */
00288 #define SHT_MIPS_SHDR              0x70000010
00289 
00290 /* ??? */
00291 #define SHT_MIPS_FDESC             0x70000011
00292 
00293 /* ??? */
00294 #define SHT_MIPS_EXTSYM            0x70000012
00295 
00296 /* ??? */
00297 #define SHT_MIPS_DENSE             0x70000013
00298 
00299 /* ??? */
00300 #define SHT_MIPS_PDESC             0x70000014
00301 
00302 /* ??? */
00303 #define SHT_MIPS_LOCSYM            0x70000015
00304 
00305 /* ??? */
00306 #define SHT_MIPS_AUXSYM            0x70000016
00307 
00308 /* ??? */
00309 #define SHT_MIPS_OPTSYM            0x70000017
00310 
00311 /* ??? */
00312 #define SHT_MIPS_LOCSTR            0x70000018
00313 
00314 /* ??? */
00315 #define SHT_MIPS_LINE              0x70000019
00316 
00317 /* ??? */
00318 #define SHT_MIPS_RFDESC            0x7000001a
00319 
00320 /* Delta C++: symbol table */
00321 #define SHT_MIPS_DELTASYM   0x7000001b
00322 
00323 /* Delta C++: instance table */
00324 #define SHT_MIPS_DELTAINST  0x7000001c
00325 
00326 /* Delta C++: class table */
00327 #define SHT_MIPS_DELTACLASS 0x7000001d
00328 
00329 /* DWARF debugging section.  */
00330 #define SHT_MIPS_DWARF             0x7000001e
00331 
00332 /* Delta C++: declarations */
00333 #define SHT_MIPS_DELTADECL  0x7000001f
00334 
00335 /* List of libraries the binary depends on.  Includes a time stamp, version
00336    number.  */
00337 #define SHT_MIPS_SYMBOL_LIB 0x70000020
00338 
00339 /* Events section.  */
00340 #define SHT_MIPS_EVENTS            0x70000021
00341 
00342 /* ??? */
00343 #define SHT_MIPS_TRANSLATE  0x70000022
00344 
00345 /* Special pixie sections */
00346 #define SHT_MIPS_PIXIE             0x70000023
00347 
00348 /* Address translation table (for debug info) */
00349 #define SHT_MIPS_XLATE             0x70000024
00350 
00351 /* SGI internal address translation table (for debug info) */
00352 #define SHT_MIPS_XLATE_DEBUG       0x70000025
00353 
00354 /* Intermediate code */
00355 #define SHT_MIPS_WHIRL             0x70000026
00356 
00357 /* C++ exception handling region info */
00358 #define SHT_MIPS_EH_REGION  0x70000027
00359 
00360 /* Obsolete address translation table (for debug info) */
00361 #define SHT_MIPS_XLATE_OLD  0x70000028
00362 
00363 /* Runtime procedure descriptor table exception information (ucode) ??? */
00364 #define SHT_MIPS_PDR_EXCEPTION     0x70000029
00365 
00366 
00367 /* A section of type SHT_MIPS_LIBLIST contains an array of the
00368    following structure.  The sh_link field is the section index of the
00369    string table.  The sh_info field is the number of entries in the
00370    section.  */
00371 typedef struct
00372 {
00373   /* String table index for name of shared object.  */
00374   unsigned long l_name;
00375   /* Time stamp.  */
00376   unsigned long l_time_stamp;
00377   /* Checksum of symbol names and common sizes.  */
00378   unsigned long l_checksum;
00379   /* String table index for version.  */
00380   unsigned long l_version;
00381   /* Flags.  */
00382   unsigned long l_flags;
00383 } Elf32_Lib;
00384 
00385 /* The external version of Elf32_Lib.  */
00386 typedef struct
00387 {
00388   unsigned char l_name[4];
00389   unsigned char l_time_stamp[4];
00390   unsigned char l_checksum[4];
00391   unsigned char l_version[4];
00392   unsigned char l_flags[4];
00393 } Elf32_External_Lib;
00394 
00395 /* The l_flags field of an Elf32_Lib structure may contain the
00396    following flags.  */
00397 
00398 /* Require an exact match at runtime.  */
00399 #define LL_EXACT_MATCH             0x00000001
00400 
00401 /* Ignore version incompatibilities at runtime.  */
00402 #define LL_IGNORE_INT_VER   0x00000002
00403 
00404 /* Require matching minor version number.  */
00405 #define LL_REQUIRE_MINOR    0x00000004
00406 
00407 /* ??? */
00408 #define LL_EXPORTS          0x00000008
00409 
00410 /* Delay loading of this library until really needed.  */
00411 #define LL_DELAY_LOAD              0x00000010
00412 
00413 /* ??? Delta C++ stuff ??? */
00414 #define LL_DELTA            0x00000020
00415 
00416 
00417 /* A section of type SHT_MIPS_CONFLICT is an array of indices into the
00418    .dynsym section.  Each element has the following type.  */
00419 typedef unsigned long Elf32_Conflict;
00420 typedef unsigned char Elf32_External_Conflict[4];
00421 
00422 typedef unsigned long Elf64_Conflict;
00423 typedef unsigned char Elf64_External_Conflict[8];
00424 
00425 /* A section of type SHT_MIPS_GPTAB contains information about how
00426    much GP space would be required for different -G arguments.  This
00427    information is only used so that the linker can provide informative
00428    suggestions as to the best -G value to use.  The sh_info field is
00429    the index of the section for which this information applies.  The
00430    contents of the section are an array of the following union.  The
00431    first element uses the gt_header field.  The remaining elements use
00432    the gt_entry field.  */
00433 typedef union
00434 {
00435   struct
00436     {
00437       /* -G value actually used for this object file.  */
00438       unsigned long gt_current_g_value;
00439       /* Unused.  */
00440       unsigned long gt_unused;
00441     } gt_header;
00442   struct
00443     {
00444       /* If this -G argument has been used...  */
00445       unsigned long gt_g_value;
00446       /* ...this many GP section bytes would be required.  */
00447       unsigned long gt_bytes;
00448     } gt_entry;
00449 } Elf32_gptab;
00450 
00451 /* The external version of Elf32_gptab.  */
00452 
00453 typedef union
00454 {
00455   struct
00456     {
00457       unsigned char gt_current_g_value[4];
00458       unsigned char gt_unused[4];
00459     } gt_header;
00460   struct
00461     {
00462       unsigned char gt_g_value[4];
00463       unsigned char gt_bytes[4];
00464     } gt_entry;
00465 } Elf32_External_gptab;
00466 
00467 /* A section of type SHT_MIPS_REGINFO contains the following
00468    structure.  */
00469 typedef struct
00470 {
00471   /* Mask of general purpose registers used.  */
00472   unsigned long ri_gprmask;
00473   /* Mask of co-processor registers used.  */
00474   unsigned long ri_cprmask[4];
00475   /* GP register value for this object file.  */
00476   long ri_gp_value;
00477 } Elf32_RegInfo;
00478 
00479 /* The external version of the Elf_RegInfo structure.  */
00480 typedef struct
00481 {
00482   unsigned char ri_gprmask[4];
00483   unsigned char ri_cprmask[4][4];
00484   unsigned char ri_gp_value[4];
00485 } Elf32_External_RegInfo;
00486 
00487 /* MIPS ELF .reginfo swapping routines.  */
00488 extern void bfd_mips_elf32_swap_reginfo_in
00489   (bfd *, const Elf32_External_RegInfo *, Elf32_RegInfo *);
00490 extern void bfd_mips_elf32_swap_reginfo_out
00491   (bfd *, const Elf32_RegInfo *, Elf32_External_RegInfo *);
00492 
00493 /* Processor specific section flags.  */
00494 
00495 /* This section must be in the global data area.  */
00496 #define SHF_MIPS_GPREL             0x10000000
00497 
00498 /* This section should be merged.  */
00499 #define SHF_MIPS_MERGE             0x20000000
00500 
00501 /* This section contains address data of size implied by section
00502    element size.  */
00503 #define SHF_MIPS_ADDR              0x40000000
00504 
00505 /* This section contains string data.  */
00506 #define SHF_MIPS_STRING            0x80000000
00507 
00508 /* This section may not be stripped.  */
00509 #define SHF_MIPS_NOSTRIP    0x08000000
00510 
00511 /* This section is local to threads.  */
00512 #define SHF_MIPS_LOCAL             0x04000000
00513 
00514 /* Linker should generate implicit weak names for this section.  */
00515 #define SHF_MIPS_NAMES             0x02000000
00516 
00517 /* Section contais text/data which may be replicated in other sections.
00518    Linker should retain only one copy.  */
00519 #define SHF_MIPS_NODUPES    0x01000000
00520 
00521 /* Processor specific program header types.  */
00522 
00523 /* Register usage information.  Identifies one .reginfo section.  */
00524 #define PT_MIPS_REGINFO            0x70000000
00525 
00526 /* Runtime procedure table.  */
00527 #define PT_MIPS_RTPROC             0x70000001
00528 
00529 /* .MIPS.options section.  */
00530 #define PT_MIPS_OPTIONS            0x70000002
00531 
00532 /* Processor specific dynamic array tags.  */
00533 
00534 /* 32 bit version number for runtime linker interface.  */
00535 #define DT_MIPS_RLD_VERSION 0x70000001
00536 
00537 /* Time stamp.  */
00538 #define DT_MIPS_TIME_STAMP  0x70000002
00539 
00540 /* Checksum of external strings and common sizes.  */
00541 #define DT_MIPS_ICHECKSUM   0x70000003
00542 
00543 /* Index of version string in string table.  */
00544 #define DT_MIPS_IVERSION    0x70000004
00545 
00546 /* 32 bits of flags.  */
00547 #define DT_MIPS_FLAGS              0x70000005
00548 
00549 /* Base address of the segment.  */
00550 #define DT_MIPS_BASE_ADDRESS       0x70000006
00551 
00552 /* ??? */
00553 #define DT_MIPS_MSYM        0x70000007
00554 
00555 /* Address of .conflict section.  */
00556 #define DT_MIPS_CONFLICT    0x70000008
00557 
00558 /* Address of .liblist section.  */
00559 #define DT_MIPS_LIBLIST            0x70000009
00560 
00561 /* Number of local global offset table entries.  */
00562 #define DT_MIPS_LOCAL_GOTNO 0x7000000a
00563 
00564 /* Number of entries in the .conflict section.  */
00565 #define DT_MIPS_CONFLICTNO  0x7000000b
00566 
00567 /* Number of entries in the .liblist section.  */
00568 #define DT_MIPS_LIBLISTNO   0x70000010
00569 
00570 /* Number of entries in the .dynsym section.  */
00571 #define DT_MIPS_SYMTABNO    0x70000011
00572 
00573 /* Index of first external dynamic symbol not referenced locally.  */
00574 #define DT_MIPS_UNREFEXTNO  0x70000012
00575 
00576 /* Index of first dynamic symbol in global offset table.  */
00577 #define DT_MIPS_GOTSYM             0x70000013
00578 
00579 /* Number of page table entries in global offset table.  */
00580 #define DT_MIPS_HIPAGENO    0x70000014
00581 
00582 /* Address of run time loader map, used for debugging.  */
00583 #define DT_MIPS_RLD_MAP            0x70000016
00584 
00585 /* Delta C++ class definition.  */
00586 #define DT_MIPS_DELTA_CLASS 0x70000017
00587 
00588 /* Number of entries in DT_MIPS_DELTA_CLASS.  */
00589 #define DT_MIPS_DELTA_CLASS_NO     0x70000018
00590 
00591 /* Delta C++ class instances.  */
00592 #define DT_MIPS_DELTA_INSTANCE     0x70000019
00593 
00594 /* Number of entries in DT_MIPS_DELTA_INSTANCE.  */
00595 #define DT_MIPS_DELTA_INSTANCE_NO  0x7000001a
00596 
00597 /* Delta relocations.  */
00598 #define DT_MIPS_DELTA_RELOC 0x7000001b
00599 
00600 /* Number of entries in DT_MIPS_DELTA_RELOC.  */
00601 #define DT_MIPS_DELTA_RELOC_NO     0x7000001c
00602 
00603 /* Delta symbols that Delta relocations refer to.  */
00604 #define DT_MIPS_DELTA_SYM   0x7000001d
00605 
00606 /* Number of entries in DT_MIPS_DELTA_SYM.  */
00607 #define DT_MIPS_DELTA_SYM_NO       0x7000001e
00608 
00609 /* Delta symbols that hold class declarations.  */
00610 #define DT_MIPS_DELTA_CLASSSYM     0x70000020
00611 
00612 /* Number of entries in DT_MIPS_DELTA_CLASSSYM.  */
00613 #define DT_MIPS_DELTA_CLASSSYM_NO  0x70000021
00614 
00615 /* Flags indicating information about C++ flavor.  */
00616 #define DT_MIPS_CXX_FLAGS   0x70000022
00617 
00618 /* Pixie information (???).  */
00619 #define DT_MIPS_PIXIE_INIT  0x70000023
00620 
00621 /* Address of .MIPS.symlib */
00622 #define DT_MIPS_SYMBOL_LIB  0x70000024
00623 
00624 /* The GOT index of the first PTE for a segment */
00625 #define DT_MIPS_LOCALPAGE_GOTIDX   0x70000025
00626 
00627 /* The GOT index of the first PTE for a local symbol */
00628 #define DT_MIPS_LOCAL_GOTIDX       0x70000026
00629 
00630 /* The GOT index of the first PTE for a hidden symbol */
00631 #define DT_MIPS_HIDDEN_GOTIDX      0x70000027
00632 
00633 /* The GOT index of the first PTE for a protected symbol */
00634 #define DT_MIPS_PROTECTED_GOTIDX   0x70000028
00635 
00636 /* Address of `.MIPS.options'.  */
00637 #define DT_MIPS_OPTIONS            0x70000029
00638 
00639 /* Address of `.interface'.  */
00640 #define DT_MIPS_INTERFACE   0x7000002a
00641 
00642 /* ??? */
00643 #define DT_MIPS_DYNSTR_ALIGN       0x7000002b
00644 
00645 /* Size of the .interface section.  */
00646 #define DT_MIPS_INTERFACE_SIZE     0x7000002c
00647 
00648 /* Size of rld_text_resolve function stored in the GOT.  */
00649 #define DT_MIPS_RLD_TEXT_RESOLVE_ADDR     0x7000002d
00650 
00651 /* Default suffix of DSO to be added by rld on dlopen() calls.  */
00652 #define DT_MIPS_PERF_SUFFIX 0x7000002e
00653 
00654 /* Size of compact relocation section (O32).  */
00655 #define DT_MIPS_COMPACT_SIZE       0x7000002f
00656 
00657 /* GP value for auxiliary GOTs.  */
00658 #define DT_MIPS_GP_VALUE    0x70000030
00659 
00660 /* Address of auxiliary .dynamic.  */
00661 #define DT_MIPS_AUX_DYNAMIC 0x70000031
00662 
00663 /* Flags which may appear in a DT_MIPS_FLAGS entry.  */
00664 
00665 /* No flags.  */
00666 #define RHF_NONE            0x00000000
00667 
00668 /* Uses shortcut pointers.  */
00669 #define RHF_QUICKSTART             0x00000001
00670 
00671 /* Hash size is not a power of two.  */
00672 #define RHF_NOTPOT          0x00000002
00673 
00674 /* Ignore LD_LIBRARY_PATH.  */
00675 #define RHS_NO_LIBRARY_REPLACEMENT 0x00000004
00676 
00677 /* DSO address may not be relocated. */
00678 #define RHF_NO_MOVE         0x00000008
00679 
00680 /* SGI specific features. */
00681 #define RHF_SGI_ONLY        0x00000010
00682 
00683 /* Guarantee that .init will finish executing before any non-init
00684    code in DSO is called. */
00685 #define RHF_GUARANTEE_INIT     0x00000020
00686 
00687 /* Contains Delta C++ code. */
00688 #define RHF_DELTA_C_PLUS_PLUS         0x00000040
00689 
00690 /* Guarantee that .init will start executing before any non-init
00691    code in DSO is called. */
00692 #define RHF_GUARANTEE_START_INIT   0x00000080
00693 
00694 /* Generated by pixie. */
00695 #define RHF_PIXIE              0x00000100
00696 
00697 /* Delay-load DSO by default. */
00698 #define RHF_DEFAULT_DELAY_LOAD        0x00000200
00699 
00700 /* Object may be requickstarted */
00701 #define RHF_REQUICKSTART       0x00000400
00702 
00703 /* Object has been requickstarted */
00704 #define RHF_REQUICKSTARTED     0x00000800
00705 
00706 /* Generated by cord. */
00707 #define RHF_CORD               0x00001000
00708 
00709 /* Object contains no unresolved undef symbols. */
00710 #define RHF_NO_UNRES_UNDEF     0x00002000
00711 
00712 /* Symbol table is in a safe order. */
00713 #define RHF_RLD_ORDER_SAFE     0x00004000
00714 
00715 /* Special values for the st_other field in the symbol table.  These
00716    are used in an Irix 5 dynamic symbol table.  */
00717 
00718 #define STO_DEFAULT         STV_DEFAULT
00719 #define STO_INTERNAL        STV_INTERNAL
00720 #define STO_HIDDEN          STV_HIDDEN
00721 #define STO_PROTECTED              STV_PROTECTED
00722 
00723 /* This value is used for a mips16 .text symbol.  */
00724 #define STO_MIPS16          0xf0
00725 
00726 /* This bit is used on Irix to indicate a symbol whose definition
00727    is optional - if, at final link time, it cannot be found, no
00728    error message should be produced.  */
00729 #define STO_OPTIONAL        (1 << 2)
00730 /* A macro to examine the STO_OPTIONAL bit.  */
00731 #define ELF_MIPS_IS_OPTIONAL(other)       ((other) & STO_OPTIONAL)
00732 
00733 /* The 64-bit MIPS ELF ABI uses an unusual reloc format.  Each
00734    relocation entry specifies up to three actual relocations, all at
00735    the same address.  The first relocation which required a symbol
00736    uses the symbol in the r_sym field.  The second relocation which
00737    requires a symbol uses the symbol in the r_ssym field.  If all
00738    three relocations require a symbol, the third one uses a zero
00739    value.  */
00740 
00741 /* An entry in a 64 bit SHT_REL section.  */
00742 
00743 typedef struct
00744 {
00745   /* Address of relocation.  */
00746   unsigned char r_offset[8];
00747   /* Symbol index.  */
00748   unsigned char r_sym[4];
00749   /* Special symbol.  */
00750   unsigned char r_ssym[1];
00751   /* Third relocation.  */
00752   unsigned char r_type3[1];
00753   /* Second relocation.  */
00754   unsigned char r_type2[1];
00755   /* First relocation.  */
00756   unsigned char r_type[1];
00757 } Elf64_Mips_External_Rel;
00758 
00759 typedef struct
00760 {
00761   /* Address of relocation.  */
00762   bfd_vma r_offset;
00763   /* Symbol index.  */
00764   unsigned long r_sym;
00765   /* Special symbol.  */
00766   unsigned char r_ssym;
00767   /* Third relocation.  */
00768   unsigned char r_type3;
00769   /* Second relocation.  */
00770   unsigned char r_type2;
00771   /* First relocation.  */
00772   unsigned char r_type;
00773 } Elf64_Mips_Internal_Rel;
00774 
00775 /* An entry in a 64 bit SHT_RELA section.  */
00776 
00777 typedef struct
00778 {
00779   /* Address of relocation.  */
00780   unsigned char r_offset[8];
00781   /* Symbol index.  */
00782   unsigned char r_sym[4];
00783   /* Special symbol.  */
00784   unsigned char r_ssym[1];
00785   /* Third relocation.  */
00786   unsigned char r_type3[1];
00787   /* Second relocation.  */
00788   unsigned char r_type2[1];
00789   /* First relocation.  */
00790   unsigned char r_type[1];
00791   /* Addend.  */
00792   unsigned char r_addend[8];
00793 } Elf64_Mips_External_Rela;
00794 
00795 typedef struct
00796 {
00797   /* Address of relocation.  */
00798   bfd_vma r_offset;
00799   /* Symbol index.  */
00800   unsigned long r_sym;
00801   /* Special symbol.  */
00802   unsigned char r_ssym;
00803   /* Third relocation.  */
00804   unsigned char r_type3;
00805   /* Second relocation.  */
00806   unsigned char r_type2;
00807   /* First relocation.  */
00808   unsigned char r_type;
00809   /* Addend.  */
00810   bfd_signed_vma r_addend;
00811 } Elf64_Mips_Internal_Rela;
00812 
00813 /* MIPS ELF 64 relocation info access macros.  */
00814 #define ELF64_MIPS_R_SSYM(i) (((i) >> 24) & 0xff)
00815 #define ELF64_MIPS_R_TYPE3(i) (((i) >> 16) & 0xff)
00816 #define ELF64_MIPS_R_TYPE2(i) (((i) >> 8) & 0xff)
00817 #define ELF64_MIPS_R_TYPE(i) ((i) & 0xff)
00818 
00819 /* Values found in the r_ssym field of a relocation entry.  */
00820 
00821 /* No relocation.  */
00822 #define RSS_UNDEF    0
00823 
00824 /* Value of GP.  */
00825 #define RSS_GP              1
00826 
00827 /* Value of GP in object being relocated.  */
00828 #define RSS_GP0             2
00829 
00830 /* Address of location being relocated.  */
00831 #define RSS_LOC             3
00832 
00833 /* A SHT_MIPS_OPTIONS section contains a series of options, each of
00834    which starts with this header.  */
00835 
00836 typedef struct
00837 {
00838   /* Type of option.  */
00839   unsigned char kind[1];
00840   /* Size of option descriptor, including header.  */
00841   unsigned char size[1];
00842   /* Section index of affected section, or 0 for global option.  */
00843   unsigned char section[2];
00844   /* Information specific to this kind of option.  */
00845   unsigned char info[4];
00846 } Elf_External_Options;
00847 
00848 typedef struct
00849 {
00850   /* Type of option.  */
00851   unsigned char kind;
00852   /* Size of option descriptor, including header.  */
00853   unsigned char size;
00854   /* Section index of affected section, or 0 for global option.  */
00855   unsigned short section;
00856   /* Information specific to this kind of option.  */
00857   unsigned long info;
00858 } Elf_Internal_Options;
00859 
00860 /* MIPS ELF option header swapping routines.  */
00861 extern void bfd_mips_elf_swap_options_in
00862   (bfd *, const Elf_External_Options *, Elf_Internal_Options *);
00863 extern void bfd_mips_elf_swap_options_out
00864   (bfd *, const Elf_Internal_Options *, Elf_External_Options *);
00865 
00866 /* Values which may appear in the kind field of an Elf_Options
00867    structure.  */
00868 
00869 /* Undefined.  */
00870 #define ODK_NULL     0
00871 
00872 /* Register usage and GP value.  */
00873 #define ODK_REGINFO  1
00874 
00875 /* Exception processing information.  */
00876 #define ODK_EXCEPTIONS      2
00877 
00878 /* Section padding information.  */
00879 #define ODK_PAD             3
00880 
00881 /* Hardware workarounds performed.  */
00882 #define ODK_HWPATCH  4
00883 
00884 /* Fill value used by the linker.  */
00885 #define ODK_FILL     5
00886 
00887 /* Reserved space for desktop tools.  */
00888 #define ODK_TAGS     6
00889 
00890 /* Hardware workarounds, AND bits when merging.  */
00891 #define ODK_HWAND    7
00892 
00893 /* Hardware workarounds, OR bits when merging.  */
00894 #define ODK_HWOR     8
00895 
00896 /* GP group to use for text/data sections.  */
00897 #define ODK_GP_GROUP 9
00898 
00899 /* ID information.  */
00900 #define ODK_IDENT    10
00901 
00902 /* In the 32 bit ABI, an ODK_REGINFO option is just a Elf32_RegInfo
00903    structure.  In the 64 bit ABI, it is the following structure.  The
00904    info field of the options header is not used.  */
00905 
00906 typedef struct
00907 {
00908   /* Mask of general purpose registers used.  */
00909   unsigned char ri_gprmask[4];
00910   /* Padding.  */
00911   unsigned char ri_pad[4];
00912   /* Mask of co-processor registers used.  */
00913   unsigned char ri_cprmask[4][4];
00914   /* GP register value for this object file.  */
00915   unsigned char ri_gp_value[8];
00916 } Elf64_External_RegInfo;
00917 
00918 typedef struct
00919 {
00920   /* Mask of general purpose registers used.  */
00921   unsigned long ri_gprmask;
00922   /* Padding.  */
00923   unsigned long ri_pad;
00924   /* Mask of co-processor registers used.  */
00925   unsigned long ri_cprmask[4];
00926   /* GP register value for this object file.  */
00927   bfd_vma ri_gp_value;
00928 } Elf64_Internal_RegInfo;
00929 
00930 typedef struct
00931 {
00932   /* The hash value computed from the name of the corresponding
00933      dynamic symbol.  */
00934   unsigned char ms_hash_value[4];
00935   /* Contains both the dynamic relocation index and the symbol flags
00936      field.  The macros ELF32_MS_REL_INDEX and ELF32_MS_FLAGS are used
00937      to access the individual values.  The dynamic relocation index
00938      identifies the first entry in the .rel.dyn section that
00939      references the dynamic symbol corresponding to this msym entry.
00940      If the index is 0, no dynamic relocations are associated with the
00941      symbol.  The symbol flags field is reserved for future use.  */
00942   unsigned char ms_info[4];
00943 } Elf32_External_Msym;
00944 
00945 typedef struct
00946 {
00947   /* The hash value computed from the name of the corresponding
00948      dynamic symbol.  */
00949   unsigned long ms_hash_value;
00950   /* Contains both the dynamic relocation index and the symbol flags
00951      field.  The macros ELF32_MS_REL_INDEX and ELF32_MS_FLAGS are used
00952      to access the individual values.  The dynamic relocation index
00953      identifies the first entry in the .rel.dyn section that
00954      references the dynamic symbol corresponding to this msym entry.
00955      If the index is 0, no dynamic relocations are associated with the
00956      symbol.  The symbol flags field is reserved for future use.  */
00957   unsigned long ms_info;
00958 } Elf32_Internal_Msym;
00959 
00960 #define ELF32_MS_REL_INDEX(i) ((i) >> 8)
00961 #define ELF32_MS_FLAGS(i)     (i) & 0xff)
00962 #define ELF32_MS_INFO(r, f)   (((r) << 8) + ((f) & 0xff))
00963 
00964 /* MIPS ELF reginfo swapping routines.  */
00965 extern void bfd_mips_elf64_swap_reginfo_in
00966   (bfd *, const Elf64_External_RegInfo *, Elf64_Internal_RegInfo *);
00967 extern void bfd_mips_elf64_swap_reginfo_out
00968   (bfd *, const Elf64_Internal_RegInfo *, Elf64_External_RegInfo *);
00969 
00970 /* Masks for the info work of an ODK_EXCEPTIONS descriptor.  */
00971 #define OEX_FPU_MIN  0x1f   /* FPEs which must be enabled.  */
00972 #define OEX_FPU_MAX  0x1f00 /* FPEs which may be enabled.  */
00973 #define OEX_PAGE0    0x10000       /* Page zero must be mapped.  */
00974 #define OEX_SMM             0x20000       /* Force sequential memory mode.  */
00975 #define OEX_FPDBUG   0x40000       /* Force precise floating-point
00976                                exceptions (debug mode).  */
00977 #define OEX_DISMISS  0x80000       /* Dismiss invalid address faults.  */
00978 
00979 /* Masks of the FP exceptions for OEX_FPU_MIN and OEX_FPU_MAX.  */
00980 #define OEX_FPU_INVAL       0x10   /* Invalid operation exception.  */
00981 #define OEX_FPU_DIV0 0x08   /* Division by zero exception.  */
00982 #define OEX_FPU_OFLO 0x04   /* Overflow exception.  */
00983 #define OEX_FPU_UFLO 0x02   /* Underflow exception.  */
00984 #define OEX_FPU_INEX 0x01   /* Inexact exception.  */
00985 
00986 /* Masks for the info word of an ODK_PAD descriptor.  */
00987 #define OPAD_PREFIX  0x01
00988 #define OPAD_POSTFIX 0x02
00989 #define OPAD_SYMBOL  0x04
00990 
00991 /* Masks for the info word of an ODK_HWPATCH descriptor.  */
00992 #define OHW_R4KEOP   0x00000001    /* R4000 end-of-page patch.  */
00993 #define OHW_R8KPFETCH       0x00000002    /* May need R8000 prefetch patch.  */
00994 #define OHW_R5KEOP   0x00000004    /* R5000 end-of-page patch.  */
00995 #define OHW_R5KCVTL  0x00000008    /* R5000 cvt.[ds].l bug
00996                                       (clean == 1).  */
00997 #define OHW_R10KLDL  0x00000010    /* Needs R10K misaligned
00998                                       load patch. */
00999 
01000 /* Masks for the info word of an ODK_IDENT/ODK_GP_GROUP descriptor.  */
01001 #define OGP_GROUP    0x0000ffff    /* GP group number.  */
01002 #define OGP_SELF     0xffff0000    /* Self-contained GP groups.  */
01003 
01004 /* Masks for the info word of an ODK_HWAND/ODK_HWOR descriptor.  */
01005 #define OHWA0_R4KEOP_CHECKED       0x00000001
01006 #define OHWA0_R4KEOP_CLEAN  0x00000002
01007 
01008 
01009 #endif /* _ELF_MIPS_H */