1 |
24 |
jeremybenn |
/* Internal format of XCOFF object file data structures for BFD.
|
2 |
|
|
|
3 |
225 |
jeremybenn |
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005,
|
4 |
|
|
2009 Free Software Foundation, Inc.
|
5 |
24 |
jeremybenn |
Written by Ian Lance Taylor <ian@cygnus.com>, Cygnus Support.
|
6 |
|
|
|
7 |
|
|
This file is part of BFD, the Binary File Descriptor library.
|
8 |
|
|
|
9 |
|
|
This program is free software; you can redistribute it and/or modify
|
10 |
|
|
it under the terms of the GNU General Public License as published by
|
11 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
12 |
|
|
(at your option) any later version.
|
13 |
|
|
|
14 |
|
|
This program is distributed in the hope that it will be useful,
|
15 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
|
|
GNU General Public License for more details.
|
18 |
|
|
|
19 |
|
|
You should have received a copy of the GNU General Public License
|
20 |
|
|
along with this program; if not, write to the Free Software
|
21 |
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
22 |
|
|
|
23 |
|
|
#ifndef _INTERNAL_XCOFF_H
|
24 |
|
|
#define _INTERNAL_XCOFF_H
|
25 |
|
|
|
26 |
|
|
/* Linker */
|
27 |
|
|
|
28 |
|
|
/* Names of "special" sections. */
|
29 |
|
|
#define _TEXT ".text"
|
30 |
|
|
#define _DATA ".data"
|
31 |
|
|
#define _BSS ".bss"
|
32 |
|
|
#define _PAD ".pad"
|
33 |
|
|
#define _LOADER ".loader"
|
34 |
|
|
#define _EXCEPT ".except"
|
35 |
|
|
#define _TYPCHK ".typchk"
|
36 |
|
|
|
37 |
|
|
/* XCOFF uses a special .loader section with type STYP_LOADER. */
|
38 |
|
|
#define STYP_LOADER 0x1000
|
39 |
|
|
|
40 |
|
|
/* XCOFF uses a special .debug section with type STYP_DEBUG. */
|
41 |
|
|
#define STYP_DEBUG 0x2000
|
42 |
|
|
|
43 |
|
|
/* XCOFF handles line number or relocation overflow by creating
|
44 |
|
|
another section header with STYP_OVRFLO set. */
|
45 |
|
|
#define STYP_OVRFLO 0x8000
|
46 |
|
|
|
47 |
|
|
/* Specifies an exception section. A section of this type provides
|
48 |
|
|
information to identify the reason that a trap or ececptin occured within
|
49 |
|
|
and executable object program */
|
50 |
|
|
#define STYP_EXCEPT 0x0100
|
51 |
|
|
|
52 |
|
|
/* Specifies a type check section. A section of this type contains parameter
|
53 |
|
|
argument type check strings used by the AIX binder. */
|
54 |
|
|
#define STYP_TYPCHK 0x4000
|
55 |
|
|
|
56 |
|
|
#define RS6K_AOUTHDR_OMAGIC 0x0107 /* old: text & data writeable */
|
57 |
|
|
#define RS6K_AOUTHDR_NMAGIC 0x0108 /* new: text r/o, data r/w */
|
58 |
|
|
#define RS6K_AOUTHDR_ZMAGIC 0x010B /* paged: text r/o, both page-aligned */
|
59 |
|
|
|
60 |
|
|
/* XCOFF relocation types.
|
61 |
|
|
The relocations are described in the function
|
62 |
|
|
xcoff[64]_ppc_relocate_section in coff64-rs6000.c and coff-rs6000.c */
|
63 |
|
|
|
64 |
|
|
#define R_POS (0x00)
|
65 |
|
|
#define R_NEG (0x01)
|
66 |
|
|
#define R_REL (0x02)
|
67 |
|
|
#define R_TOC (0x03)
|
68 |
|
|
#define R_RTB (0x04)
|
69 |
|
|
#define R_GL (0x05)
|
70 |
|
|
#define R_TCL (0x06)
|
71 |
|
|
#define R_BA (0x08)
|
72 |
|
|
#define R_BR (0x0a)
|
73 |
|
|
#define R_RL (0x0c)
|
74 |
|
|
#define R_RLA (0x0d)
|
75 |
|
|
#define R_REF (0x0f)
|
76 |
|
|
#define R_TRL (0x12)
|
77 |
|
|
#define R_TRLA (0x13)
|
78 |
|
|
#define R_RRTBI (0x14)
|
79 |
|
|
#define R_RRTBA (0x15)
|
80 |
|
|
#define R_CAI (0x16)
|
81 |
|
|
#define R_CREL (0x17)
|
82 |
|
|
#define R_RBA (0x18)
|
83 |
|
|
#define R_RBAC (0x19)
|
84 |
|
|
#define R_RBR (0x1a)
|
85 |
|
|
#define R_RBRC (0x1b)
|
86 |
|
|
|
87 |
|
|
/* Storage class #defines, from /usr/include/storclass.h that are not already
|
88 |
|
|
defined in internal.h */
|
89 |
|
|
|
90 |
|
|
/* Comment string in .info section */
|
91 |
|
|
#define C_INFO 110
|
92 |
|
|
|
93 |
|
|
/* Auxillary Symbol Entries */
|
94 |
|
|
|
95 |
|
|
/* x_smtyp values: */
|
96 |
|
|
#define SMTYP_ALIGN(x) ((x) >> 3) /* log2 of alignment */
|
97 |
|
|
#define SMTYP_SMTYP(x) ((x) & 0x7) /* symbol type */
|
98 |
|
|
/* Symbol type values: */
|
99 |
|
|
#define XTY_ER 0 /* External reference */
|
100 |
|
|
#define XTY_SD 1 /* Csect definition */
|
101 |
|
|
#define XTY_LD 2 /* Label definition */
|
102 |
|
|
#define XTY_CM 3 /* .BSS */
|
103 |
|
|
#define XTY_EM 4 /* Error message */
|
104 |
|
|
#define XTY_US 5 /* "Reserved for internal use" */
|
105 |
|
|
|
106 |
|
|
/* x_smclas values: */
|
107 |
|
|
#define XMC_PR 0 /* Read-only program code */
|
108 |
|
|
#define XMC_RO 1 /* Read-only constant */
|
109 |
|
|
#define XMC_DB 2 /* Read-only debug dictionary table */
|
110 |
|
|
#define XMC_TC 3 /* Read-write general TOC entry */
|
111 |
|
|
#define XMC_UA 4 /* Read-write unclassified */
|
112 |
|
|
#define XMC_RW 5 /* Read-write data */
|
113 |
|
|
#define XMC_GL 6 /* Read-only global linkage */
|
114 |
|
|
#define XMC_XO 7 /* Read-only extended operation */
|
115 |
|
|
#define XMC_SV 8 /* Read-only supervisor call */
|
116 |
|
|
#define XMC_BS 9 /* Read-write BSS */
|
117 |
|
|
#define XMC_DS 10 /* Read-write descriptor csect */
|
118 |
|
|
#define XMC_UC 11 /* Read-write unnamed Fortran common */
|
119 |
|
|
#define XMC_TI 12 /* Read-only traceback index csect */
|
120 |
|
|
#define XMC_TB 13 /* Read-only traceback table csect */
|
121 |
|
|
/* 14 ??? */
|
122 |
|
|
#define XMC_TC0 15 /* Read-write TOC anchor */
|
123 |
|
|
#define XMC_TD 16 /* Read-write data in TOC */
|
124 |
|
|
#define XMC_SV64 17 /* Read-only 64 bit supervisor call */
|
125 |
|
|
#define XMC_SV3264 18 /* Read-only 32 or 64 bit supervisor call */
|
126 |
|
|
|
127 |
|
|
/* The ldhdr structure. This appears at the start of the .loader
|
128 |
|
|
section. */
|
129 |
|
|
|
130 |
|
|
struct internal_ldhdr
|
131 |
|
|
{
|
132 |
|
|
/* The version number:
|
133 |
|
|
1 : 32 bit
|
134 |
|
|
2 : 64 bit */
|
135 |
|
|
unsigned long l_version;
|
136 |
|
|
|
137 |
|
|
/* The number of symbol table entries. */
|
138 |
|
|
bfd_size_type l_nsyms;
|
139 |
|
|
|
140 |
|
|
/* The number of relocation table entries. */
|
141 |
|
|
bfd_size_type l_nreloc;
|
142 |
|
|
|
143 |
|
|
/* The length of the import file string table. */
|
144 |
|
|
bfd_size_type l_istlen;
|
145 |
|
|
|
146 |
|
|
/* The number of import files. */
|
147 |
|
|
bfd_size_type l_nimpid;
|
148 |
|
|
|
149 |
|
|
/* The offset from the start of the .loader section to the first
|
150 |
|
|
entry in the import file table. */
|
151 |
|
|
bfd_size_type l_impoff;
|
152 |
|
|
|
153 |
|
|
/* The length of the string table. */
|
154 |
|
|
bfd_size_type l_stlen;
|
155 |
|
|
|
156 |
|
|
/* The offset from the start of the .loader section to the first
|
157 |
|
|
entry in the string table. */
|
158 |
|
|
bfd_size_type l_stoff;
|
159 |
|
|
|
160 |
|
|
/* The offset to start of the symbol table, only in XCOFF64 */
|
161 |
|
|
bfd_vma l_symoff;
|
162 |
|
|
|
163 |
|
|
/* The offset to the start of the relocation table, only in XCOFF64 */
|
164 |
|
|
bfd_vma l_rldoff;
|
165 |
|
|
};
|
166 |
|
|
|
167 |
|
|
/* The ldsym structure. This is used to represent a symbol in the
|
168 |
|
|
.loader section. */
|
169 |
|
|
|
170 |
|
|
struct internal_ldsym
|
171 |
|
|
{
|
172 |
|
|
union
|
173 |
|
|
{
|
174 |
|
|
/* The symbol name if <= SYMNMLEN characters. */
|
175 |
|
|
char _l_name[SYMNMLEN];
|
176 |
|
|
struct
|
177 |
|
|
{
|
178 |
|
|
/* Zero if the symbol name is more than SYMNMLEN characters. */
|
179 |
|
|
long _l_zeroes;
|
180 |
|
|
|
181 |
|
|
/* The offset in the string table if the symbol name is more
|
182 |
|
|
than SYMNMLEN characters. */
|
183 |
|
|
long _l_offset;
|
184 |
|
|
}
|
185 |
|
|
_l_l;
|
186 |
|
|
}
|
187 |
|
|
_l;
|
188 |
|
|
|
189 |
|
|
/* The symbol value. */
|
190 |
|
|
bfd_vma l_value;
|
191 |
|
|
|
192 |
|
|
/* The symbol section number. */
|
193 |
|
|
short l_scnum;
|
194 |
|
|
|
195 |
|
|
/* The symbol type and flags. */
|
196 |
|
|
char l_smtype;
|
197 |
|
|
|
198 |
|
|
/* The symbol storage class. */
|
199 |
|
|
char l_smclas;
|
200 |
|
|
|
201 |
|
|
/* The import file ID. */
|
202 |
|
|
bfd_size_type l_ifile;
|
203 |
|
|
|
204 |
|
|
/* Offset to the parameter type check string. */
|
205 |
|
|
bfd_size_type l_parm;
|
206 |
|
|
};
|
207 |
|
|
|
208 |
|
|
/* These flags are for the l_smtype field (the lower three bits are an
|
209 |
|
|
XTY_* value). */
|
210 |
|
|
|
211 |
|
|
/* Imported symbol. */
|
212 |
|
|
#define L_IMPORT (0x40)
|
213 |
|
|
/* Entry point. */
|
214 |
|
|
#define L_ENTRY (0x20)
|
215 |
|
|
/* Exported symbol. */
|
216 |
|
|
#define L_EXPORT (0x10)
|
217 |
225 |
jeremybenn |
/* Weak symbol. */
|
218 |
|
|
#define L_WEAK (0x08)
|
219 |
24 |
jeremybenn |
|
220 |
|
|
/* The ldrel structure. This is used to represent a reloc in the
|
221 |
|
|
.loader section. */
|
222 |
|
|
|
223 |
|
|
struct internal_ldrel
|
224 |
|
|
{
|
225 |
|
|
/* The reloc address. */
|
226 |
|
|
bfd_vma l_vaddr;
|
227 |
|
|
|
228 |
|
|
/* The symbol table index in the .loader section symbol table. */
|
229 |
|
|
bfd_size_type l_symndx;
|
230 |
|
|
|
231 |
|
|
/* The relocation type and size. */
|
232 |
|
|
short l_rtype;
|
233 |
|
|
|
234 |
|
|
/* The section number this relocation applies to. */
|
235 |
|
|
short l_rsecnm;
|
236 |
|
|
};
|
237 |
|
|
|
238 |
|
|
/* An entry in the XCOFF linker hash table. */
|
239 |
|
|
struct xcoff_link_hash_entry
|
240 |
|
|
{
|
241 |
|
|
struct bfd_link_hash_entry root;
|
242 |
|
|
|
243 |
|
|
/* Symbol index in output file. Set to -1 initially. Set to -2 if
|
244 |
|
|
there is a reloc against this symbol. */
|
245 |
|
|
long indx;
|
246 |
|
|
|
247 |
|
|
/* If we have created a TOC entry for this symbol, this is the .tc
|
248 |
|
|
section which holds it. */
|
249 |
|
|
asection *toc_section;
|
250 |
|
|
|
251 |
|
|
union
|
252 |
|
|
{
|
253 |
|
|
/* If we have created a TOC entry (the XCOFF_SET_TOC flag is
|
254 |
|
|
set), this is the offset in toc_section. */
|
255 |
|
|
bfd_vma toc_offset;
|
256 |
|
|
|
257 |
|
|
/* If the TOC entry comes from an input file, this is set to the
|
258 |
|
|
symbol index of the C_HIDEXT XMC_TC or XMC_TD symbol. */
|
259 |
|
|
long toc_indx;
|
260 |
|
|
}
|
261 |
|
|
u;
|
262 |
|
|
|
263 |
|
|
/* If this symbol is a function entry point which is called, this
|
264 |
|
|
field holds a pointer to the function descriptor. If this symbol
|
265 |
|
|
is a function descriptor, this field holds a pointer to the
|
266 |
|
|
function entry point. */
|
267 |
|
|
struct xcoff_link_hash_entry *descriptor;
|
268 |
|
|
|
269 |
|
|
/* The .loader symbol table entry, if there is one. */
|
270 |
|
|
struct internal_ldsym *ldsym;
|
271 |
|
|
|
272 |
|
|
/* If XCOFF_BUILT_LDSYM is set, this is the .loader symbol table
|
273 |
|
|
index. If XCOFF_BUILD_LDSYM is clear, and XCOFF_IMPORT is set,
|
274 |
|
|
this is the l_ifile value. */
|
275 |
|
|
long ldindx;
|
276 |
|
|
|
277 |
|
|
/* Some linker flags. */
|
278 |
|
|
unsigned long flags;
|
279 |
|
|
|
280 |
|
|
/* The storage mapping class. */
|
281 |
|
|
unsigned char smclas;
|
282 |
|
|
};
|
283 |
|
|
|
284 |
|
|
/* Flags for xcoff_link_hash_entry. */
|
285 |
|
|
|
286 |
|
|
/* Symbol is referenced by a regular object. */
|
287 |
|
|
#define XCOFF_REF_REGULAR 0x00000001
|
288 |
|
|
/* Symbol is defined by a regular object. */
|
289 |
|
|
#define XCOFF_DEF_REGULAR 0x00000002
|
290 |
|
|
/* Symbol is defined by a dynamic object. */
|
291 |
|
|
#define XCOFF_DEF_DYNAMIC 0x00000004
|
292 |
|
|
/* Symbol is used in a reloc being copied into the .loader section. */
|
293 |
|
|
#define XCOFF_LDREL 0x00000008
|
294 |
|
|
/* Symbol is the entry point. */
|
295 |
|
|
#define XCOFF_ENTRY 0x00000010
|
296 |
225 |
jeremybenn |
/* Symbol is for a function and is the target of a relocation.
|
297 |
|
|
The relocation may or may not be a branch-type relocation. */
|
298 |
24 |
jeremybenn |
#define XCOFF_CALLED 0x00000020
|
299 |
|
|
/* Symbol needs the TOC entry filled in. */
|
300 |
|
|
#define XCOFF_SET_TOC 0x00000040
|
301 |
225 |
jeremybenn |
/* Symbol is implicitly or explicitly imported. */
|
302 |
24 |
jeremybenn |
#define XCOFF_IMPORT 0x00000080
|
303 |
|
|
/* Symbol is explicitly exported. */
|
304 |
|
|
#define XCOFF_EXPORT 0x00000100
|
305 |
|
|
/* Symbol has been processed by xcoff_build_ldsyms. */
|
306 |
|
|
#define XCOFF_BUILT_LDSYM 0x00000200
|
307 |
|
|
/* Symbol is mentioned by a section which was not garbage collected. */
|
308 |
|
|
#define XCOFF_MARK 0x00000400
|
309 |
|
|
/* Symbol size is recorded in size_list list from hash table. */
|
310 |
|
|
#define XCOFF_HAS_SIZE 0x00000800
|
311 |
|
|
/* Symbol is a function descriptor. */
|
312 |
|
|
#define XCOFF_DESCRIPTOR 0x00001000
|
313 |
|
|
/* Multiple definitions have been for the symbol. */
|
314 |
|
|
#define XCOFF_MULTIPLY_DEFINED 0x00002000
|
315 |
|
|
/* Symbol is the __rtinit symbol. */
|
316 |
|
|
#define XCOFF_RTINIT 0x00004000
|
317 |
|
|
/* Symbol is an imported 32 bit syscall. */
|
318 |
|
|
#define XCOFF_SYSCALL32 0x00008000
|
319 |
|
|
/* Symbol is an imported 64 bit syscall. */
|
320 |
|
|
#define XCOFF_SYSCALL64 0x00010000
|
321 |
225 |
jeremybenn |
/* Symbol was not explicitly defined by the time it was marked. */
|
322 |
|
|
#define XCOFF_WAS_UNDEFINED 0x00020000
|
323 |
|
|
/* We have assigned an output XCOFF entry to this symbol. */
|
324 |
|
|
#define XCOFF_ALLOCATED 0x00040000
|
325 |
24 |
jeremybenn |
|
326 |
|
|
/* The XCOFF linker hash table. */
|
327 |
|
|
|
328 |
|
|
#define XCOFF_NUMBER_OF_SPECIAL_SECTIONS 6
|
329 |
|
|
#define XCOFF_SPECIAL_SECTION_TEXT 0
|
330 |
|
|
#define XCOFF_SPECIAL_SECTION_ETEXT 1
|
331 |
|
|
#define XCOFF_SPECIAL_SECTION_DATA 2
|
332 |
|
|
#define XCOFF_SPECIAL_SECTION_EDATA 3
|
333 |
|
|
#define XCOFF_SPECIAL_SECTION_END 4
|
334 |
|
|
#define XCOFF_SPECIAL_SECTION_END2 5
|
335 |
|
|
|
336 |
225 |
jeremybenn |
/* These flags indicate which of -bexpall and -bexpfull are in effect. */
|
337 |
|
|
#define XCOFF_EXPALL 1
|
338 |
|
|
#define XCOFF_EXPFULL 2
|
339 |
24 |
jeremybenn |
|
340 |
|
|
/* This structure is used to pass information through
|
341 |
|
|
xcoff_link_hash_traverse. */
|
342 |
|
|
|
343 |
|
|
struct xcoff_loader_info
|
344 |
|
|
{
|
345 |
|
|
/* Set if a problem occurred. */
|
346 |
|
|
bfd_boolean failed;
|
347 |
|
|
|
348 |
|
|
/* Output BFD. */
|
349 |
|
|
bfd *output_bfd;
|
350 |
|
|
|
351 |
|
|
/* Link information structure. */
|
352 |
|
|
struct bfd_link_info *info;
|
353 |
|
|
|
354 |
225 |
jeremybenn |
/* A mask of XCOFF_EXPALL and XCOFF_EXPFULL flags. */
|
355 |
|
|
unsigned int auto_export_flags;
|
356 |
24 |
jeremybenn |
|
357 |
|
|
/* Number of ldsym structures. */
|
358 |
|
|
size_t ldsym_count;
|
359 |
|
|
|
360 |
|
|
/* Size of string table. */
|
361 |
|
|
size_t string_size;
|
362 |
|
|
|
363 |
|
|
/* String table. */
|
364 |
|
|
char *strings;
|
365 |
|
|
|
366 |
|
|
/* Allocated size of string table. */
|
367 |
|
|
size_t string_alc;
|
368 |
|
|
};
|
369 |
|
|
|
370 |
|
|
/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
|
371 |
|
|
from smaller values. Start with zero, widen, *then* decrement. */
|
372 |
|
|
#define MINUS_ONE (((bfd_vma) 0) - 1)
|
373 |
|
|
|
374 |
|
|
/* __rtinit, from /usr/include/rtinit.h. */
|
375 |
|
|
struct __rtinit
|
376 |
|
|
{
|
377 |
|
|
/* Pointer to runtime linker.
|
378 |
|
|
XXX: Is the parameter really void? */
|
379 |
|
|
int (*rtl) (void);
|
380 |
|
|
|
381 |
|
|
/* Offset to array of init functions, 0 if none. */
|
382 |
|
|
int init_offset;
|
383 |
|
|
|
384 |
|
|
/* Offset to array of fini functions, 0 if none. */
|
385 |
|
|
int fini_offset;
|
386 |
|
|
|
387 |
|
|
/* Size of __RTINIT_DESCRIPTOR. This value should be used instead of
|
388 |
|
|
sizeof(__RTINIT_DESCRIPTOR). */
|
389 |
|
|
int __rtinit_descriptor_size;
|
390 |
|
|
};
|
391 |
|
|
|
392 |
|
|
#define RTINIT_DESCRIPTOR_SIZE (12)
|
393 |
|
|
|
394 |
|
|
struct __rtinit_descriptor
|
395 |
|
|
{
|
396 |
|
|
/* Init/fini function. */
|
397 |
|
|
int f;
|
398 |
|
|
|
399 |
|
|
/* Offset, relative to the start of the __rtinit symbol, to name of the
|
400 |
|
|
function. */
|
401 |
|
|
|
402 |
|
|
int name_offset;
|
403 |
|
|
|
404 |
|
|
/* Flags */
|
405 |
|
|
unsigned char flags;
|
406 |
|
|
};
|
407 |
|
|
|
408 |
|
|
/* Archive */
|
409 |
|
|
|
410 |
|
|
#define XCOFFARMAG "<aiaff>\012"
|
411 |
|
|
#define XCOFFARMAGBIG "<bigaf>\012"
|
412 |
|
|
#define SXCOFFARMAG 8
|
413 |
|
|
|
414 |
|
|
/* The size of the ascii archive elements */
|
415 |
|
|
#define XCOFFARMAG_ELEMENT_SIZE 12
|
416 |
|
|
#define XCOFFARMAGBIG_ELEMENT_SIZE 20
|
417 |
|
|
|
418 |
|
|
/* This terminates an XCOFF archive member name. */
|
419 |
|
|
|
420 |
|
|
#define XCOFFARFMAG "`\012"
|
421 |
|
|
#define SXCOFFARFMAG 2
|
422 |
|
|
|
423 |
|
|
/* XCOFF archives start with this (printable) structure. */
|
424 |
|
|
|
425 |
|
|
struct xcoff_ar_file_hdr
|
426 |
|
|
{
|
427 |
|
|
/* Magic string. */
|
428 |
|
|
char magic[SXCOFFARMAG];
|
429 |
|
|
|
430 |
|
|
/* Offset of the member table (decimal ASCII string). */
|
431 |
|
|
char memoff[XCOFFARMAG_ELEMENT_SIZE];
|
432 |
|
|
|
433 |
|
|
/* Offset of the global symbol table (decimal ASCII string). */
|
434 |
|
|
char symoff[XCOFFARMAG_ELEMENT_SIZE];
|
435 |
|
|
|
436 |
|
|
/* Offset of the first member in the archive (decimal ASCII string). */
|
437 |
|
|
char firstmemoff[XCOFFARMAG_ELEMENT_SIZE];
|
438 |
|
|
|
439 |
|
|
/* Offset of the last member in the archive (decimal ASCII string). */
|
440 |
|
|
char lastmemoff[XCOFFARMAG_ELEMENT_SIZE];
|
441 |
|
|
|
442 |
|
|
/* Offset of the first member on the free list (decimal ASCII
|
443 |
|
|
string). */
|
444 |
|
|
char freeoff[XCOFFARMAG_ELEMENT_SIZE];
|
445 |
|
|
};
|
446 |
|
|
|
447 |
|
|
#define SIZEOF_AR_FILE_HDR (SXCOFFARMAG + 5 * XCOFFARMAG_ELEMENT_SIZE)
|
448 |
|
|
|
449 |
|
|
/* This is the equivalent data structure for the big archive format. */
|
450 |
|
|
|
451 |
|
|
struct xcoff_ar_file_hdr_big
|
452 |
|
|
{
|
453 |
|
|
/* Magic string. */
|
454 |
|
|
char magic[SXCOFFARMAG];
|
455 |
|
|
|
456 |
|
|
/* Offset of the member table (decimal ASCII string). */
|
457 |
|
|
char memoff[XCOFFARMAGBIG_ELEMENT_SIZE];
|
458 |
|
|
|
459 |
|
|
/* Offset of the global symbol table for 32-bit objects (decimal ASCII
|
460 |
|
|
string). */
|
461 |
|
|
char symoff[XCOFFARMAGBIG_ELEMENT_SIZE];
|
462 |
|
|
|
463 |
|
|
/* Offset of the global symbol table for 64-bit objects (decimal ASCII
|
464 |
|
|
string). */
|
465 |
|
|
char symoff64[XCOFFARMAGBIG_ELEMENT_SIZE];
|
466 |
|
|
|
467 |
|
|
/* Offset of the first member in the archive (decimal ASCII string). */
|
468 |
|
|
char firstmemoff[XCOFFARMAGBIG_ELEMENT_SIZE];
|
469 |
|
|
|
470 |
|
|
/* Offset of the last member in the archive (decimal ASCII string). */
|
471 |
|
|
char lastmemoff[XCOFFARMAGBIG_ELEMENT_SIZE];
|
472 |
|
|
|
473 |
|
|
/* Offset of the first member on the free list (decimal ASCII
|
474 |
|
|
string). */
|
475 |
|
|
char freeoff[XCOFFARMAGBIG_ELEMENT_SIZE];
|
476 |
|
|
};
|
477 |
|
|
|
478 |
|
|
#define SIZEOF_AR_FILE_HDR_BIG (SXCOFFARMAG + 6 * XCOFFARMAGBIG_ELEMENT_SIZE)
|
479 |
|
|
|
480 |
|
|
/* Each XCOFF archive member starts with this (printable) structure. */
|
481 |
|
|
|
482 |
|
|
struct xcoff_ar_hdr
|
483 |
|
|
{
|
484 |
|
|
/* File size not including the header (decimal ASCII string). */
|
485 |
|
|
char size[XCOFFARMAG_ELEMENT_SIZE];
|
486 |
|
|
|
487 |
|
|
/* File offset of next archive member (decimal ASCII string). */
|
488 |
|
|
char nextoff[XCOFFARMAG_ELEMENT_SIZE];
|
489 |
|
|
|
490 |
|
|
/* File offset of previous archive member (decimal ASCII string). */
|
491 |
|
|
char prevoff[XCOFFARMAG_ELEMENT_SIZE];
|
492 |
|
|
|
493 |
|
|
/* File mtime (decimal ASCII string). */
|
494 |
|
|
char date[12];
|
495 |
|
|
|
496 |
|
|
/* File UID (decimal ASCII string). */
|
497 |
|
|
char uid[12];
|
498 |
|
|
|
499 |
|
|
/* File GID (decimal ASCII string). */
|
500 |
|
|
char gid[12];
|
501 |
|
|
|
502 |
|
|
/* File mode (octal ASCII string). */
|
503 |
|
|
char mode[12];
|
504 |
|
|
|
505 |
|
|
/* Length of file name (decimal ASCII string). */
|
506 |
|
|
char namlen[4];
|
507 |
|
|
|
508 |
|
|
/* This structure is followed by the file name. The length of the
|
509 |
|
|
name is given in the namlen field. If the length of the name is
|
510 |
|
|
odd, the name is followed by a null byte. The name and optional
|
511 |
|
|
null byte are followed by XCOFFARFMAG, which is not included in
|
512 |
|
|
namlen. The contents of the archive member follow; the number of
|
513 |
|
|
bytes is given in the size field. */
|
514 |
|
|
};
|
515 |
|
|
|
516 |
|
|
#define SIZEOF_AR_HDR (3 * XCOFFARMAG_ELEMENT_SIZE + 4 * 12 + 4)
|
517 |
|
|
|
518 |
|
|
/* The equivalent for the big archive format. */
|
519 |
|
|
|
520 |
|
|
struct xcoff_ar_hdr_big
|
521 |
|
|
{
|
522 |
|
|
/* File size not including the header (decimal ASCII string). */
|
523 |
|
|
char size[XCOFFARMAGBIG_ELEMENT_SIZE];
|
524 |
|
|
|
525 |
|
|
/* File offset of next archive member (decimal ASCII string). */
|
526 |
|
|
char nextoff[XCOFFARMAGBIG_ELEMENT_SIZE];
|
527 |
|
|
|
528 |
|
|
/* File offset of previous archive member (decimal ASCII string). */
|
529 |
|
|
char prevoff[XCOFFARMAGBIG_ELEMENT_SIZE];
|
530 |
|
|
|
531 |
|
|
/* File mtime (decimal ASCII string). */
|
532 |
|
|
char date[12];
|
533 |
|
|
|
534 |
|
|
/* File UID (decimal ASCII string). */
|
535 |
|
|
char uid[12];
|
536 |
|
|
|
537 |
|
|
/* File GID (decimal ASCII string). */
|
538 |
|
|
char gid[12];
|
539 |
|
|
|
540 |
|
|
/* File mode (octal ASCII string). */
|
541 |
|
|
char mode[12];
|
542 |
|
|
|
543 |
|
|
/* Length of file name (decimal ASCII string). */
|
544 |
|
|
char namlen[4];
|
545 |
|
|
|
546 |
|
|
/* This structure is followed by the file name. The length of the
|
547 |
|
|
name is given in the namlen field. If the length of the name is
|
548 |
|
|
odd, the name is followed by a null byte. The name and optional
|
549 |
|
|
null byte are followed by XCOFFARFMAG, which is not included in
|
550 |
|
|
namlen. The contents of the archive member follow; the number of
|
551 |
|
|
bytes is given in the size field. */
|
552 |
|
|
};
|
553 |
|
|
|
554 |
|
|
#define SIZEOF_AR_HDR_BIG (3 * XCOFFARMAGBIG_ELEMENT_SIZE + 4 * 12 + 4)
|
555 |
|
|
|
556 |
|
|
/* We often have to distinguish between the old and big file format.
|
557 |
|
|
Make it a bit cleaner. We can use `xcoff_ardata' here because the
|
558 |
|
|
`hdr' member has the same size and position in both formats.
|
559 |
|
|
<bigaf> is the default format, return TRUE even when xcoff_ardata is
|
560 |
|
|
NULL. */
|
561 |
|
|
#ifndef SMALL_ARCHIVE
|
562 |
|
|
/* Creates big archives by default */
|
563 |
|
|
#define xcoff_big_format_p(abfd) \
|
564 |
|
|
((NULL != bfd_ardata (abfd) && NULL == xcoff_ardata (abfd)) || \
|
565 |
|
|
((NULL != bfd_ardata (abfd)) && \
|
566 |
|
|
(NULL != xcoff_ardata (abfd)) && \
|
567 |
|
|
(xcoff_ardata (abfd)->magic[1] == 'b')))
|
568 |
|
|
#else
|
569 |
|
|
/* Creates small archives by default. */
|
570 |
|
|
#define xcoff_big_format_p(abfd) \
|
571 |
|
|
(((NULL != bfd_ardata (abfd)) && \
|
572 |
|
|
(NULL != xcoff_ardata (abfd)) && \
|
573 |
|
|
(xcoff_ardata (abfd)->magic[1] == 'b')))
|
574 |
|
|
#endif
|
575 |
|
|
|
576 |
|
|
/* We store a copy of the xcoff_ar_file_hdr in the tdata field of the
|
577 |
|
|
artdata structure. Similar for the big archive. */
|
578 |
|
|
#define xcoff_ardata(abfd) \
|
579 |
|
|
((struct xcoff_ar_file_hdr *) bfd_ardata (abfd)->tdata)
|
580 |
|
|
#define xcoff_ardata_big(abfd) \
|
581 |
|
|
((struct xcoff_ar_file_hdr_big *) bfd_ardata (abfd)->tdata)
|
582 |
|
|
|
583 |
|
|
/* We store a copy of the xcoff_ar_hdr in the arelt_data field of an
|
584 |
|
|
archive element. Similar for the big archive. */
|
585 |
|
|
#define arch_eltdata(bfd) ((struct areltdata *) ((bfd)->arelt_data))
|
586 |
|
|
#define arch_xhdr(bfd) \
|
587 |
|
|
((struct xcoff_ar_hdr *) arch_eltdata (bfd)->arch_header)
|
588 |
|
|
#define arch_xhdr_big(bfd) \
|
589 |
|
|
((struct xcoff_ar_hdr_big *) arch_eltdata (bfd)->arch_header)
|
590 |
|
|
|
591 |
225 |
jeremybenn |
/* True if symbols of class CLASS are external. */
|
592 |
|
|
#define EXTERN_SYM_P(CLASS) \
|
593 |
|
|
((CLASS) == C_EXT || (CLASS) == C_AIX_WEAKEXT)
|
594 |
|
|
|
595 |
24 |
jeremybenn |
#endif /* _INTERNAL_XCOFF_H */
|