Home | History | Annotate | Line # | Download | only in coff
rs6k64.h revision 1.1
      1  1.1  christos /* IBM RS/6000 "XCOFF64" file definitions for BFD.
      2  1.1  christos    Copyright (C) 2000, 2001, 2002, 2010 Free Software Foundation, Inc.
      3  1.1  christos 
      4  1.1  christos    This program is free software; you can redistribute it and/or modify
      5  1.1  christos    it under the terms of the GNU General Public License as published by
      6  1.1  christos    the Free Software Foundation; either version 3 of the License, or
      7  1.1  christos    (at your option) any later version.
      8  1.1  christos 
      9  1.1  christos    This program is distributed in the hope that it will be useful,
     10  1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     11  1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12  1.1  christos    GNU General Public License for more details.
     13  1.1  christos 
     14  1.1  christos    You should have received a copy of the GNU General Public License
     15  1.1  christos    along with this program; if not, write to the Free Software
     16  1.1  christos    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
     17  1.1  christos    MA 02110-1301, USA.  */
     18  1.1  christos 
     19  1.1  christos /********************** FILE HEADER **********************/
     20  1.1  christos 
     21  1.1  christos struct external_filehdr
     22  1.1  christos {
     23  1.1  christos   char f_magic[2];	/* magic number			*/
     24  1.1  christos   char f_nscns[2];	/* number of sections		*/
     25  1.1  christos   char f_timdat[4];	/* time & date stamp		*/
     26  1.1  christos   char f_symptr[8];	/* file pointer to symtab 	*/
     27  1.1  christos   char f_opthdr[2];	/* sizeof(optional hdr)		*/
     28  1.1  christos   char f_flags[2];	/* flags			*/
     29  1.1  christos   char f_nsyms[4];	/* number of symtab entries	*/
     30  1.1  christos };
     31  1.1  christos 
     32  1.1  christos /* IBM RS/6000.  */
     33  1.1  christos #define U803XTOCMAGIC 0757	/* Aix 4.3 64-bit XCOFF */
     34  1.1  christos #define	U64_TOCMAGIC  0767	/* AIX 5+ 64-bit XCOFF */
     35  1.1  christos #define BADMAG(x) ((x).f_magic != U803XTOCMAGIC && (x).f_magic != U64_TOCMAGIC)
     36  1.1  christos 
     37  1.1  christos #define	FILHDR	struct external_filehdr
     38  1.1  christos #define	FILHSZ	24
     39  1.1  christos 
     40  1.1  christos /********************** AOUT "OPTIONAL HEADER" **********************/
     41  1.1  christos 
     42  1.1  christos typedef struct
     43  1.1  christos {
     44  1.1  christos   unsigned char	magic[2];		/* type of file			*/
     45  1.1  christos   unsigned char	vstamp[2];		/* version stamp		*/
     46  1.1  christos   unsigned char	o_debugger[4];		/* reserved 			*/
     47  1.1  christos   unsigned char	text_start[8];		/* base of text used for this file */
     48  1.1  christos   unsigned char	data_start[8];		/* base of data used for this file */
     49  1.1  christos   unsigned char	o_toc[8];		/* address of TOC */
     50  1.1  christos   unsigned char	o_snentry[2];		/* section number of entry point */
     51  1.1  christos   unsigned char	o_sntext[2];		/* section number of .text section */
     52  1.1  christos   unsigned char	o_sndata[2];		/* section number of .data section */
     53  1.1  christos   unsigned char	o_sntoc[2];		/* section number of TOC */
     54  1.1  christos   unsigned char	o_snloader[2];		/* section number of .loader section */
     55  1.1  christos   unsigned char	o_snbss[2];		/* section number of .bss section */
     56  1.1  christos   unsigned char	o_algntext[2];		/* .text alignment */
     57  1.1  christos   unsigned char	o_algndata[2];		/* .data alignment */
     58  1.1  christos   unsigned char	o_modtype[2];		/* module type (??) */
     59  1.1  christos   unsigned char o_cputype[2];		/* cpu type */
     60  1.1  christos   unsigned char	o_resv2[4];		/* reserved 			*/
     61  1.1  christos   unsigned char	tsize[8];		/* text size bytes, padded to FW bdry */
     62  1.1  christos   unsigned char	dsize[8];		/* initialized data "  "	*/
     63  1.1  christos   unsigned char	bsize[8];		/* uninitialized data "   "	*/
     64  1.1  christos   unsigned char	entry[8];		/* entry pt.			*/
     65  1.1  christos   unsigned char	o_maxstack[8];		/* max stack size (??) 		*/
     66  1.1  christos   unsigned char o_maxdata[8];		/* max data size (??) 		*/
     67  1.1  christos   unsigned char	o_resv3[16];		/* reserved 			*/
     68  1.1  christos }
     69  1.1  christos AOUTHDR;
     70  1.1  christos 
     71  1.1  christos #define AOUTSZ 120
     72  1.1  christos #define SMALL_AOUTSZ (0)
     73  1.1  christos #define AOUTHDRSZ 72
     74  1.1  christos 
     75  1.1  christos /********************** SECTION HEADER **********************/
     76  1.1  christos 
     77  1.1  christos struct external_scnhdr
     78  1.1  christos {
     79  1.1  christos   char	s_name[8];	/* section name			*/
     80  1.1  christos   char	s_paddr[8];	/* physical address, aliased s_nlib */
     81  1.1  christos   char	s_vaddr[8];	/* virtual address		*/
     82  1.1  christos   char	s_size[8];	/* section size			*/
     83  1.1  christos   char	s_scnptr[8];	/* file ptr to raw data for section */
     84  1.1  christos   char	s_relptr[8];	/* file ptr to relocation	*/
     85  1.1  christos   char	s_lnnoptr[8];	/* file ptr to line numbers	*/
     86  1.1  christos   char	s_nreloc[4];	/* number of relocation entries	*/
     87  1.1  christos   char	s_nlnno[4];	/* number of line number entries*/
     88  1.1  christos   char	s_flags[4];	/* flags			*/
     89  1.1  christos   char  s_pad[4];	/* padding */
     90  1.1  christos };
     91  1.1  christos 
     92  1.1  christos #define	SCNHDR	struct external_scnhdr
     93  1.1  christos 
     94  1.1  christos #define	SCNHSZ	72
     95  1.1  christos 
     96  1.1  christos /********************** LINE NUMBERS **********************/
     97  1.1  christos 
     98  1.1  christos /* 1 line number entry for every "breakpointable" source line in a section.
     99  1.1  christos    Line numbers are grouped on a per function basis; first entry in a function
    100  1.1  christos    grouping will have l_lnno = 0 and in place of physical address will be the
    101  1.1  christos    symbol table index of the function name.  */
    102  1.1  christos 
    103  1.1  christos struct external_lineno
    104  1.1  christos {
    105  1.1  christos   union
    106  1.1  christos   {
    107  1.1  christos     char l_symndx[4];	/* function name symbol index, iff l_lnno == 0*/
    108  1.1  christos     char l_paddr[8];	/* (physical) address of line number	*/
    109  1.1  christos   } l_addr;
    110  1.1  christos 
    111  1.1  christos   char l_lnno[4];	/* line number		*/
    112  1.1  christos };
    113  1.1  christos 
    114  1.1  christos #define	LINENO	struct external_lineno
    115  1.1  christos 
    116  1.1  christos #define	LINESZ	12
    117  1.1  christos 
    118  1.1  christos /********************** SYMBOLS **********************/
    119  1.1  christos 
    120  1.1  christos #define E_SYMNMLEN	8	/* # characters in a symbol name	*/
    121  1.1  christos #define E_FILNMLEN	14	/* # characters in a file name		*/
    122  1.1  christos #define E_DIMNUM	4	/* # array dimensions in auxiliary entry */
    123  1.1  christos 
    124  1.1  christos struct external_syment
    125  1.1  christos {
    126  1.1  christos   char e_value[8];
    127  1.1  christos   char e_offset[4];
    128  1.1  christos   char e_scnum[2];
    129  1.1  christos   char e_type[2];
    130  1.1  christos   char e_sclass[1];
    131  1.1  christos   char e_numaux[1];
    132  1.1  christos };
    133  1.1  christos 
    134  1.1  christos #define N_BTMASK	(017)
    135  1.1  christos #define N_TMASK		(060)
    136  1.1  christos #define N_BTSHFT	(4)
    137  1.1  christos #define N_TSHIFT	(2)
    138  1.1  christos 
    139  1.1  christos union external_auxent
    140  1.1  christos {
    141  1.1  christos     struct {
    142  1.1  christos     	union {
    143  1.1  christos 	    struct {
    144  1.1  christos 		char x_lnno[4]; 	/* declaration line number */
    145  1.1  christos 		char x_size[2]; 	/* str/union/array size */
    146  1.1  christos 	    } x_lnsz;
    147  1.1  christos 	    struct {
    148  1.1  christos 		char x_lnnoptr[8];/* ptr to fcn line */
    149  1.1  christos 		char x_fsize[4];	 /* size of function */
    150  1.1  christos 		char x_endndx[4];	 /* entry ndx past block end */
    151  1.1  christos 	    } x_fcn;
    152  1.1  christos  	} x_fcnary;
    153  1.1  christos     } x_sym;
    154  1.1  christos 
    155  1.1  christos     struct {
    156  1.1  christos         union {
    157  1.1  christos             char x_fname[E_FILNMLEN];
    158  1.1  christos             struct {
    159  1.1  christos 	        char x_zeroes[4];
    160  1.1  christos                 char x_offset[4];
    161  1.1  christos 	        char x_pad[6];
    162  1.1  christos             } x_n;
    163  1.1  christos         } x_n;
    164  1.1  christos         unsigned char x_ftype[1];
    165  1.1  christos         unsigned char x_resv[2];
    166  1.1  christos     } x_file;
    167  1.1  christos 
    168  1.1  christos     struct {
    169  1.1  christos 	char x_exptr[8];
    170  1.1  christos 	char x_fsize[4];
    171  1.1  christos 	char x_endndx[4];
    172  1.1  christos 	char x_pad[1];
    173  1.1  christos     } x_except;
    174  1.1  christos 
    175  1.1  christos     struct {
    176  1.1  christos 	    unsigned char x_scnlen_lo[4];
    177  1.1  christos 	    unsigned char x_parmhash[4];
    178  1.1  christos 	    unsigned char x_snhash[2];
    179  1.1  christos 	    unsigned char x_smtyp[1];
    180  1.1  christos 	    unsigned char x_smclas[1];
    181  1.1  christos 	    unsigned char x_scnlen_hi[4];
    182  1.1  christos 	    unsigned char x_pad[1];
    183  1.1  christos     } x_csect;
    184  1.1  christos 
    185  1.1  christos     struct {
    186  1.1  christos 	char x_pad[17];
    187  1.1  christos 	char x_auxtype[1];
    188  1.1  christos     } x_auxtype;
    189  1.1  christos };
    190  1.1  christos 
    191  1.1  christos #define	SYMENT	struct external_syment
    192  1.1  christos #define	SYMESZ	18
    193  1.1  christos #define	AUXENT	union external_auxent
    194  1.1  christos #define	AUXESZ	18
    195  1.1  christos #define DBXMASK 0x80		/* for dbx storage mask */
    196  1.1  christos #define SYMNAME_IN_DEBUG(symptr) ((symptr)->n_sclass & DBXMASK)
    197  1.1  christos 
    198  1.1  christos /* Values for auxtype field in XCOFF64, taken from AIX 4.3 sym.h.  */
    199  1.1  christos #define _AUX_EXCEPT     255
    200  1.1  christos #define _AUX_FCN        254
    201  1.1  christos #define _AUX_SYM        253
    202  1.1  christos #define _AUX_FILE       252
    203  1.1  christos #define _AUX_CSECT      251
    204  1.1  christos 
    205  1.1  christos /********************** RELOCATION DIRECTIVES **********************/
    206  1.1  christos 
    207  1.1  christos struct external_reloc
    208  1.1  christos {
    209  1.1  christos   char r_vaddr[8];
    210  1.1  christos   char r_symndx[4];
    211  1.1  christos   char r_size[1];
    212  1.1  christos   char r_type[1];
    213  1.1  christos };
    214  1.1  christos 
    215  1.1  christos #define RELOC struct external_reloc
    216  1.1  christos #define RELSZ 14
    217  1.1  christos 
    218  1.1  christos #define DEFAULT_DATA_SECTION_ALIGNMENT 4
    219  1.1  christos #define DEFAULT_BSS_SECTION_ALIGNMENT 4
    220  1.1  christos #define DEFAULT_TEXT_SECTION_ALIGNMENT 4
    221  1.1  christos /* For new sections we havn't heard of before */
    222  1.1  christos #define DEFAULT_SECTION_ALIGNMENT 4
    223  1.1  christos 
    224  1.1  christos /* The ldhdr structure.  This appears at the start of the .loader
    225  1.1  christos    section.  */
    226  1.1  christos 
    227  1.1  christos struct external_ldhdr
    228  1.1  christos {
    229  1.1  christos   bfd_byte l_version[4];
    230  1.1  christos   bfd_byte l_nsyms[4];
    231  1.1  christos   bfd_byte l_nreloc[4];
    232  1.1  christos   bfd_byte l_istlen[4];
    233  1.1  christos   bfd_byte l_nimpid[4];
    234  1.1  christos   bfd_byte l_stlen[4];
    235  1.1  christos   bfd_byte l_impoff[8];
    236  1.1  christos   bfd_byte l_stoff[8];
    237  1.1  christos   bfd_byte l_symoff[8];
    238  1.1  christos   bfd_byte l_rldoff[8];
    239  1.1  christos };
    240  1.1  christos #define LDHDRSZ (56)
    241  1.1  christos 
    242  1.1  christos struct external_ldsym
    243  1.1  christos {
    244  1.1  christos   bfd_byte l_value[8];
    245  1.1  christos   bfd_byte l_offset[4];
    246  1.1  christos   bfd_byte l_scnum[2];
    247  1.1  christos   bfd_byte l_smtype[1];
    248  1.1  christos   bfd_byte l_smclas[1];
    249  1.1  christos   bfd_byte l_ifile[4];
    250  1.1  christos   bfd_byte l_parm[4];
    251  1.1  christos };
    252  1.1  christos 
    253  1.1  christos #define LDSYMSZ (24)
    254  1.1  christos 
    255  1.1  christos struct external_ldrel
    256  1.1  christos {
    257  1.1  christos   bfd_byte l_vaddr[8];
    258  1.1  christos   bfd_byte l_rtype[2];
    259  1.1  christos   bfd_byte l_rsecnm[2];
    260  1.1  christos   bfd_byte l_symndx[4];
    261  1.1  christos };
    262  1.1  christos 
    263  1.1  christos #define LDRELSZ (16)
    264  1.1  christos 
    265  1.1  christos struct external_exceptab
    266  1.1  christos {
    267  1.1  christos   union {
    268  1.1  christos     bfd_byte e_symndx[4];
    269  1.1  christos     bfd_byte e_paddr[8];
    270  1.1  christos   } e_addr;
    271  1.1  christos   bfd_byte e_lang[1];
    272  1.1  christos   bfd_byte e_reason[1];
    273  1.1  christos };
    274  1.1  christos 
    275  1.1  christos #define EXCEPTSZ (10)
    276