ia64.h revision 84865
1/* coff information for HP/Intel IA-64. 2 3 Copyright 2001 Free Software Foundation, Inc. 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 18 19 20/********************** FILE HEADER **********************/ 21 22struct external_filehdr { 23 char f_magic[2]; /* magic number */ 24 char f_nscns[2]; /* number of sections */ 25 char f_timdat[4]; /* time & date stamp */ 26 char f_symptr[4]; /* file pointer to symtab */ 27 char f_nsyms[4]; /* number of symtab entries */ 28 char f_opthdr[2]; /* sizeof(optional hdr) */ 29 char f_flags[2]; /* flags */ 30}; 31 32#define IA64MAGIC 0x200 33 34#define IA64BADMAG(x) (((x).f_magic != IA64MAGIC)) 35 36/* Bits for f_flags: 37 * F_RELFLG relocation info stripped from file 38 * F_EXEC file is executable (no unresolved external references) 39 * F_LNNO line numbers stripped from file 40 * F_LSYMS local symbols stripped from file 41 * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) 42 */ 43 44#define F_RELFLG (0x0001) 45#define F_EXEC (0x0002) 46#define F_LNNO (0x0004) 47#define F_LSYMS (0x0008) 48 49 50#define FILHDR struct external_filehdr 51#define FILHSZ 20 52 53 54/********************** AOUT "OPTIONAL HEADER" **********************/ 55 56 57typedef struct 58{ 59 char magic[2]; /* type of file */ 60 char vstamp[2]; /* version stamp */ 61 char tsize[4]; /* text size in bytes, padded to FW bdry*/ 62 char dsize[4]; /* initialized data " " */ 63 char bsize[4]; /* uninitialized data " " */ 64 char entry[4]; /* entry pt. */ 65 char text_start[4]; /* base of text used for this file */ 66#ifndef BFD64 67 char data_start[4]; /* base of data used for this file */ 68#endif 69} 70AOUTHDR; 71 72#define PE32MAGIC 0x10b /* 32-bit image */ 73#define PE32PMAGIC 0x20b /* 32-bit image inside 64-bit address space */ 74 75#define PE32PBADMAG(x) (((x).f_magic != PE32PMAGIC)) 76 77#define AOUTSZ 108 78#define AOUTHDRSZ 108 79 80#define OMAGIC 0404 /* object files, eg as output */ 81#define ZMAGIC 0413 /* demand load format, eg normal ld output */ 82#define STMAGIC 0401 /* target shlib */ 83#define SHMAGIC 0443 /* host shlib */ 84 85 86/* define some NT default values */ 87/* #define NT_IMAGE_BASE 0x400000 moved to internal.h */ 88#define NT_SECTION_ALIGNMENT 0x1000 89#define NT_FILE_ALIGNMENT 0x200 90#define NT_DEF_RESERVE 0x100000 91#define NT_DEF_COMMIT 0x1000 92 93/********************** SECTION HEADER **********************/ 94 95 96struct external_scnhdr { 97 char s_name[8]; /* section name */ 98 char s_paddr[4]; /* physical address, aliased s_nlib */ 99 char s_vaddr[4]; /* virtual address */ 100 char s_size[4]; /* section size */ 101 char s_scnptr[4]; /* file ptr to raw data for section */ 102 char s_relptr[4]; /* file ptr to relocation */ 103 char s_lnnoptr[4]; /* file ptr to line numbers */ 104 char s_nreloc[2]; /* number of relocation entries */ 105 char s_nlnno[2]; /* number of line number entries*/ 106 char s_flags[4]; /* flags */ 107}; 108 109#define SCNHDR struct external_scnhdr 110#define SCNHSZ 40 111 112/* 113 * names of "special" sections 114 */ 115#define _TEXT ".text" 116#define _DATA ".data" 117#define _BSS ".bss" 118#define _COMMENT ".comment" 119#define _LIB ".lib" 120 121/********************** LINE NUMBERS **********************/ 122 123/* 1 line number entry for every "breakpointable" source line in a section. 124 * Line numbers are grouped on a per function basis; first entry in a function 125 * grouping will have l_lnno = 0 and in place of physical address will be the 126 * symbol table index of the function name. 127 */ 128struct external_lineno { 129 union { 130 char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ 131 char l_paddr[4]; /* (physical) address of line number */ 132 } l_addr; 133 char l_lnno[2]; /* line number */ 134}; 135 136 137#define LINENO struct external_lineno 138#define LINESZ 6 139 140 141/********************** SYMBOLS **********************/ 142 143#define E_SYMNMLEN 8 /* # characters in a symbol name */ 144#define E_FILNMLEN 14 /* # characters in a file name */ 145#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ 146 147struct external_syment 148{ 149 union { 150 char e_name[E_SYMNMLEN]; 151 struct { 152 char e_zeroes[4]; 153 char e_offset[4]; 154 } e; 155 } e; 156 char e_value[4]; 157 char e_scnum[2]; 158 char e_type[2]; 159 char e_sclass[1]; 160 char e_numaux[1]; 161}; 162 163#define N_BTMASK (0xf) 164#define N_TMASK (0x30) 165#define N_BTSHFT (4) 166#define N_TSHIFT (2) 167 168union external_auxent { 169 struct { 170 char x_tagndx[4]; /* str, un, or enum tag indx */ 171 union { 172 struct { 173 char x_lnno[2]; /* declaration line number */ 174 char x_size[2]; /* str/union/array size */ 175 } x_lnsz; 176 char x_fsize[4]; /* size of function */ 177 } x_misc; 178 union { 179 struct { /* if ISFCN, tag, or .bb */ 180 char x_lnnoptr[4]; /* ptr to fcn line # */ 181 char x_endndx[4]; /* entry ndx past block end */ 182 } x_fcn; 183 struct { /* if ISARY, up to 4 dimen. */ 184 char x_dimen[E_DIMNUM][2]; 185 } x_ary; 186 } x_fcnary; 187 char x_tvndx[2]; /* tv index */ 188 } x_sym; 189 190 union { 191 char x_fname[E_FILNMLEN]; 192 struct { 193 char x_zeroes[4]; 194 char x_offset[4]; 195 } x_n; 196 } x_file; 197 198 struct { 199 char x_scnlen[4]; /* section length */ 200 char x_nreloc[2]; /* # relocation entries */ 201 char x_nlinno[2]; /* # line numbers */ 202 char x_checksum[4]; /* section COMDAT checksum */ 203 char x_associated[2]; /* COMDAT associated section index */ 204 char x_comdat[1]; /* COMDAT selection number */ 205 } x_scn; 206 207 struct { 208 char x_tvfill[4]; /* tv fill value */ 209 char x_tvlen[2]; /* length of .tv */ 210 char x_tvran[2][2]; /* tv range */ 211 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ 212 213 214}; 215 216#define SYMENT struct external_syment 217#define SYMESZ 18 218#define AUXENT union external_auxent 219#define AUXESZ 18 220 221 222# define _ETEXT "etext" 223 224 225/********************** RELOCATION DIRECTIVES **********************/ 226 227 228 229struct external_reloc { 230 char r_vaddr[4]; 231 char r_symndx[4]; 232 char r_type[2]; 233}; 234 235 236#define RELOC struct external_reloc 237#define RELSZ 10 238 239