1b55d4692Sfgsch /* coff information for 80960. Origins: Intel corp, natch. 2b55d4692Sfgsch 3b55d4692Sfgsch Copyright 2001 Free Software Foundation, Inc. 4b55d4692Sfgsch 5b55d4692Sfgsch This program is free software; you can redistribute it and/or modify 6b55d4692Sfgsch it under the terms of the GNU General Public License as published by 7b55d4692Sfgsch the Free Software Foundation; either version 2 of the License, or 8b55d4692Sfgsch (at your option) any later version. 9b55d4692Sfgsch 10b55d4692Sfgsch This program is distributed in the hope that it will be useful, 11b55d4692Sfgsch but WITHOUT ANY WARRANTY; without even the implied warranty of 12b55d4692Sfgsch MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13b55d4692Sfgsch GNU General Public License for more details. 14b55d4692Sfgsch 15b55d4692Sfgsch You should have received a copy of the GNU General Public License 16b55d4692Sfgsch along with this program; if not, write to the Free Software 17b55d4692Sfgsch Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 182159047fSniklas 192159047fSniklas /* NOTE: Tagentries (cf TAGBITS) are no longer used by the 960 */ 202159047fSniklas 212159047fSniklas /********************** FILE HEADER **********************/ 222159047fSniklas 23*c074d1c9Sdrahn struct external_filehdr 24*c074d1c9Sdrahn { 252159047fSniklas char f_magic[2]; /* magic number */ 262159047fSniklas char f_nscns[2]; /* number of sections */ 272159047fSniklas char f_timdat[4]; /* time & date stamp */ 282159047fSniklas char f_symptr[4]; /* file pointer to symtab */ 292159047fSniklas char f_nsyms[4]; /* number of symtab entries */ 302159047fSniklas char f_opthdr[2]; /* sizeof(optional hdr) */ 312159047fSniklas char f_flags[2]; /* flags */ 322159047fSniklas }; 332159047fSniklas 342159047fSniklas #define OMAGIC (0407) /* old impure format. data immediately 352159047fSniklas follows text. both sections are rw. */ 362159047fSniklas #define NMAGIC (0410) /* split i&d, read-only text */ 372159047fSniklas 382159047fSniklas /* 392159047fSniklas * Intel 80960 (I960) processor flags. 402159047fSniklas * F_I960TYPE == mask for processor type field. 412159047fSniklas */ 422159047fSniklas 432159047fSniklas #define F_I960TYPE (0xf000) 442159047fSniklas #define F_I960CORE (0x1000) 452159047fSniklas #define F_I960KB (0x2000) 462159047fSniklas #define F_I960SB (0x2000) 472159047fSniklas #define F_I960MC (0x3000) 482159047fSniklas #define F_I960XA (0x4000) 492159047fSniklas #define F_I960CA (0x5000) 502159047fSniklas #define F_I960KA (0x6000) 512159047fSniklas #define F_I960SA (0x6000) 52c88b1d6cSniklas #define F_I960JX (0x7000) 53c88b1d6cSniklas #define F_I960HX (0x8000) 542159047fSniklas 552159047fSniklas 562159047fSniklas /** i80960 Magic Numbers 572159047fSniklas */ 582159047fSniklas 592159047fSniklas #define I960ROMAGIC (0x160) /* read-only text segments */ 602159047fSniklas #define I960RWMAGIC (0x161) /* read-write text segments */ 612159047fSniklas 622159047fSniklas #define I960BADMAG(x) (((x).f_magic!=I960ROMAGIC) && ((x).f_magic!=I960RWMAGIC)) 632159047fSniklas 642159047fSniklas #define FILHDR struct external_filehdr 652159047fSniklas #define FILHSZ 20 662159047fSniklas 672159047fSniklas /********************** AOUT "OPTIONAL HEADER" **********************/ 682159047fSniklas 69*c074d1c9Sdrahn typedef struct 70*c074d1c9Sdrahn { 712159047fSniklas unsigned long phys_addr; 722159047fSniklas unsigned long bitarray; 732159047fSniklas } TAGBITS; 742159047fSniklas 752159047fSniklas typedef struct 762159047fSniklas { 772159047fSniklas char magic[2]; /* type of file */ 782159047fSniklas char vstamp[2]; /* version stamp */ 792159047fSniklas char tsize[4]; /* text size in bytes, padded to FW bdry*/ 802159047fSniklas char dsize[4]; /* initialized data " " */ 812159047fSniklas char bsize[4]; /* uninitialized data " " */ 822159047fSniklas char entry[4]; /* entry pt. */ 832159047fSniklas char text_start[4]; /* base of text used for this file */ 842159047fSniklas char data_start[4]; /* base of data used for this file */ 852159047fSniklas char tagentries[4]; /* number of tag entries to follow */ 862159047fSniklas } 872159047fSniklas AOUTHDR; 882159047fSniklas 892159047fSniklas /* return a pointer to the tag bits array */ 902159047fSniklas 912159047fSniklas #define TAGPTR(aout) ((TAGBITS *) (&(aout.tagentries)+1)) 922159047fSniklas 932159047fSniklas /* compute size of a header */ 942159047fSniklas 952159047fSniklas /*#define AOUTSZ(aout) (sizeof(AOUTHDR)+(aout.tagentries*sizeof(TAGBITS)))*/ 960c6d0228Sniklas #define AOUTSZ 32 970c6d0228Sniklas #define AOUTHDRSZ 32 982159047fSniklas 992159047fSniklas 1002159047fSniklas /********************** SECTION HEADER **********************/ 1012159047fSniklas 102*c074d1c9Sdrahn struct external_scnhdr 103*c074d1c9Sdrahn { 1042159047fSniklas char s_name[8]; /* section name */ 1052159047fSniklas char s_paddr[4]; /* physical address, aliased s_nlib */ 1062159047fSniklas char s_vaddr[4]; /* virtual address */ 1072159047fSniklas char s_size[4]; /* section size */ 1082159047fSniklas char s_scnptr[4]; /* file ptr to raw data for section */ 1092159047fSniklas char s_relptr[4]; /* file ptr to relocation */ 1102159047fSniklas char s_lnnoptr[4]; /* file ptr to line numbers */ 1112159047fSniklas char s_nreloc[2]; /* number of relocation entries */ 1122159047fSniklas char s_nlnno[2]; /* number of line number entries*/ 1132159047fSniklas char s_flags[4]; /* flags */ 1142159047fSniklas char s_align[4]; /* section alignment */ 1152159047fSniklas }; 1162159047fSniklas 1172159047fSniklas 1182159047fSniklas #define SCNHDR struct external_scnhdr 1190c6d0228Sniklas #define SCNHSZ 44 1202159047fSniklas 1212159047fSniklas /* 1222159047fSniklas * names of "special" sections 1232159047fSniklas */ 1242159047fSniklas #define _TEXT ".text" 1252159047fSniklas #define _DATA ".data" 1262159047fSniklas #define _BSS ".bss" 1272159047fSniklas 1282159047fSniklas /********************** LINE NUMBERS **********************/ 1292159047fSniklas 1302159047fSniklas /* 1 line number entry for every "breakpointable" source line in a section. 1312159047fSniklas * Line numbers are grouped on a per function basis; first entry in a function 1322159047fSniklas * grouping will have l_lnno = 0 and in place of physical address will be the 1332159047fSniklas * symbol table index of the function name. 1342159047fSniklas */ 135*c074d1c9Sdrahn struct external_lineno 136*c074d1c9Sdrahn { 137*c074d1c9Sdrahn union 138*c074d1c9Sdrahn { 1392159047fSniklas char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ 1402159047fSniklas char l_paddr[4]; /* (physical) address of line number */ 1412159047fSniklas } l_addr; 142*c074d1c9Sdrahn 1432159047fSniklas char l_lnno[2]; /* line number */ 1442159047fSniklas char padding[2]; /* force alignment */ 1452159047fSniklas }; 1462159047fSniklas 1472159047fSniklas 1482159047fSniklas #define LINENO struct external_lineno 1492159047fSniklas #define LINESZ 8 1502159047fSniklas 1512159047fSniklas /********************** SYMBOLS **********************/ 1522159047fSniklas 1532159047fSniklas #define E_SYMNMLEN 8 /* # characters in a symbol name */ 1542159047fSniklas #define E_FILNMLEN 14 /* # characters in a file name */ 1552159047fSniklas #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ 1562159047fSniklas 1572159047fSniklas struct external_syment 1582159047fSniklas { 159*c074d1c9Sdrahn union 160*c074d1c9Sdrahn { 1612159047fSniklas char e_name[E_SYMNMLEN]; 162*c074d1c9Sdrahn 163*c074d1c9Sdrahn struct 164*c074d1c9Sdrahn { 1652159047fSniklas char e_zeroes[4]; 1662159047fSniklas char e_offset[4]; 1672159047fSniklas } e; 1682159047fSniklas } e; 169*c074d1c9Sdrahn 1702159047fSniklas char e_value[4]; 1712159047fSniklas char e_scnum[2]; 1722159047fSniklas char e_flags[2]; 1732159047fSniklas char e_type[4]; 1742159047fSniklas char e_sclass[1]; 1752159047fSniklas char e_numaux[1]; 1762159047fSniklas char pad2[2]; 1772159047fSniklas }; 1782159047fSniklas 1792159047fSniklas #define N_BTMASK (0x1f) 1802159047fSniklas #define N_TMASK (0x60) 1812159047fSniklas #define N_BTSHFT (5) 1822159047fSniklas #define N_TSHIFT (2) 1832159047fSniklas 184*c074d1c9Sdrahn union external_auxent 185*c074d1c9Sdrahn { 186*c074d1c9Sdrahn struct 187*c074d1c9Sdrahn { 1882159047fSniklas char x_tagndx[4]; /* str, un, or enum tag indx */ 189*c074d1c9Sdrahn 190*c074d1c9Sdrahn union 191*c074d1c9Sdrahn { 192*c074d1c9Sdrahn struct 193*c074d1c9Sdrahn { 1942159047fSniklas char x_lnno[2]; /* declaration line number */ 1952159047fSniklas char x_size[2]; /* str/union/array size */ 1962159047fSniklas } x_lnsz; 197*c074d1c9Sdrahn 1982159047fSniklas char x_fsize[4]; /* size of function */ 199*c074d1c9Sdrahn 2002159047fSniklas } x_misc; 201*c074d1c9Sdrahn 202*c074d1c9Sdrahn union 203*c074d1c9Sdrahn { 204*c074d1c9Sdrahn struct /* if ISFCN, tag, or .bb */ 205*c074d1c9Sdrahn { 2062159047fSniklas char x_lnnoptr[4]; /* ptr to fcn line # */ 2072159047fSniklas char x_endndx[4]; /* entry ndx past block end */ 2082159047fSniklas } x_fcn; 209*c074d1c9Sdrahn 210*c074d1c9Sdrahn struct /* if ISARY, up to 4 dimen. */ 211*c074d1c9Sdrahn { 2122159047fSniklas char x_dimen[E_DIMNUM][2]; 2132159047fSniklas } x_ary; 214*c074d1c9Sdrahn 2152159047fSniklas } x_fcnary; 216*c074d1c9Sdrahn 2172159047fSniklas char x_tvndx[2]; /* tv index */ 218*c074d1c9Sdrahn 2192159047fSniklas } x_sym; 2202159047fSniklas 221*c074d1c9Sdrahn union 222*c074d1c9Sdrahn { 2232159047fSniklas char x_fname[E_FILNMLEN]; 224*c074d1c9Sdrahn 225*c074d1c9Sdrahn struct 226*c074d1c9Sdrahn { 2272159047fSniklas char x_zeroes[4]; 2282159047fSniklas char x_offset[4]; 2292159047fSniklas } x_n; 230*c074d1c9Sdrahn 2312159047fSniklas } x_file; 2322159047fSniklas 233*c074d1c9Sdrahn struct 234*c074d1c9Sdrahn { 2352159047fSniklas char x_scnlen[4]; /* section length */ 2362159047fSniklas char x_nreloc[2]; /* # relocation entries */ 2372159047fSniklas char x_nlinno[2]; /* # line numbers */ 238*c074d1c9Sdrahn 2392159047fSniklas } x_scn; 2402159047fSniklas 241*c074d1c9Sdrahn struct 242*c074d1c9Sdrahn { 2432159047fSniklas char x_tvfill[4]; /* tv fill value */ 2442159047fSniklas char x_tvlen[2]; /* length of .tv */ 2452159047fSniklas char x_tvran[2][2]; /* tv range */ 246*c074d1c9Sdrahn 2472159047fSniklas } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ 2482159047fSniklas 2492159047fSniklas /****************************************** 2502159047fSniklas * I960-specific *2nd* aux. entry formats 2512159047fSniklas ******************************************/ 252*c074d1c9Sdrahn struct 253*c074d1c9Sdrahn { 2542159047fSniklas /* This is a very old typo that keeps getting propagated. */ 2552159047fSniklas #define x_stdindx x_stindx 2562159047fSniklas char x_stindx[4]; /* sys. table entry */ 2572159047fSniklas } x_sc; /* system call entry */ 2582159047fSniklas 259*c074d1c9Sdrahn struct 260*c074d1c9Sdrahn { 2612159047fSniklas char x_balntry[4]; /* BAL entry point */ 2622159047fSniklas } x_bal; /* BAL-callable function */ 2632159047fSniklas 264*c074d1c9Sdrahn struct 265*c074d1c9Sdrahn { 2662159047fSniklas char x_timestamp[4]; /* time stamp */ 2672159047fSniklas char x_idstring[20]; /* producer identity string */ 268*c074d1c9Sdrahn 2692159047fSniklas } x_ident; /* Producer ident info */ 2702159047fSniklas }; 2712159047fSniklas 2722159047fSniklas #define SYMENT struct external_syment 2730c6d0228Sniklas #define SYMESZ 24 2742159047fSniklas #define AUXENT union external_auxent 2750c6d0228Sniklas #define AUXESZ 24 2762159047fSniklas 2772159047fSniklas # define _ETEXT "_etext" 2782159047fSniklas 2792159047fSniklas /********************** RELOCATION DIRECTIVES **********************/ 2802159047fSniklas 281*c074d1c9Sdrahn struct external_reloc 282*c074d1c9Sdrahn { 2832159047fSniklas char r_vaddr[4]; 2842159047fSniklas char r_symndx[4]; 2852159047fSniklas char r_type[2]; 2862159047fSniklas char pad[2]; 2872159047fSniklas }; 2882159047fSniklas 2896a4c786fSespie /* r_type values for the i960. */ 2902159047fSniklas 2916a4c786fSespie /* The i960 uses R_RELLONG, which is defined in internal.h as 0x11. 2926a4c786fSespie It is an absolute 32 bit relocation. */ 2932159047fSniklas 2946a4c786fSespie #define R_IPRMED (0x19) /* 24-bit ip-relative relocation */ 2956a4c786fSespie #define R_OPTCALL (0x1b) /* 32-bit optimizable call (leafproc/sysproc) */ 2966a4c786fSespie #define R_OPTCALLX (0x1c) /* 64-bit optimizable call (leafproc/sysproc) */ 2976a4c786fSespie 2986a4c786fSespie /* The following relocation types are defined use by relaxing linkers, 2996a4c786fSespie which convert 32 bit calls (which require a 64 bit instruction) 3006a4c786fSespie into 24 bit calls (which require a 32 bit instruction) when 3016a4c786fSespie possible. It will be possible whenever the target of the call is 3026a4c786fSespie within a 24 bit range of the call instruction. 3036a4c786fSespie 3046a4c786fSespie It is always safe to ignore these relocations. They only serve to 3056a4c786fSespie mark points which the relaxing linker will have to consider. The 3066a4c786fSespie assembler must ensure that the correct code is generated even if 3076a4c786fSespie the relocations are ignored. In particular, this means that the 3086a4c786fSespie R_IPR13 relocation may not appear with an external symbol. */ 3096a4c786fSespie 3106a4c786fSespie #define R_IPR13 (0x1d) /* 13 bit ip-relative branch */ 3116a4c786fSespie #define R_ALIGN (0x1e) /* alignment marker. This has no 3126a4c786fSespie associated symbol. Instead, the 3136a4c786fSespie r_symndx field indicates the 3146a4c786fSespie require alignment at this point in 3156a4c786fSespie the file. It must be a power of 2. */ 3162159047fSniklas 3172159047fSniklas #define RELOC struct external_reloc 3182159047fSniklas #define RELSZ 12 3192159047fSniklas 320