]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - include/coff/rs6000.h
2001-05-24 H.J. Lu <hjl@gnu.org>
[thirdparty/binutils-gdb.git] / include / coff / rs6000.h
CommitLineData
252b5132 1/* IBM RS/6000 "XCOFF" file definitions for BFD.
4f1d9bd8 2 Copyright 1990, 1991, 1993, 1994, 1995 Free Software Foundation, Inc.
252b5132
RH
3 FIXME: Can someone provide a transliteration of this name into ASCII?
4 Using the following chars caused a compiler warning on HIUX (so I replaced
5 them with octal escapes), and isn't useful without an understanding of what
6 character set it is.
7 Written by Mimi Ph\373\364ng-Th\345o V\365 of IBM
8 and John Gilmore of Cygnus Support. */
9
4f1d9bd8
NC
10#define DO_NOT_DEFINE_AOUTHDR
11#define DO_NOT_DEFINE_AUXENT
12#define L_LNNO_SIZE 2
13#include "coff/external.h"
252b5132
RH
14
15 /* IBM RS/6000 */
16#define U802WRMAGIC 0730 /* writeable text segments **chh** */
17#define U802ROMAGIC 0735 /* readonly sharable text segments */
18#define U802TOCMAGIC 0737 /* readonly text segments and TOC */
19
20#define BADMAG(x) \
21 ((x).f_magic != U802ROMAGIC && (x).f_magic != U802WRMAGIC && \
22 (x).f_magic != U802TOCMAGIC)
23
252b5132
RH
24/********************** AOUT "OPTIONAL HEADER" **********************/
25
252b5132
RH
26typedef struct
27{
28 unsigned char magic[2]; /* type of file */
29 unsigned char vstamp[2]; /* version stamp */
30 unsigned char tsize[4]; /* text size in bytes, padded to FW bdry */
31 unsigned char dsize[4]; /* initialized data " " */
32 unsigned char bsize[4]; /* uninitialized data " " */
33 unsigned char entry[4]; /* entry pt. */
34 unsigned char text_start[4]; /* base of text used for this file */
35 unsigned char data_start[4]; /* base of data used for this file */
36 unsigned char o_toc[4]; /* address of TOC */
37 unsigned char o_snentry[2]; /* section number of entry point */
38 unsigned char o_sntext[2]; /* section number of .text section */
39 unsigned char o_sndata[2]; /* section number of .data section */
40 unsigned char o_sntoc[2]; /* section number of TOC */
41 unsigned char o_snloader[2]; /* section number of .loader section */
42 unsigned char o_snbss[2]; /* section number of .bss section */
43 unsigned char o_algntext[2]; /* .text alignment */
44 unsigned char o_algndata[2]; /* .data alignment */
45 unsigned char o_modtype[2]; /* module type (??) */
46 unsigned char o_cputype[2]; /* cpu type */
47 unsigned char o_maxstack[4]; /* max stack size (??) */
48 unsigned char o_maxdata[4]; /* max data size (??) */
49 unsigned char o_resv2[12]; /* reserved */
50}
51AOUTHDR;
52
53#define AOUTSZ 72
54#define SMALL_AOUTSZ (28)
55#define AOUTHDRSZ 72
56
57#define RS6K_AOUTHDR_OMAGIC 0x0107 /* old: text & data writeable */
58#define RS6K_AOUTHDR_NMAGIC 0x0108 /* new: text r/o, data r/w */
59#define RS6K_AOUTHDR_ZMAGIC 0x010B /* paged: text r/o, both page-aligned */
60
4f1d9bd8 61/* More names of "special" sections. */
252b5132
RH
62#define _PAD ".pad"
63#define _LOADER ".loader"
64
252b5132
RH
65/* XCOFF uses a special .loader section with type STYP_LOADER. */
66#define STYP_LOADER 0x1000
67
68/* XCOFF uses a special .debug section with type STYP_DEBUG. */
69#define STYP_DEBUG 0x2000
70
71/* XCOFF handles line number or relocation overflow by creating
72 another section header with STYP_OVRFLO set. */
73#define STYP_OVRFLO 0x8000
74
4f1d9bd8 75union external_auxent
252b5132 76{
4f1d9bd8
NC
77 struct
78 {
79 char x_tagndx[4]; /* str, un, or enum tag indx */
80
81 union
82 {
83 struct
84 {
85 char x_lnno[2]; /* declaration line number */
86 char x_size[2]; /* str/union/array size */
87 } x_lnsz;
88
89 char x_fsize[4]; /* size of function */
90
91 } x_misc;
92
93 union
94 {
95 struct /* if ISFCN, tag, or .bb */
96 {
97 char x_lnnoptr[4]; /* ptr to fcn line # */
98 char x_endndx[4]; /* entry ndx past block end */
99 } x_fcn;
100
101 struct /* if ISARY, up to 4 dimen. */
102 {
103 char x_dimen[E_DIMNUM][2];
104 } x_ary;
105
106 } x_fcnary;
107
108 char x_tvndx[2]; /* tv index */
109
110 } x_sym;
111
112 union
113 {
114 char x_fname[E_FILNMLEN];
115
116 struct
117 {
118 char x_zeroes[4];
119 char x_offset[4];
120 } x_n;
121
122 } x_file;
123
124 struct
125 {
126 char x_scnlen[4]; /* section length */
127 char x_nreloc[2]; /* # relocation entries */
128 char x_nlinno[2]; /* # line numbers */
129 } x_scn;
130
131 struct
132 {
133 char x_tvfill[4]; /* tv fill value */
134 char x_tvlen[2]; /* length of .tv */
135 char x_tvran[2][2]; /* tv range */
136 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
137
138 struct
139 {
140 unsigned char x_scnlen[4];
141 unsigned char x_parmhash[4];
142 unsigned char x_snhash[2];
143 unsigned char x_smtyp[1];
144 unsigned char x_smclas[1];
145 unsigned char x_stab[4];
146 unsigned char x_snstab[2];
147 } x_csect;
252b5132
RH
148};
149
252b5132
RH
150#define AUXENT union external_auxent
151#define AUXESZ 18
4f1d9bd8 152
252b5132
RH
153#define DBXMASK 0x80 /* for dbx storage mask */
154#define SYMNAME_IN_DEBUG(symptr) ((symptr)->n_sclass & DBXMASK)
155
252b5132
RH
156/********************** RELOCATION DIRECTIVES **********************/
157
4f1d9bd8
NC
158struct external_reloc
159{
252b5132
RH
160 char r_vaddr[4];
161 char r_symndx[4];
162 char r_size[1];
163 char r_type[1];
164};
165
252b5132
RH
166#define RELOC struct external_reloc
167#define RELSZ 10
168
169#define DEFAULT_DATA_SECTION_ALIGNMENT 4
170#define DEFAULT_BSS_SECTION_ALIGNMENT 4
171#define DEFAULT_TEXT_SECTION_ALIGNMENT 4
172/* For new sections we havn't heard of before */
173#define DEFAULT_SECTION_ALIGNMENT 4