123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872 |
- #ifndef GNU_COFF_INTERNAL_H
- #define GNU_COFF_INTERNAL_H 1
- #ifndef signed
- #ifndef __STDC__
- #define signed
- #endif
- #endif
- struct internal_extra_pe_filehdr
- {
-
- unsigned short e_magic;
- unsigned short e_cblp;
- unsigned short e_cp;
- unsigned short e_crlc;
- unsigned short e_cparhdr;
- unsigned short e_minalloc;
- unsigned short e_maxalloc;
- unsigned short e_ss;
- unsigned short e_sp;
- unsigned short e_csum;
- unsigned short e_ip;
- unsigned short e_cs;
- unsigned short e_lfarlc;
- unsigned short e_ovno;
- unsigned short e_res[4];
- unsigned short e_oemid;
- unsigned short e_oeminfo;
- unsigned short e_res2[10];
- bfd_vma e_lfanew;
- unsigned long dos_message[16];
- bfd_vma nt_signature;
- };
- #define GO32_STUBSIZE 2048
- struct internal_filehdr
- {
- struct internal_extra_pe_filehdr pe;
-
- char go32stub[GO32_STUBSIZE];
-
- unsigned short f_magic;
- unsigned int f_nscns;
- long f_timdat;
- bfd_vma f_symptr;
- long f_nsyms;
- unsigned short f_opthdr;
- unsigned short f_flags;
- unsigned short f_target_id;
- };
- #define F_RELFLG (0x0001)
- #define F_EXEC (0x0002)
- #define F_LNNO (0x0004)
- #define F_LSYMS (0x0008)
- #define F_AR16WR (0x0080)
- #define F_AR32WR (0x0100)
- #define F_AR32W (0x0200)
- #define F_DYNLOAD (0x1000)
- #define F_SHROBJ (0x2000)
- #define F_DLL (0x2000)
- #define F_GO32STUB (0x4000)
- typedef struct _IMAGE_DATA_DIRECTORY
- {
- bfd_vma VirtualAddress;
- long Size;
- } IMAGE_DATA_DIRECTORY;
- #define PE_EXPORT_TABLE 0
- #define PE_IMPORT_TABLE 1
- #define PE_RESOURCE_TABLE 2
- #define PE_EXCEPTION_TABLE 3
- #define PE_CERTIFICATE_TABLE 4
- #define PE_BASE_RELOCATION_TABLE 5
- #define PE_DEBUG_DATA 6
- #define PE_ARCHITECTURE 7
- #define PE_GLOBAL_PTR 8
- #define PE_TLS_TABLE 9
- #define PE_LOAD_CONFIG_TABLE 10
- #define PE_BOUND_IMPORT_TABLE 11
- #define PE_IMPORT_ADDRESS_TABLE 12
- #define PE_DELAY_IMPORT_DESCRIPTOR 13
- #define PE_CLR_RUNTIME_HEADER 14
- #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
- struct internal_IMAGE_DEBUG_DIRECTORY
- {
- unsigned long Characteristics;
- unsigned long TimeDateStamp;
- unsigned short MajorVersion;
- unsigned short MinorVersion;
- unsigned long Type;
- unsigned long SizeOfData;
- unsigned long AddressOfRawData;
- unsigned long PointerToRawData;
- };
- #define PE_IMAGE_DEBUG_TYPE_UNKNOWN 0
- #define PE_IMAGE_DEBUG_TYPE_COFF 1
- #define PE_IMAGE_DEBUG_TYPE_CODEVIEW 2
- #define PE_IMAGE_DEBUG_TYPE_FPO 3
- #define PE_IMAGE_DEBUG_TYPE_MISC 4
- #define PE_IMAGE_DEBUG_TYPE_EXCEPTION 5
- #define PE_IMAGE_DEBUG_TYPE_FIXUP 6
- #define PE_IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
- #define PE_IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
- #define PE_IMAGE_DEBUG_TYPE_BORLAND 9
- #define PE_IMAGE_DEBUG_TYPE_RESERVED10 10
- #define PE_IMAGE_DEBUG_TYPE_CLSID 11
- #define CV_INFO_SIGNATURE_LENGTH 16
- typedef struct _CODEVIEW_INFO
- {
- unsigned long CVSignature;
- char Signature[CV_INFO_SIGNATURE_LENGTH];
- unsigned int SignatureLength;
- unsigned long Age;
-
- } CODEVIEW_INFO;
- #define NT_EXE_IMAGE_BASE 0x400000
- #define NT_DLL_IMAGE_BASE 0x10000000
- #define BEOS_EXE_IMAGE_BASE 0x80000000
- #define BEOS_DLL_IMAGE_BASE 0x10000000
- #define PE_DEF_SECTION_ALIGNMENT 0x1000
- #ifndef PE_DEF_FILE_ALIGNMENT
- # define PE_DEF_FILE_ALIGNMENT 0x200
- #endif
- struct internal_extra_pe_aouthdr
- {
-
-
- short Magic;
-
- char MajorLinkerVersion;
-
- char MinorLinkerVersion;
-
- long SizeOfCode;
-
- long SizeOfInitializedData;
-
- long SizeOfUninitializedData;
-
- bfd_vma AddressOfEntryPoint;
-
- bfd_vma BaseOfCode;
-
- bfd_vma BaseOfData;
-
- bfd_vma ImageBase;
- bfd_vma SectionAlignment;
- bfd_vma FileAlignment;
- short MajorOperatingSystemVersion;
- short MinorOperatingSystemVersion;
- short MajorImageVersion;
- short MinorImageVersion;
- short MajorSubsystemVersion;
- short MinorSubsystemVersion;
- long Reserved1;
- long SizeOfImage;
- long SizeOfHeaders;
- long CheckSum;
- short Subsystem;
-
- unsigned short DllCharacteristics;
- bfd_vma SizeOfStackReserve;
- bfd_vma SizeOfStackCommit;
- bfd_vma SizeOfHeapReserve;
- bfd_vma SizeOfHeapCommit;
- long LoaderFlags;
- long NumberOfRvaAndSizes;
- IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
- };
- struct internal_aouthdr
- {
- short magic;
- short vstamp;
- bfd_vma tsize;
- bfd_vma dsize;
- bfd_vma bsize;
- bfd_vma entry;
- bfd_vma text_start;
- bfd_vma data_start;
-
- unsigned long tagentries;
-
- bfd_vma o_toc;
- short o_snentry;
- short o_sntext;
- short o_sndata;
- short o_sntoc;
- short o_snloader;
- short o_snbss;
- short o_algntext;
- short o_algndata;
- short o_modtype;
- short o_cputype;
- bfd_vma o_maxstack;
- bfd_vma o_maxdata;
-
- bfd_vma bss_start;
- bfd_vma gp_value;
- unsigned long gprmask;
- unsigned long cprmask[4];
- unsigned long fprmask;
-
- long o_inlib;
- long o_sri;
- long vid[2];
- struct internal_extra_pe_aouthdr pe;
- };
- #define C_EFCN 0xff
- #define C_NULL 0
- #define C_AUTO 1
- #define C_EXT 2
- #define C_STAT 3
- #define C_REG 4
- #define C_EXTDEF 5
- #define C_LABEL 6
- #define C_ULABEL 7
- #define C_MOS 8
- #define C_ARG 9
- #define C_STRTAG 10
- #define C_MOU 11
- #define C_UNTAG 12
- #define C_TPDEF 13
- #define C_USTATIC 14
- #define C_ENTAG 15
- #define C_MOE 16
- #define C_REGPARM 17
- #define C_FIELD 18
- #define C_AUTOARG 19
- #define C_LASTENT 20
- #define C_BLOCK 100
- #define C_FCN 101
- #define C_EOS 102
- #define C_FILE 103
- #define C_LINE 104
- #define C_ALIAS 105
- #define C_HIDDEN 106
- #define C_WEAKEXT 127
- #define C_UEXT 19
- #define C_STATLAB 20
- #define C_EXTLAB 21
- #define C_SYSTEM 23
- #define C_SECTION 104
- #define C_NT_WEAK 105
-
- #define C_LEAFPROC 108
- #define C_SCALL 107
- #define C_LEAFEXT 108
- #define C_LEAFSTAT 113
- #define C_OPTVAR 109
- #define C_DEFINE 110
- #define C_PRAGMA 111
- #define C_SEGMENT 112
-
- #define C_SHADOW 107
- #define C_VERSION 108
-
- #define C_HIDEXT 107
- #define C_BINCL 108
- #define C_EINCL 109
- #define C_AIX_WEAKEXT 111
- #define C_NULL_VALUE 0x00de1e00
- #if defined _AIX52 || defined AIX_WEAK_SUPPORT
- #undef C_WEAKEXT
- #define C_WEAKEXT C_AIX_WEAKEXT
- #endif
-
- #define C_GSYM (0x80)
- #define C_LSYM (0x81)
- #define C_PSYM (0x82)
- #define C_RSYM (0x83)
- #define C_RPSYM (0x84)
- #define C_STSYM (0x85)
- #define C_TCSYM (0x86)
- #define C_BCOMM (0x87)
- #define C_ECOML (0x88)
- #define C_ECOMM (0x89)
- #define C_DECL (0x8c)
- #define C_ENTRY (0x8d)
- #define C_FUN (0x8e)
- #define C_BSTAT (0x8f)
- #define C_ESTAT (0x90)
- #define C_GTLS (0x97)
- #define C_STTLS (0x98)
- #define C_THUMBEXT (128 + C_EXT)
- #define C_THUMBSTAT (128 + C_STAT)
- #define C_THUMBLABEL (128 + C_LABEL)
- #define C_THUMBEXTFUNC (C_THUMBEXT + 20)
- #define C_THUMBSTATFUNC (C_THUMBSTAT + 20)
- #define CSECT_SYM_P(CLASS) \
- ((CLASS) == C_EXT || (CLASS) == C_AIX_WEAKEXT || (CLASS) == C_HIDEXT)
- #define SCNNMLEN (8)
- struct internal_scnhdr
- {
- char s_name[SCNNMLEN];
-
- bfd_vma s_paddr;
- bfd_vma s_vaddr;
- bfd_vma s_size;
- bfd_vma s_scnptr;
- bfd_vma s_relptr;
- bfd_vma s_lnnoptr;
- unsigned long s_nreloc;
- unsigned long s_nlnno;
- long s_flags;
- long s_align;
- unsigned char s_page;
- };
- #define STYP_REG (0x0000)
- #define STYP_DSECT (0x0001)
- #define STYP_NOLOAD (0x0002)
- #define STYP_GROUP (0x0004)
- #define STYP_PAD (0x0008)
- #define STYP_COPY (0x0010)
- #define STYP_TEXT (0x0020)
- #define S_SHRSEG (0x0020)
- #define STYP_DATA (0x0040)
- #define STYP_BSS (0x0080)
- #define S_NEWFCN (0x0100)
- #define STYP_INFO (0x0200)
- #define STYP_OVER (0x0400)
- #define STYP_LIB (0x0800)
- #define STYP_MERGE (0x2000)
- #define STYP_REVERSE_PAD (0x4000)
- #define STYP_LIT 0x8020
- struct internal_lineno
- {
- union
- {
- bfd_signed_vma l_symndx;
- bfd_signed_vma l_paddr;
- } l_addr;
- unsigned long l_lnno;
- };
- #define SYMNMLEN 8
- #define FILNMLEN 14
- #define DIMNUM 4
- struct internal_syment
- {
- union
- {
- char _n_name[SYMNMLEN];
- struct
- {
- bfd_hostptr_t _n_zeroes;
- bfd_hostptr_t _n_offset;
- } _n_n;
- char *_n_nptr[2];
- } _n;
- bfd_vma n_value;
- short n_scnum;
- unsigned short n_flags;
- unsigned short n_type;
- unsigned char n_sclass;
- unsigned char n_numaux;
- };
- #define n_name _n._n_name
- #define n_zeroes _n._n_n._n_zeroes
- #define n_offset _n._n_n._n_offset
- #define N_UNDEF ((short)0)
- #define N_ABS ((short)-1)
- #define N_DEBUG ((short)-2)
- #define N_TV ((short)-3)
- #define P_TV ((short)-4)
- #define T_NULL 0
- #define T_VOID 1
- #define T_CHAR 2
- #define T_SHORT 3
- #define T_INT 4
- #define T_LONG 5
- #define T_FLOAT 6
- #define T_DOUBLE 7
- #define T_STRUCT 8
- #define T_UNION 9
- #define T_ENUM 10
- #define T_MOE 11
- #define T_UCHAR 12
- #define T_USHORT 13
- #define T_UINT 14
- #define T_ULONG 15
- #define T_LNGDBL 16
- #define DT_NON (0)
- #define DT_PTR (1)
- #define DT_FCN (2)
- #define DT_ARY (3)
- #define BTYPE(x) ((x) & N_BTMASK)
- #define DTYPE(x) (((x) & N_TMASK) >> N_BTSHFT)
- #define ISPTR(x) \
- (((unsigned long) (x) & N_TMASK) == ((unsigned long) DT_PTR << N_BTSHFT))
- #define ISFCN(x) \
- (((unsigned long) (x) & N_TMASK) == ((unsigned long) DT_FCN << N_BTSHFT))
- #define ISARY(x) \
- (((unsigned long) (x) & N_TMASK) == ((unsigned long) DT_ARY << N_BTSHFT))
- #define ISTAG(x) \
- ((x) == C_STRTAG || (x) == C_UNTAG || (x) == C_ENTAG)
- #define DECREF(x) \
- ((((x) >> N_TSHIFT) & ~ N_BTMASK) | ((x) & N_BTMASK))
- union internal_auxent
- {
- struct
- {
- union
- {
- long l;
- struct coff_ptr_struct *p;
- } x_tagndx;
- union
- {
- struct
- {
- unsigned short x_lnno;
- unsigned short x_size;
- } x_lnsz;
- long x_fsize;
- } x_misc;
- union
- {
- struct
- {
- bfd_signed_vma x_lnnoptr;
- union
- {
- long l;
- struct coff_ptr_struct *p;
- } x_endndx;
- } x_fcn;
- struct
- {
- unsigned short x_dimen[DIMNUM];
- } x_ary;
- } x_fcnary;
- unsigned short x_tvndx;
- } x_sym;
- union
- {
-
- char x_fname[20];
- struct
- {
- long x_zeroes;
- long x_offset;
- } x_n;
- } x_file;
- struct
- {
- long x_scnlen;
- unsigned short x_nreloc;
- unsigned short x_nlinno;
- unsigned long x_checksum;
- unsigned short x_associated;
- unsigned char x_comdat;
- } x_scn;
- struct
- {
- long x_tvfill;
- unsigned short x_tvlen;
- unsigned short x_tvran[2];
- } x_tv;
-
- struct
- {
- union
- {
- bfd_signed_vma l;
- struct coff_ptr_struct *p;
- } x_scnlen;
- long x_parmhash;
- unsigned short x_snhash;
- unsigned char x_smtyp;
-
-
- unsigned char x_smclas;
- long x_stab;
- unsigned short x_snstab;
- } x_csect;
- #define SMTYP_ALIGN(x) ((x) >> 3)
- #define SMTYP_SMTYP(x) ((x) & 0x7)
- #define XTY_ER 0
- #define XTY_SD 1
- #define XTY_LD 2
- #define XTY_CM 3
- #define XTY_EM 4
- #define XTY_US 5
- #define XMC_PR 0
- #define XMC_RO 1
- #define XMC_DB 2
- #define XMC_TC 3
- #define XMC_UA 4
- #define XMC_RW 5
- #define XMC_GL 6
- #define XMC_XO 7
- #define XMC_SV 8
- #define XMC_BS 9
- #define XMC_DS 10
- #define XMC_UC 11
- #define XMC_TI 12
- #define XMC_TB 13
- #define XMC_TC0 15
- #define XMC_TD 16
-
- struct
- {
-
- #define x_stdindx x_stindx
- long x_stindx;
- } x_sc;
- struct
- {
- unsigned long x_balntry;
- } x_bal;
- struct
- {
- unsigned long x_timestamp;
- char x_idstring[20];
- } x_ident;
- };
- struct internal_reloc
- {
- bfd_vma r_vaddr;
- long r_symndx;
- unsigned short r_type;
- unsigned char r_size;
- unsigned char r_extern;
- unsigned long r_offset;
- };
- #define R_AMD64_ABS 0
- #define R_AMD64_DIR64 1
- #define R_AMD64_DIR32 2
- #define R_AMD64_IMAGEBASE 3
- #define R_AMD64_PCRLONG 4
- #define R_AMD64_PCRLONG_1 5
- #define R_AMD64_PCRLONG_2 6
- #define R_AMD64_PCRLONG_3 7
- #define R_AMD64_PCRLONG_4 8
- #define R_AMD64_PCRLONG_5 9
- #define R_AMD64_SECTION 10
- #define R_AMD64_SECREL 11
- #define R_AMD64_SECREL7 12
- #define R_AMD64_TOKEN 13
- #define R_AMD64_PCRQUAD 14
- #define R_DIR16 1
- #define R_REL24 5
- #define R_DIR32 6
- #define R_IMAGEBASE 7
- #define R_SECREL32 11
- #define R_RELBYTE 15
- #define R_RELWORD 16
- #define R_RELLONG 17
- #define R_PCRBYTE 18
- #define R_PCRWORD 19
- #define R_PCRLONG 20
- #define R_PCR24 21
- #define R_IPRSHORT 24
- #define R_IPRLONG 26
- #define R_GETSEG 29
- #define R_GETPA 30
- #define R_TAGWORD 31
- #define R_JUMPTARG 32
- #define R_PARTLS16 32
- #define R_PARTMS8 33
- #define R_PCR16L 128
- #define R_PCR26L 129
- #define R_VRT16 130
- #define R_HVRT16 131
- #define R_LVRT16 132
- #define R_VRT32 133
- #define R_MOV16B1 0x41
- #define R_MOV16B2 0x42
- #define R_JMP1 0x43
- #define R_JMP2 0x44
- #define R_RELLONG_NEG 0x45
- #define R_JMPL1 0x46
- #define R_JMPL2 0x47
- #define R_MOV24B1 0x48
- #define R_MOV24B2 0x49
- #define R_MEM_INDIRECT 0x4a
- #define R_PCRWORD_B 0x4b
- #define R_MOVL1 0x4c
- #define R_MOVL2 0x4d
- #define R_BCC_INV 0x4e
- #define R_JMP_DEL 0x4f
- #define R_IMM16 0x01
- #define R_JR 0x02
- #define R_IMM4L 0x23
- #define R_IMM8 0x22
- #define R_IMM32 R_RELLONG
- #define R_CALL R_DA
- #define R_JP R_DA
- #define R_REL16 0x04
- #define R_CALLR 0x05
- #define R_SEG 0x10
- #define R_IMM4H 0x24
- #define R_DISP7 0x25
- #define R_OFF8 0x32
- #define R_IMM24 0x33
- #define R_H8500_IMM8 1
- #define R_H8500_IMM16 2
- #define R_H8500_PCREL8 3
- #define R_H8500_PCREL16 4
- #define R_H8500_HIGH8 5
- #define R_H8500_LOW16 7
- #define R_H8500_IMM24 6
- #define R_H8500_IMM32 8
- #define R_H8500_HIGH16 9
- #define R_W65_ABS8 1
- #define R_W65_ABS16 2
- #define R_W65_ABS24 3
- #define R_W65_ABS8S8 4
- #define R_W65_ABS8S16 5
- #define R_W65_ABS16S8 6
- #define R_W65_ABS16S16 7
- #define R_W65_PCR8 8
- #define R_W65_PCR16 9
- #define R_W65_DP 10
- #endif
|