📄 ecoff.h
字号:
/* Generic ECOFF support. This does not include symbol information, found in sym.h and symconst.h. Copyright 2001, 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the 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 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */#ifndef ECOFF_H#define ECOFF_H/* Mips magic numbers used in filehdr. MIPS_MAGIC_LITTLE is used on little endian machines. MIPS_MAGIC_BIG is used on big endian machines. Where is MIPS_MAGIC_1 from? */#define MIPS_MAGIC_1 0x0180#define MIPS_MAGIC_LITTLE 0x0162#define MIPS_MAGIC_BIG 0x0160/* These are the magic numbers used for MIPS code compiled at ISA level 2. */#define MIPS_MAGIC_LITTLE2 0x0166#define MIPS_MAGIC_BIG2 0x0163/* These are the magic numbers used for MIPS code compiled at ISA level 3. */#define MIPS_MAGIC_LITTLE3 0x142#define MIPS_MAGIC_BIG3 0x140/* Alpha magic numbers used in filehdr. */#define ALPHA_MAGIC 0x183#define ALPHA_MAGIC_BSD 0x185/* Magic numbers used in a.out header. */#define ECOFF_AOUT_OMAGIC 0407 /* not demand paged (ld -N). */#define ECOFF_AOUT_ZMAGIC 0413 /* demand load format, eg normal ld output *//* Names of special sections. */#define _TEXT ".text"#define _DATA ".data"#define _BSS ".bss"#define _RDATA ".rdata"#define _SDATA ".sdata"#define _SBSS ".sbss"#define _LITA ".lita"#define _LIT4 ".lit4"#define _LIT8 ".lit8"#define _LIB ".lib"#define _INIT ".init"#define _FINI ".fini"#define _PDATA ".pdata"#define _XDATA ".xdata"#define _GOT ".got"#define _HASH ".hash"#define _DYNSYM ".dynsym"#define _DYNSTR ".dynstr"#define _RELDYN ".rel.dyn"#define _CONFLIC ".conflic"#define _COMMENT ".comment"#define _LIBLIST ".liblist"#define _DYNAMIC ".dynamic"#define _RCONST ".rconst"/* ECOFF uses some additional section flags. */#define STYP_RDATA 0x100#define STYP_SDATA 0x200#define STYP_SBSS 0x400#define STYP_GOT 0x1000#define STYP_DYNAMIC 0x2000#define STYP_DYNSYM 0x4000#define STYP_RELDYN 0x8000#define STYP_DYNSTR 0x10000#define STYP_HASH 0x20000#define STYP_LIBLIST 0x40000#define STYP_CONFLIC 0x100000#define STYP_ECOFF_FINI 0x1000000#define STYP_EXTENDESC 0x2000000 /* 0x02FFF000 bits => scn type, rest clr */#define STYP_LITA 0x4000000#define STYP_LIT8 0x8000000#define STYP_LIT4 0x10000000#define STYP_ECOFF_LIB 0x40000000#define STYP_ECOFF_INIT 0x80000000#define STYP_OTHER_LOAD (STYP_ECOFF_INIT | STYP_ECOFF_FINI)/* extended section types */#define STYP_COMMENT 0x2100000#define STYP_RCONST 0x2200000#define STYP_XDATA 0x2400000#define STYP_PDATA 0x2800000/* The linker needs a section to hold small common variables while linking. There is no convenient way to create it when the linker needs it, so we always create one for each BFD. We then avoid writing it out. */#define SCOMMON ".scommon"/* If the extern bit in a reloc is 1, then r_symndx is an index into the external symbol table. If the extern bit is 0, then r_symndx indicates a section, and is one of the following values. */#define RELOC_SECTION_NONE 0#define RELOC_SECTION_TEXT 1#define RELOC_SECTION_RDATA 2#define RELOC_SECTION_DATA 3#define RELOC_SECTION_SDATA 4#define RELOC_SECTION_SBSS 5#define RELOC_SECTION_BSS 6#define RELOC_SECTION_INIT 7#define RELOC_SECTION_LIT8 8#define RELOC_SECTION_LIT4 9#define RELOC_SECTION_XDATA 10#define RELOC_SECTION_PDATA 11#define RELOC_SECTION_FINI 12#define RELOC_SECTION_LITA 13#define RELOC_SECTION_ABS 14#define RELOC_SECTION_RCONST 15#define NUM_RELOC_SECTIONS 16/********************** STABS **********************//* gcc uses mips-tfile to output type information in special stabs entries. These must match the corresponding definition in gcc/config/mips.h. At some point, these should probably go into a shared include file, but currently gcc and gdb do not share any directories. */#define CODE_MASK 0x8F300#define ECOFF_IS_STAB(sym) (((sym)->index & 0xFFF00) == CODE_MASK)#define ECOFF_MARK_STAB(code) ((code)+CODE_MASK)#define ECOFF_UNMARK_STAB(code) ((code)-CODE_MASK)#define STABS_SYMBOL "@stabs"/********************** COFF **********************//* gcc also uses mips-tfile to output COFF debugging information. These are the values it uses when outputting the .type directive. These should also be in a shared include file. */#define N_BTMASK (017)#define N_TMASK (060)#define N_BTSHFT (4)#define N_TSHIFT (2)/********************** AUX **********************//* The auxiliary type information is the same on all known ECOFF targets. I can't see any reason that it would ever change, so I am going to gamble and define the external structures here, in the target independent ECOFF header file. The internal forms are defined in coff/sym.h, which was originally donated by MIPS Computer Systems. *//* Type information external record */struct tir_ext { unsigned char t_bits1[1]; unsigned char t_tq45[1]; unsigned char t_tq01[1]; unsigned char t_tq23[1];};#define TIR_BITS1_FBITFIELD_BIG ((unsigned int) 0x80)#define TIR_BITS1_FBITFIELD_LITTLE ((unsigned int) 0x01)#define TIR_BITS1_CONTINUED_BIG ((unsigned int) 0x40)#define TIR_BITS1_CONTINUED_LITTLE ((unsigned int) 0x02)#define TIR_BITS1_BT_BIG ((unsigned int) 0x3F)#define TIR_BITS1_BT_SH_BIG 0#define TIR_BITS1_BT_LITTLE ((unsigned int) 0xFC)#define TIR_BITS1_BT_SH_LITTLE 2#define TIR_BITS_TQ4_BIG ((unsigned int) 0xF0)#define TIR_BITS_TQ4_SH_BIG 4#define TIR_BITS_TQ5_BIG ((unsigned int) 0x0F)#define TIR_BITS_TQ5_SH_BIG 0#define TIR_BITS_TQ4_LITTLE ((unsigned int) 0x0F)#define TIR_BITS_TQ4_SH_LITTLE 0#define TIR_BITS_TQ5_LITTLE ((unsigned int) 0xF0)#define TIR_BITS_TQ5_SH_LITTLE 4#define TIR_BITS_TQ0_BIG ((unsigned int) 0xF0)#define TIR_BITS_TQ0_SH_BIG 4#define TIR_BITS_TQ1_BIG ((unsigned int) 0x0F)#define TIR_BITS_TQ1_SH_BIG 0#define TIR_BITS_TQ0_LITTLE ((unsigned int) 0x0F)#define TIR_BITS_TQ0_SH_LITTLE 0#define TIR_BITS_TQ1_LITTLE ((unsigned int) 0xF0)#define TIR_BITS_TQ1_SH_LITTLE 4#define TIR_BITS_TQ2_BIG ((unsigned int) 0xF0)#define TIR_BITS_TQ2_SH_BIG 4#define TIR_BITS_TQ3_BIG ((unsigned int) 0x0F)#define TIR_BITS_TQ3_SH_BIG 0#define TIR_BITS_TQ2_LITTLE ((unsigned int) 0x0F)#define TIR_BITS_TQ2_SH_LITTLE 0#define TIR_BITS_TQ3_LITTLE ((unsigned int) 0xF0)#define TIR_BITS_TQ3_SH_LITTLE 4/* Relative symbol external record */struct rndx_ext { unsigned char r_bits[4];};#define RNDX_BITS0_RFD_SH_LEFT_BIG 4#define RNDX_BITS1_RFD_BIG ((unsigned int) 0xF0)#define RNDX_BITS1_RFD_SH_BIG 4#define RNDX_BITS0_RFD_SH_LEFT_LITTLE 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -