source: trunk/src/binutils/include/coff/rs6k64.h@ 10

Last change on this file since 10 was 10, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 7.2 KB
Line 
1/* IBM RS/6000 "XCOFF64" file definitions for BFD.
2 Copyright (C) 2000 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17*/
18
19/********************** FILE HEADER **********************/
20
21struct external_filehdr {
22 char f_magic[2]; /* magic number */
23 char f_nscns[2]; /* number of sections */
24 char f_timdat[4]; /* time & date stamp */
25 char f_symptr[8];/* file pointer to symtab */
26 char f_opthdr[2]; /* sizeof(optional hdr) */
27 char f_flags[2]; /* flags */
28 char f_nsyms[4]; /* number of symtab entries */
29};
30
31 /* IBM RS/6000 */
32#define U803XTOCMAGIC 0757 /* readonly text segments and TOC, XCOFF64 */
33
34#define BADMAG(x) ((x).f_magic != U803XTOCMAGIC)
35
36#define FILHDR struct external_filehdr
37#define FILHSZ 24
38
39/********************** AOUT "OPTIONAL HEADER" **********************/
40
41
42typedef struct
43{
44 unsigned char magic[2]; /* type of file */
45 unsigned char vstamp[2]; /* version stamp */
46 unsigned char o_debugger[4]; /* reserved */
47 unsigned char text_start[8]; /* base of text used for this file */
48 unsigned char data_start[8]; /* base of data used for this file */
49 unsigned char o_toc[8]; /* address of TOC */
50 unsigned char o_snentry[2]; /* section number of entry point */
51 unsigned char o_sntext[2]; /* section number of .text section */
52 unsigned char o_sndata[2]; /* section number of .data section */
53 unsigned char o_sntoc[2]; /* section number of TOC */
54 unsigned char o_snloader[2]; /* section number of .loader section */
55 unsigned char o_snbss[2]; /* section number of .bss section */
56 unsigned char o_algntext[2]; /* .text alignment */
57 unsigned char o_algndata[2]; /* .data alignment */
58 unsigned char o_modtype[2]; /* module type (??) */
59 unsigned char o_cputype[2]; /* cpu type */
60 unsigned char o_resv2[4]; /* reserved */
61 unsigned char tsize[8]; /* text size bytes, padded to FW bdry */
62 unsigned char dsize[8]; /* initialized data " " */
63 unsigned char bsize[8]; /* uninitialized data " " */
64 unsigned char entry[8]; /* entry pt. */
65 unsigned char o_maxstack[8]; /* max stack size (??) */
66 unsigned char o_maxdata[8]; /* max data size (??) */
67 unsigned char o_resv3[16]; /* reserved */
68}
69AOUTHDR;
70
71#define AOUTSZ 120
72#define SMALL_AOUTSZ (0)
73#define AOUTHDRSZ 72
74
75#define RS6K_AOUTHDR_OMAGIC 0x0107 /* old: text & data writeable */
76#define RS6K_AOUTHDR_NMAGIC 0x0108 /* new: text r/o, data r/w */
77#define RS6K_AOUTHDR_ZMAGIC 0x010B /* paged: text r/o, both page-aligned */
78
79
80/********************** SECTION HEADER **********************/
81
82
83struct external_scnhdr {
84 char s_name[8]; /* section name */
85 char s_paddr[8]; /* physical address, aliased s_nlib */
86 char s_vaddr[8]; /* virtual address */
87 char s_size[8]; /* section size */
88 char s_scnptr[8]; /* file ptr to raw data for section */
89 char s_relptr[8]; /* file ptr to relocation */
90 char s_lnnoptr[8]; /* file ptr to line numbers */
91 char s_nreloc[4]; /* number of relocation entries */
92 char s_nlnno[4]; /* number of line number entries*/
93 char s_flags[4]; /* flags */
94 char s_pad[4]; /* padding */
95};
96
97/*
98 * names of "special" sections
99 */
100#define _TEXT ".text"
101#define _DATA ".data"
102#define _BSS ".bss"
103#define _PAD ".pad"
104#define _LOADER ".loader"
105
106#define SCNHDR struct external_scnhdr
107
108#define SCNHSZ 72
109
110/* XCOFF uses a special .loader section with type STYP_LOADER. */
111#define STYP_LOADER 0x1000
112
113/* XCOFF uses a special .debug section with type STYP_DEBUG. */
114#define STYP_DEBUG 0x2000
115
116/* XCOFF handles line number or relocation overflow by creating
117 another section header with STYP_OVRFLO set. */
118#define STYP_OVRFLO 0x8000
119
120/********************** LINE NUMBERS **********************/
121
122/* 1 line number entry for every "breakpointable" source line in a section.
123 * Line numbers are grouped on a per function basis; first entry in a function
124 * grouping will have l_lnno = 0 and in place of physical address will be the
125 * symbol table index of the function name.
126 */
127struct external_lineno {
128 union {
129 char l_symndx[8];/* function name symbol index, iff l_lnno == 0*/
130 char l_paddr[8]; /* (physical) address of line number */
131 } l_addr;
132 char l_lnno[4]; /* line number */
133};
134
135
136#define LINENO struct external_lineno
137
138#define LINESZ 12
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_value[8];
151 } e;
152 char e_offset[4];
153 char e_scnum[2];
154 char e_type[2];
155 char e_sclass[1];
156 char e_numaux[1];
157};
158
159
160
161#define N_BTMASK (017)
162#define N_TMASK (060)
163#define N_BTSHFT (4)
164#define N_TSHIFT (2)
165
166
167union external_auxent {
168
169 struct {
170 union {
171 struct {
172 char x_lnno[4]; /* declaration line number */
173 char x_size[2]; /* str/union/array size */
174 } x_lnsz;
175 struct {
176 char x_lnnoptr[8];/* ptr to fcn line */
177 char x_fsize[4]; /* size of function */
178 char x_endndx[4]; /* entry ndx past block end */
179 } x_fcn;
180 } x_fcnary;
181 } x_sym;
182
183 union {
184 char x_fname[E_FILNMLEN];
185 struct {
186 char x_zeroes[4];
187 char x_offset[4];
188 char x_pad[6];
189 unsigned char x_ftype[1];
190 unsigned char x_resv[2];
191 } x_n;
192 } x_file;
193
194 struct {
195 char x_exptr[8];
196 char x_fsize[4];
197 char x_endndx[4];
198 char x_pad[1];
199 } x_except;
200
201 struct {
202 unsigned char x_scnlen_lo[4];
203 unsigned char x_parmhash[4];
204 unsigned char x_snhash[2];
205 unsigned char x_smtyp[1];
206 unsigned char x_smclas[1];
207 unsigned char x_scnlen_hi[4];
208 unsigned char x_pad[1];
209 } x_csect;
210
211 struct {
212 char x_pad[17];
213 char x_auxtype[1];
214 } x_auxtype;
215};
216
217#define SYMENT struct external_syment
218#define SYMESZ 18
219#define AUXENT union external_auxent
220#define AUXESZ 18
221#define DBXMASK 0x80 /* for dbx storage mask */
222#define SYMNAME_IN_DEBUG(symptr) ((symptr)->n_sclass & DBXMASK)
223
224/* Values for auxtype field in XCOFF64, taken from AIX 4.3 sym.h */
225#define _AUX_EXCEPT 255
226#define _AUX_FCN 254
227#define _AUX_SYM 253
228#define _AUX_FILE 252
229#define _AUX_CSECT 251
230
231
232
233/********************** RELOCATION DIRECTIVES **********************/
234
235
236struct external_reloc {
237 char r_vaddr[8];
238 char r_symndx[4];
239 char r_size[1];
240 char r_type[1];
241};
242
243
244#define RELOC struct external_reloc
245#define RELSZ 14
246
247#define DEFAULT_DATA_SECTION_ALIGNMENT 4
248#define DEFAULT_BSS_SECTION_ALIGNMENT 4
249#define DEFAULT_TEXT_SECTION_ALIGNMENT 4
250/* For new sections we havn't heard of before */
251#define DEFAULT_SECTION_ALIGNMENT 4
Note: See TracBrowser for help on using the repository browser.