📄 mips.h
字号:
/* MIPS ELF support for BFD. Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. By Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>, from information in the System V Application Binary Interface, MIPS Processor Supplement.This file is part of BFD, the Binary File Descriptor library.This program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2 of the License, or(at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *//* This file holds definitions specific to the MIPS ELF ABI. Note that most of this is not actually implemented by BFD. */#ifndef _ELF_MIPS_H#define _ELF_MIPS_H#include "elf/reloc-macros.h"/* Relocation types. */START_RELOC_NUMBERS (elf_mips_reloc_type) RELOC_NUMBER (R_MIPS_NONE, 0) RELOC_NUMBER (R_MIPS_16, 1) RELOC_NUMBER (R_MIPS_32, 2) /* In Elf 64: alias R_MIPS_ADD */ RELOC_NUMBER (R_MIPS_REL32, 3) /* In Elf 64: alias R_MIPS_REL */ RELOC_NUMBER (R_MIPS_26, 4) RELOC_NUMBER (R_MIPS_HI16, 5) RELOC_NUMBER (R_MIPS_LO16, 6) RELOC_NUMBER (R_MIPS_GPREL16, 7) /* In Elf 64: alias R_MIPS_GPREL */ RELOC_NUMBER (R_MIPS_LITERAL, 8) RELOC_NUMBER (R_MIPS_GOT16, 9) /* In Elf 64: alias R_MIPS_GOT */ RELOC_NUMBER (R_MIPS_PC16, 10) RELOC_NUMBER (R_MIPS_CALL16, 11) /* In Elf 64: alias R_MIPS_CALL */ RELOC_NUMBER (R_MIPS_GPREL32, 12) /* The remaining relocs are defined on Irix, although they are not in the MIPS ELF ABI. */ RELOC_NUMBER (R_MIPS_UNUSED1, 13) RELOC_NUMBER (R_MIPS_UNUSED2, 14) RELOC_NUMBER (R_MIPS_UNUSED3, 15) RELOC_NUMBER (R_MIPS_SHIFT5, 16) RELOC_NUMBER (R_MIPS_SHIFT6, 17) RELOC_NUMBER (R_MIPS_64, 18) RELOC_NUMBER (R_MIPS_GOT_DISP, 19) RELOC_NUMBER (R_MIPS_GOT_PAGE, 20) RELOC_NUMBER (R_MIPS_GOT_OFST, 21) RELOC_NUMBER (R_MIPS_GOT_HI16, 22) RELOC_NUMBER (R_MIPS_GOT_LO16, 23) RELOC_NUMBER (R_MIPS_SUB, 24) RELOC_NUMBER (R_MIPS_INSERT_A, 25) RELOC_NUMBER (R_MIPS_INSERT_B, 26) RELOC_NUMBER (R_MIPS_DELETE, 27) RELOC_NUMBER (R_MIPS_HIGHER, 28) RELOC_NUMBER (R_MIPS_HIGHEST, 29) RELOC_NUMBER (R_MIPS_CALL_HI16, 30) RELOC_NUMBER (R_MIPS_CALL_LO16, 31) RELOC_NUMBER (R_MIPS_SCN_DISP, 32) RELOC_NUMBER (R_MIPS_REL16, 33) RELOC_NUMBER (R_MIPS_ADD_IMMEDIATE, 34) RELOC_NUMBER (R_MIPS_PJUMP, 35) RELOC_NUMBER (R_MIPS_RELGOT, 36) RELOC_NUMBER (R_MIPS_JALR, 37) RELOC_NUMBER (R_MIPS_max, 38) /* These relocs are used for the mips16. */ RELOC_NUMBER (R_MIPS16_26, 100) RELOC_NUMBER (R_MIPS16_GPREL, 101) /* This was a GNU extension used by embedded-PIC. It was co-opted by mips-linux for exception-handling data. It is no longer used, but should continue to be supported by the linker for backward compatibility. (GCC stopped using it in May, 2004.) */ RELOC_NUMBER (R_MIPS_PC32, 248) /* FIXME: this relocation is used internally by gas. */ RELOC_NUMBER (R_MIPS_GNU_REL16_S2, 250) /* These are GNU extensions to enable C++ vtable garbage collection. */ RELOC_NUMBER (R_MIPS_GNU_VTINHERIT, 253) RELOC_NUMBER (R_MIPS_GNU_VTENTRY, 254)END_RELOC_NUMBERS (R_MIPS_maxext)/* Processor specific flags for the ELF header e_flags field. *//* At least one .noreorder directive appears in the source. */#define EF_MIPS_NOREORDER 0x00000001/* File contains position independent code. */#define EF_MIPS_PIC 0x00000002/* Code in file uses the standard calling sequence for calling position independent code. */#define EF_MIPS_CPIC 0x00000004/* ??? Unknown flag, set in IRIX 6's BSDdup2.o in libbsd.a. */#define EF_MIPS_XGOT 0x00000008/* Code in file uses UCODE (obsolete) */#define EF_MIPS_UCODE 0x00000010/* Code in file uses new ABI (-n32 on Irix 6). */#define EF_MIPS_ABI2 0x00000020/* Process the .MIPS.options section first by ld */#define EF_MIPS_OPTIONS_FIRST 0x00000080/* Architectural Extensions used by this file */#define EF_MIPS_ARCH_ASE 0x0f000000/* Use MDMX multimedia extensions */#define EF_MIPS_ARCH_ASE_MDMX 0x08000000/* Use MIPS-16 ISA extensions */#define EF_MIPS_ARCH_ASE_M16 0x04000000/* Indicates code compiled for a 64-bit machine in 32-bit mode. (regs are 32-bits wide.) */#define EF_MIPS_32BITMODE 0x00000100/* Four bit MIPS architecture field. */#define EF_MIPS_ARCH 0xf0000000/* -mips1 code. */#define E_MIPS_ARCH_1 0x00000000/* -mips2 code. */#define E_MIPS_ARCH_2 0x10000000/* -mips3 code. */#define E_MIPS_ARCH_3 0x20000000/* -mips4 code. */#define E_MIPS_ARCH_4 0x30000000/* -mips5 code. */#define E_MIPS_ARCH_5 0x40000000/* -mips32 code. */#define E_MIPS_ARCH_32 0x50000000/* -mips64 code. */#define E_MIPS_ARCH_64 0x60000000/* -mips32r2 code. */#define E_MIPS_ARCH_32R2 0x70000000/* -mips64r2 code. */#define E_MIPS_ARCH_64R2 0x80000000/* The ABI of the file. Also see EF_MIPS_ABI2 above. */#define EF_MIPS_ABI 0x0000F000/* The original o32 abi. */#define E_MIPS_ABI_O32 0x00001000/* O32 extended to work on 64 bit architectures */#define E_MIPS_ABI_O64 0x00002000/* EABI in 32 bit mode */#define E_MIPS_ABI_EABI32 0x00003000/* EABI in 64 bit mode */#define E_MIPS_ABI_EABI64 0x00004000/* Machine variant if we know it. This field was invented at Cygnus, but it is hoped that other vendors will adopt it. If some standard is developed, this code should be changed to follow it. */#define EF_MIPS_MACH 0x00FF0000/* Cygnus is choosing values between 80 and 9F; 00 - 7F should be left for a future standard; the rest are open. */#define E_MIPS_MACH_3900 0x00810000#define E_MIPS_MACH_4010 0x00820000#define E_MIPS_MACH_4100 0x00830000#define E_MIPS_MACH_4650 0x00850000#define E_MIPS_MACH_4120 0x00870000#define E_MIPS_MACH_4111 0x00880000#define E_MIPS_MACH_SB1 0x008a0000#define E_MIPS_MACH_5400 0x00910000#define E_MIPS_MACH_5500 0x00980000/* Processor specific section indices. These sections do not actually exist. Symbols with a st_shndx field corresponding to one of these values have a special meaning. *//* Defined and allocated common symbol. Value is virtual address. If relocated, alignment must be preserved. */#define SHN_MIPS_ACOMMON 0xff00/* Defined and allocated text symbol. Value is virtual address. Occur in the dynamic symbol table of Alpha OSF/1 and Irix 5 executables. */#define SHN_MIPS_TEXT 0xff01/* Defined and allocated data symbol. Value is virtual address. Occur in the dynamic symbol table of Alpha OSF/1 and Irix 5 executables. */#define SHN_MIPS_DATA 0xff02/* Small common symbol. */#define SHN_MIPS_SCOMMON 0xff03/* Small undefined symbol. */#define SHN_MIPS_SUNDEFINED 0xff04/* Processor specific section types. *//* Section contains the set of dynamic shared objects used when statically linking. */#define SHT_MIPS_LIBLIST 0x70000000/* I'm not sure what this is, but it's used on Irix 5. */#define SHT_MIPS_MSYM 0x70000001/* Section contains list of symbols whose definitions conflict with symbols defined in shared objects. */#define SHT_MIPS_CONFLICT 0x70000002/* Section contains the global pointer table. */#define SHT_MIPS_GPTAB 0x70000003/* Section contains microcode information. The exact format is unspecified. */#define SHT_MIPS_UCODE 0x70000004/* Section contains some sort of debugging information. The exact format is unspecified. It's probably ECOFF symbols. */#define SHT_MIPS_DEBUG 0x70000005/* Section contains register usage information. */#define SHT_MIPS_REGINFO 0x70000006/* ??? */#define SHT_MIPS_PACKAGE 0x70000007/* ??? */#define SHT_MIPS_PACKSYM 0x70000008/* ??? */#define SHT_MIPS_RELD 0x70000009/* Section contains interface information. */#define SHT_MIPS_IFACE 0x7000000b/* Section contains description of contents of another section. */#define SHT_MIPS_CONTENT 0x7000000c/* Section contains miscellaneous options. */#define SHT_MIPS_OPTIONS 0x7000000d/* ??? */#define SHT_MIPS_SHDR 0x70000010/* ??? */#define SHT_MIPS_FDESC 0x70000011/* ??? */#define SHT_MIPS_EXTSYM 0x70000012/* ??? */#define SHT_MIPS_DENSE 0x70000013/* ??? */#define SHT_MIPS_PDESC 0x70000014/* ??? */#define SHT_MIPS_LOCSYM 0x70000015/* ??? */#define SHT_MIPS_AUXSYM 0x70000016/* ??? */#define SHT_MIPS_OPTSYM 0x70000017/* ??? */#define SHT_MIPS_LOCSTR 0x70000018/* ??? */#define SHT_MIPS_LINE 0x70000019/* ??? */#define SHT_MIPS_RFDESC 0x7000001a/* Delta C++: symbol table */#define SHT_MIPS_DELTASYM 0x7000001b/* Delta C++: instance table */#define SHT_MIPS_DELTAINST 0x7000001c/* Delta C++: class table */#define SHT_MIPS_DELTACLASS 0x7000001d/* DWARF debugging section. */#define SHT_MIPS_DWARF 0x7000001e/* Delta C++: declarations */#define SHT_MIPS_DELTADECL 0x7000001f/* List of libraries the binary depends on. Includes a time stamp, version number. */#define SHT_MIPS_SYMBOL_LIB 0x70000020/* Events section. */#define SHT_MIPS_EVENTS 0x70000021/* ??? */#define SHT_MIPS_TRANSLATE 0x70000022/* Special pixie sections */#define SHT_MIPS_PIXIE 0x70000023/* Address translation table (for debug info) */#define SHT_MIPS_XLATE 0x70000024/* SGI internal address translation table (for debug info) */#define SHT_MIPS_XLATE_DEBUG 0x70000025/* Intermediate code */#define SHT_MIPS_WHIRL 0x70000026/* C++ exception handling region info */#define SHT_MIPS_EH_REGION 0x70000027/* Obsolete address translation table (for debug info) */#define SHT_MIPS_XLATE_OLD 0x70000028/* Runtime procedure descriptor table exception information (ucode) ??? */#define SHT_MIPS_PDR_EXCEPTION 0x70000029/* A section of type SHT_MIPS_LIBLIST contains an array of the following structure. The sh_link field is the section index of the string table. The sh_info field is the number of entries in the section. */typedef struct{ /* String table index for name of shared object. */ unsigned long l_name; /* Time stamp. */ unsigned long l_time_stamp; /* Checksum of symbol names and common sizes. */ unsigned long l_checksum; /* String table index for version. */ unsigned long l_version; /* Flags. */ unsigned long l_flags;} Elf32_Lib;/* The external version of Elf32_Lib. */typedef struct{ unsigned char l_name[4]; unsigned char l_time_stamp[4]; unsigned char l_checksum[4]; unsigned char l_version[4]; unsigned char l_flags[4];} Elf32_External_Lib;/* The l_flags field of an Elf32_Lib structure may contain the following flags. *//* Require an exact match at runtime. */#define LL_EXACT_MATCH 0x00000001/* Ignore version incompatibilities at runtime. */#define LL_IGNORE_INT_VER 0x00000002/* Require matching minor version number. */#define LL_REQUIRE_MINOR 0x00000004/* ??? */#define LL_EXPORTS 0x00000008/* Delay loading of this library until really needed. */#define LL_DELAY_LOAD 0x00000010/* ??? Delta C++ stuff ??? */#define LL_DELTA 0x00000020/* A section of type SHT_MIPS_CONFLICT is an array of indices into the .dynsym section. Each element has the following type. */typedef unsigned long Elf32_Conflict;typedef unsigned char Elf32_External_Conflict[4];typedef unsigned long Elf64_Conflict;typedef unsigned char Elf64_External_Conflict[8];/* A section of type SHT_MIPS_GPTAB contains information about how much GP space would be required for different -G arguments. This information is only used so that the linker can provide informative suggestions as to the best -G value to use. The sh_info field is the index of the section for which this information applies. The contents of the section are an array of the following union. The first element uses the gt_header field. The remaining elements use the gt_entry field. */typedef union{ struct { /* -G value actually used for this object file. */ unsigned long gt_current_g_value; /* Unused. */ unsigned long gt_unused; } gt_header; struct { /* If this -G argument has been used... */ unsigned long gt_g_value; /* ...this many GP section bytes would be required. */ unsigned long gt_bytes; } gt_entry;} Elf32_gptab;/* The external version of Elf32_gptab. */typedef union{ struct { unsigned char gt_current_g_value[4]; unsigned char gt_unused[4]; } gt_header; struct { unsigned char gt_g_value[4]; unsigned char gt_bytes[4]; } gt_entry;} Elf32_External_gptab;/* A section of type SHT_MIPS_REGINFO contains the following structure. */typedef struct{ /* Mask of general purpose registers used. */ unsigned long ri_gprmask; /* Mask of co-processor registers used. */ unsigned long ri_cprmask[4]; /* GP register value for this object file. */ long ri_gp_value;} Elf32_RegInfo;/* The external version of the Elf_RegInfo structure. */typedef struct{ unsigned char ri_gprmask[4]; unsigned char ri_cprmask[4][4]; unsigned char ri_gp_value[4];} Elf32_External_RegInfo;/* MIPS ELF .reginfo swapping routines. */extern void bfd_mips_elf32_swap_reginfo_in (bfd *, const Elf32_External_RegInfo *, Elf32_RegInfo *);extern void bfd_mips_elf32_swap_reginfo_out (bfd *, const Elf32_RegInfo *, Elf32_External_RegInfo *);/* Processor specific section flags. *//* This section must be in the global data area. */#define SHF_MIPS_GPREL 0x10000000/* This section should be merged. */#define SHF_MIPS_MERGE 0x20000000/* This section contains address data of size implied by section element size. */#define SHF_MIPS_ADDR 0x40000000/* This section contains string data. */#define SHF_MIPS_STRING 0x80000000/* This section may not be stripped. */#define SHF_MIPS_NOSTRIP 0x08000000/* This section is local to threads. */#define SHF_MIPS_LOCAL 0x04000000/* Linker should generate implicit weak names for this section. */#define SHF_MIPS_NAMES 0x02000000
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -