1 | /* BFD back-end data structures for a.out (and similar) files.
|
---|
2 | Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
---|
3 | 2000, 2001
|
---|
4 | Free Software Foundation, Inc.
|
---|
5 | Written by 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
---|
22 |
|
---|
23 | #ifndef LIBAOUT_H
|
---|
24 | #define LIBAOUT_H
|
---|
25 |
|
---|
26 | /* We try to encapsulate the differences in the various a.out file
|
---|
27 | variants in a few routines, and otherwise share large masses of code.
|
---|
28 | This means we only have to fix bugs in one place, most of the time. */
|
---|
29 |
|
---|
30 | #include "bfdlink.h"
|
---|
31 |
|
---|
32 | /* Parameterize the a.out code based on whether it is being built
|
---|
33 | for a 32-bit architecture or a 64-bit architecture. */
|
---|
34 | #if ARCH_SIZE==64
|
---|
35 | #define GET_WORD bfd_h_get_64
|
---|
36 | #define GET_SWORD bfd_h_get_signed_64
|
---|
37 | #define PUT_WORD bfd_h_put_64
|
---|
38 | #ifndef NAME
|
---|
39 | #define NAME(x,y) CAT3(x,_64_,y)
|
---|
40 | #endif
|
---|
41 | #define JNAME(x) CAT(x,_64)
|
---|
42 | #define BYTES_IN_WORD 8
|
---|
43 | #else /* ARCH_SIZE == 32 */
|
---|
44 | #define GET_WORD bfd_h_get_32
|
---|
45 | #define GET_SWORD bfd_h_get_signed_32
|
---|
46 | #define PUT_WORD bfd_h_put_32
|
---|
47 | #ifndef NAME
|
---|
48 | #define NAME(x,y) CAT3(x,_32_,y)
|
---|
49 | #endif
|
---|
50 | #define JNAME(x) CAT(x,_32)
|
---|
51 | #define BYTES_IN_WORD 4
|
---|
52 | #endif /* ARCH_SIZE==32 */
|
---|
53 |
|
---|
54 | /* Declare at file level, since used in parameter lists, which have
|
---|
55 | weird scope. */
|
---|
56 | struct external_exec;
|
---|
57 | struct external_nlist;
|
---|
58 | struct reloc_ext_external;
|
---|
59 | struct reloc_std_external;
|
---|
60 | |
---|
61 |
|
---|
62 | /* a.out backend linker hash table entries. */
|
---|
63 |
|
---|
64 | struct aout_link_hash_entry
|
---|
65 | {
|
---|
66 | struct bfd_link_hash_entry root;
|
---|
67 | /* Whether this symbol has been written out. */
|
---|
68 | boolean written;
|
---|
69 | /* Symbol index in output file. */
|
---|
70 | int indx;
|
---|
71 | };
|
---|
72 |
|
---|
73 | /* a.out backend linker hash table. */
|
---|
74 |
|
---|
75 | struct aout_link_hash_table
|
---|
76 | {
|
---|
77 | struct bfd_link_hash_table root;
|
---|
78 | };
|
---|
79 |
|
---|
80 | /* Look up an entry in an a.out link hash table. */
|
---|
81 |
|
---|
82 | #define aout_link_hash_lookup(table, string, create, copy, follow) \
|
---|
83 | ((struct aout_link_hash_entry *) \
|
---|
84 | bfd_link_hash_lookup (&(table)->root, (string), (create), (copy), (follow)))
|
---|
85 |
|
---|
86 | /* Traverse an a.out link hash table. */
|
---|
87 |
|
---|
88 | #define aout_link_hash_traverse(table, func, info) \
|
---|
89 | (bfd_link_hash_traverse \
|
---|
90 | (&(table)->root, \
|
---|
91 | (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
|
---|
92 | (info)))
|
---|
93 |
|
---|
94 | /* Get the a.out link hash table from the info structure. This is
|
---|
95 | just a cast. */
|
---|
96 |
|
---|
97 | #define aout_hash_table(p) ((struct aout_link_hash_table *) ((p)->hash))
|
---|
98 | |
---|
99 |
|
---|
100 | /* Back-end information for various a.out targets. */
|
---|
101 | struct aout_backend_data
|
---|
102 | {
|
---|
103 | /* Are ZMAGIC files mapped contiguously? If so, the text section may
|
---|
104 | need more padding, if the segment size (granularity for memory access
|
---|
105 | control) is larger than the page size. */
|
---|
106 | unsigned char zmagic_mapped_contiguous;
|
---|
107 | /* If this flag is set, ZMAGIC/NMAGIC file headers get mapped in with the
|
---|
108 | text section, which starts immediately after the file header.
|
---|
109 | If not, the text section starts on the next page. */
|
---|
110 | unsigned char text_includes_header;
|
---|
111 |
|
---|
112 | /* If this flag is set, then if the entry address is not in the
|
---|
113 | first SEGMENT_SIZE bytes of the text section, it is taken to be
|
---|
114 | the address of the start of the text section. This can be useful
|
---|
115 | for kernels. */
|
---|
116 | unsigned char entry_is_text_address;
|
---|
117 |
|
---|
118 | /* The value to pass to N_SET_FLAGS. */
|
---|
119 | unsigned char exec_hdr_flags;
|
---|
120 |
|
---|
121 | /* If the text section VMA isn't specified, and we need an absolute
|
---|
122 | address, use this as the default. If we're producing a relocatable
|
---|
123 | file, zero is always used. */
|
---|
124 | /* ?? Perhaps a callback would be a better choice? Will this do anything
|
---|
125 | reasonable for a format that handles multiple CPUs with different
|
---|
126 | load addresses for each? */
|
---|
127 | bfd_vma default_text_vma;
|
---|
128 |
|
---|
129 | /* Callback for setting the page and segment sizes, if they can't be
|
---|
130 | trivially determined from the architecture. */
|
---|
131 | boolean (*set_sizes) PARAMS ((bfd *));
|
---|
132 |
|
---|
133 | /* zmagic files only. For go32, the length of the exec header contributes
|
---|
134 | to the size of the text section in the file for alignment purposes but
|
---|
135 | does *not* get counted in the length of the text section. */
|
---|
136 | unsigned char exec_header_not_counted;
|
---|
137 |
|
---|
138 | /* Callback from the add symbols phase of the linker code to handle
|
---|
139 | a dynamic object. */
|
---|
140 | boolean (*add_dynamic_symbols) PARAMS ((bfd *, struct bfd_link_info *,
|
---|
141 | struct external_nlist **,
|
---|
142 | bfd_size_type *, char **));
|
---|
143 |
|
---|
144 | /* Callback from the add symbols phase of the linker code to handle
|
---|
145 | adding a single symbol to the global linker hash table. */
|
---|
146 | boolean (*add_one_symbol) PARAMS ((struct bfd_link_info *, bfd *,
|
---|
147 | const char *, flagword, asection *,
|
---|
148 | bfd_vma, const char *, boolean,
|
---|
149 | boolean,
|
---|
150 | struct bfd_link_hash_entry **));
|
---|
151 |
|
---|
152 | /* Called to handle linking a dynamic object. */
|
---|
153 | boolean (*link_dynamic_object) PARAMS ((struct bfd_link_info *, bfd *));
|
---|
154 |
|
---|
155 | /* Called for each global symbol being written out by the linker.
|
---|
156 | This should write out the dynamic symbol information. */
|
---|
157 | boolean (*write_dynamic_symbol) PARAMS ((bfd *, struct bfd_link_info *,
|
---|
158 | struct aout_link_hash_entry *));
|
---|
159 |
|
---|
160 | /* If this callback is not NULL, the linker calls it for each reloc.
|
---|
161 | RELOC is a pointer to the unswapped reloc. If *SKIP is set to
|
---|
162 | true, the reloc will be skipped. *RELOCATION may be changed to
|
---|
163 | change the effects of the relocation. */
|
---|
164 | boolean (*check_dynamic_reloc) PARAMS ((struct bfd_link_info *info,
|
---|
165 | bfd *input_bfd,
|
---|
166 | asection *input_section,
|
---|
167 | struct aout_link_hash_entry *h,
|
---|
168 | PTR reloc, bfd_byte *contents,
|
---|
169 | boolean *skip,
|
---|
170 | bfd_vma *relocation));
|
---|
171 |
|
---|
172 | /* Called at the end of a link to finish up any dynamic linking
|
---|
173 | information. */
|
---|
174 | boolean (*finish_dynamic_link) PARAMS ((bfd *, struct bfd_link_info *));
|
---|
175 | };
|
---|
176 | #define aout_backend_info(abfd) \
|
---|
177 | ((CONST struct aout_backend_data *)((abfd)->xvec->backend_data))
|
---|
178 |
|
---|
179 | /* This is the layout in memory of a "struct exec" while we process it.
|
---|
180 | All 'lengths' are given as a number of bytes.
|
---|
181 | All 'alignments' are for relinkable files only; an alignment of
|
---|
182 | 'n' indicates the corresponding segment must begin at an
|
---|
183 | address that is a multiple of (2**n). */
|
---|
184 |
|
---|
185 | struct internal_exec
|
---|
186 | {
|
---|
187 | long a_info; /* Magic number and flags, packed */
|
---|
188 | #if defined (__EMX__)
|
---|
189 | long emx_add;
|
---|
190 | #endif
|
---|
191 | bfd_vma a_text; /* length of text, in bytes */
|
---|
192 | bfd_vma a_data; /* length of data, in bytes */
|
---|
193 | bfd_vma a_bss; /* length of uninitialized data area in mem */
|
---|
194 | bfd_vma a_syms; /* length of symbol table data in file */
|
---|
195 | bfd_vma a_entry; /* start address */
|
---|
196 | bfd_vma a_trsize; /* length of text's relocation info, in bytes */
|
---|
197 | bfd_vma a_drsize; /* length of data's relocation info, in bytes */
|
---|
198 | /* Added for i960 */
|
---|
199 | bfd_vma a_tload; /* Text runtime load address */
|
---|
200 | bfd_vma a_dload; /* Data runtime load address */
|
---|
201 | unsigned char a_talign; /* Alignment of text segment */
|
---|
202 | unsigned char a_dalign; /* Alignment of data segment */
|
---|
203 | unsigned char a_balign; /* Alignment of bss segment */
|
---|
204 | char a_relaxable; /* Enough info for linker relax */
|
---|
205 | };
|
---|
206 |
|
---|
207 | /* Magic number is written
|
---|
208 | < MSB >
|
---|
209 | 3130292827262524232221201918171615141312111009080706050403020100
|
---|
210 | < FLAGS >< MACHINE TYPE >< MAGIC NUMBER >
|
---|
211 | */
|
---|
212 | /* Magic number for NetBSD is
|
---|
213 | <MSB >
|
---|
214 | 3130292827262524232221201918171615141312111009080706050403020100
|
---|
215 | < FLAGS >< MACHINE TYPE >< MAGIC NUMBER >
|
---|
216 | */
|
---|
217 |
|
---|
218 | enum machine_type {
|
---|
219 | M_UNKNOWN = 0,
|
---|
220 | M_68010 = 1,
|
---|
221 | M_68020 = 2,
|
---|
222 | M_SPARC = 3,
|
---|
223 | /* skip a bunch so we don't run into any of suns numbers */
|
---|
224 | /* make these up for the ns32k*/
|
---|
225 | M_NS32032 = (64), /* ns32032 running ? */
|
---|
226 | M_NS32532 = (64 + 5), /* ns32532 running mach */
|
---|
227 |
|
---|
228 | M_386 = 100,
|
---|
229 | M_29K = 101, /* AMD 29000 */
|
---|
230 | M_386_DYNIX = 102, /* Sequent running dynix */
|
---|
231 | M_ARM = 103, /* Advanced Risc Machines ARM */
|
---|
232 | M_SPARCLET = 131, /* SPARClet = M_SPARC + 128 */
|
---|
233 | M_386_NETBSD = 134, /* NetBSD/i386 binary */
|
---|
234 | M_68K_NETBSD = 135, /* NetBSD/m68k binary */
|
---|
235 | M_68K4K_NETBSD = 136, /* NetBSD/m68k4k binary */
|
---|
236 | M_532_NETBSD = 137, /* NetBSD/ns32k binary */
|
---|
237 | M_SPARC_NETBSD = 138, /* NetBSD/sparc binary */
|
---|
238 | M_PMAX_NETBSD = 139, /* NetBSD/pmax (MIPS little-endian) binary */
|
---|
239 | M_VAX_NETBSD = 140, /* NetBSD/vax binary */
|
---|
240 | M_ALPHA_NETBSD = 141, /* NetBSD/alpha binary */
|
---|
241 | M_ARM6_NETBSD = 143, /* NetBSD/arm32 binary */
|
---|
242 | M_SPARCLET_1 = 147, /* 0x93, reserved */
|
---|
243 | M_MIPS1 = 151, /* MIPS R2000/R3000 binary */
|
---|
244 | M_MIPS2 = 152, /* MIPS R4000/R6000 binary */
|
---|
245 | M_SPARCLET_2 = 163, /* 0xa3, reserved */
|
---|
246 | M_SPARCLET_3 = 179, /* 0xb3, reserved */
|
---|
247 | M_SPARCLET_4 = 195, /* 0xc3, reserved */
|
---|
248 | M_HP200 = 200, /* HP 200 (68010) BSD binary */
|
---|
249 | M_HP300 = (300 % 256), /* HP 300 (68020+68881) BSD binary */
|
---|
250 | M_HPUX = (0x20c % 256), /* HP 200/300 HPUX binary */
|
---|
251 | M_SPARCLET_5 = 211, /* 0xd3, reserved */
|
---|
252 | M_SPARCLET_6 = 227, /* 0xe3, reserved */
|
---|
253 | /* M_SPARCLET_7 = 243 / * 0xf3, reserved */
|
---|
254 | M_SPARCLITE_LE = 243,
|
---|
255 | M_CRIS = 255 /* Axis CRIS binary. */
|
---|
256 | };
|
---|
257 |
|
---|
258 | #define N_DYNAMIC(exec) ((exec).a_info & 0x80000000)
|
---|
259 |
|
---|
260 | #ifndef N_MAGIC
|
---|
261 | # define N_MAGIC(exec) ((exec).a_info & 0xffff)
|
---|
262 | #endif
|
---|
263 |
|
---|
264 | #ifndef N_MACHTYPE
|
---|
265 | # define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
|
---|
266 | #endif
|
---|
267 |
|
---|
268 | #ifndef N_FLAGS
|
---|
269 | # define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
|
---|
270 | #endif
|
---|
271 |
|
---|
272 | #ifndef N_SET_INFO
|
---|
273 | # define N_SET_INFO(exec, magic, type, flags) \
|
---|
274 | ((exec).a_info = ((magic) & 0xffff) \
|
---|
275 | | (((int)(type) & 0xff) << 16) \
|
---|
276 | | (((flags) & 0xff) << 24))
|
---|
277 | #endif
|
---|
278 |
|
---|
279 | #ifndef N_SET_DYNAMIC
|
---|
280 | # define N_SET_DYNAMIC(exec, dynamic) \
|
---|
281 | ((exec).a_info = (dynamic) ? ((exec).a_info | 0x80000000) : \
|
---|
282 | ((exec).a_info & 0x7fffffff))
|
---|
283 | #endif
|
---|
284 |
|
---|
285 | #ifndef N_SET_MAGIC
|
---|
286 | # define N_SET_MAGIC(exec, magic) \
|
---|
287 | ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
|
---|
288 | #endif
|
---|
289 |
|
---|
290 | #ifndef N_SET_MACHTYPE
|
---|
291 | # define N_SET_MACHTYPE(exec, machtype) \
|
---|
292 | ((exec).a_info = \
|
---|
293 | ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
|
---|
294 | #endif
|
---|
295 |
|
---|
296 | #ifndef N_SET_FLAGS
|
---|
297 | # define N_SET_FLAGS(exec, flags) \
|
---|
298 | ((exec).a_info = \
|
---|
299 | ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
|
---|
300 | #endif
|
---|
301 |
|
---|
302 | typedef struct aout_symbol {
|
---|
303 | asymbol symbol;
|
---|
304 | short desc;
|
---|
305 | char other;
|
---|
306 | unsigned char type;
|
---|
307 | } aout_symbol_type;
|
---|
308 |
|
---|
309 | /* The `tdata' struct for all a.out-like object file formats.
|
---|
310 | Various things depend on this struct being around any time an a.out
|
---|
311 | file is being handled. An example is dbxread.c in GDB. */
|
---|
312 |
|
---|
313 | struct aoutdata {
|
---|
314 | struct internal_exec *hdr; /* exec file header */
|
---|
315 | aout_symbol_type *symbols; /* symtab for input bfd */
|
---|
316 |
|
---|
317 | /* For ease, we do this */
|
---|
318 | asection *textsec;
|
---|
319 | asection *datasec;
|
---|
320 | asection *bsssec;
|
---|
321 |
|
---|
322 | /* We remember these offsets so that after check_file_format, we have
|
---|
323 | no dependencies on the particular format of the exec_hdr. */
|
---|
324 | file_ptr sym_filepos;
|
---|
325 | file_ptr str_filepos;
|
---|
326 |
|
---|
327 | /* Size of a relocation entry in external form */
|
---|
328 | unsigned reloc_entry_size;
|
---|
329 |
|
---|
330 | /* Size of a symbol table entry in external form */
|
---|
331 | unsigned symbol_entry_size;
|
---|
332 |
|
---|
333 | /* Page size - needed for alignment of demand paged files. */
|
---|
334 | unsigned long page_size;
|
---|
335 |
|
---|
336 | /* Segment size - needed for alignment of demand paged files. */
|
---|
337 | unsigned long segment_size;
|
---|
338 |
|
---|
339 | /* Zmagic disk block size - need to align the start of the text
|
---|
340 | section in ZMAGIC binaries. Normally the same as page_size. */
|
---|
341 | unsigned long zmagic_disk_block_size;
|
---|
342 |
|
---|
343 | unsigned exec_bytes_size;
|
---|
344 | unsigned vma_adjusted : 1;
|
---|
345 |
|
---|
346 | /* used when a bfd supports several highly similar formats */
|
---|
347 | enum
|
---|
348 | {
|
---|
349 | default_format = 0,
|
---|
350 | /* Used on HP 9000/300 running HP/UX. See hp300hpux.c. */
|
---|
351 | gnu_encap_format,
|
---|
352 | /* Used on Linux, 386BSD, etc. See include/aout/aout64.h. */
|
---|
353 | q_magic_format
|
---|
354 | } subformat;
|
---|
355 |
|
---|
356 | enum
|
---|
357 | {
|
---|
358 | undecided_magic = 0,
|
---|
359 | z_magic,
|
---|
360 | o_magic,
|
---|
361 | n_magic
|
---|
362 | } magic;
|
---|
363 |
|
---|
364 | /* A buffer for find_nearest_line. */
|
---|
365 | char *line_buf;
|
---|
366 |
|
---|
367 | /* The external symbol information. */
|
---|
368 | struct external_nlist *external_syms;
|
---|
369 | bfd_size_type external_sym_count;
|
---|
370 | bfd_window sym_window;
|
---|
371 | char *external_strings;
|
---|
372 | bfd_size_type external_string_size;
|
---|
373 | bfd_window string_window;
|
---|
374 | struct aout_link_hash_entry **sym_hashes;
|
---|
375 |
|
---|
376 | /* A pointer for shared library information. */
|
---|
377 | PTR dynamic_info;
|
---|
378 |
|
---|
379 | /* A mapping from local symbols to offsets into the global offset
|
---|
380 | table, used when linking on SunOS. This is indexed by the symbol
|
---|
381 | index. */
|
---|
382 | bfd_vma *local_got_offsets;
|
---|
383 | };
|
---|
384 |
|
---|
385 | struct aout_data_struct {
|
---|
386 | struct aoutdata a;
|
---|
387 | struct internal_exec e;
|
---|
388 | };
|
---|
389 |
|
---|
390 | #define adata(bfd) ((bfd)->tdata.aout_data->a)
|
---|
391 | #define exec_hdr(bfd) (adata(bfd).hdr)
|
---|
392 | #define obj_aout_symbols(bfd) (adata(bfd).symbols)
|
---|
393 | #define obj_textsec(bfd) (adata(bfd).textsec)
|
---|
394 | #define obj_datasec(bfd) (adata(bfd).datasec)
|
---|
395 | #define obj_bsssec(bfd) (adata(bfd).bsssec)
|
---|
396 | #define obj_sym_filepos(bfd) (adata(bfd).sym_filepos)
|
---|
397 | #define obj_str_filepos(bfd) (adata(bfd).str_filepos)
|
---|
398 | #define obj_reloc_entry_size(bfd) (adata(bfd).reloc_entry_size)
|
---|
399 | #define obj_symbol_entry_size(bfd) (adata(bfd).symbol_entry_size)
|
---|
400 | #define obj_aout_subformat(bfd) (adata(bfd).subformat)
|
---|
401 | #define obj_aout_external_syms(bfd) (adata(bfd).external_syms)
|
---|
402 | #define obj_aout_external_sym_count(bfd) (adata(bfd).external_sym_count)
|
---|
403 | #define obj_aout_sym_window(bfd) (adata(bfd).sym_window)
|
---|
404 | #define obj_aout_external_strings(bfd) (adata(bfd).external_strings)
|
---|
405 | #define obj_aout_external_string_size(bfd) (adata(bfd).external_string_size)
|
---|
406 | #define obj_aout_string_window(bfd) (adata(bfd).string_window)
|
---|
407 | #define obj_aout_sym_hashes(bfd) (adata(bfd).sym_hashes)
|
---|
408 | #define obj_aout_dynamic_info(bfd) (adata(bfd).dynamic_info)
|
---|
409 |
|
---|
410 | /* We take the address of the first element of an asymbol to ensure that the
|
---|
411 | macro is only ever applied to an asymbol */
|
---|
412 | #define aout_symbol(asymbol) ((aout_symbol_type *)(&(asymbol)->the_bfd))
|
---|
413 |
|
---|
414 | /* Information we keep for each a.out section. This is currently only
|
---|
415 | used by the a.out backend linker. */
|
---|
416 |
|
---|
417 | struct aout_section_data_struct
|
---|
418 | {
|
---|
419 | /* The unswapped relocation entries for this section. */
|
---|
420 | PTR relocs;
|
---|
421 | };
|
---|
422 |
|
---|
423 | #define aout_section_data(s) \
|
---|
424 | ((struct aout_section_data_struct *) (s)->used_by_bfd)
|
---|
425 |
|
---|
426 | #define set_aout_section_data(s,v) \
|
---|
427 | ((s)->used_by_bfd = (PTR)&(v)->relocs)
|
---|
428 |
|
---|
429 | /* Prototype declarations for functions defined in aoutx.h */
|
---|
430 |
|
---|
431 | boolean
|
---|
432 | NAME(aout,squirt_out_relocs) PARAMS ((bfd *abfd, asection *section));
|
---|
433 |
|
---|
434 | boolean
|
---|
435 | NAME(aout,make_sections) PARAMS ((bfd *));
|
---|
436 |
|
---|
437 | const bfd_target *
|
---|
438 | NAME(aout,some_aout_object_p) PARAMS ((bfd *abfd,
|
---|
439 | struct internal_exec *execp,
|
---|
440 | const bfd_target *(*callback)(bfd *)));
|
---|
441 |
|
---|
442 | boolean
|
---|
443 | NAME(aout,mkobject) PARAMS ((bfd *abfd));
|
---|
444 |
|
---|
445 | enum machine_type
|
---|
446 | NAME(aout,machine_type) PARAMS ((enum bfd_architecture arch,
|
---|
447 | unsigned long machine,
|
---|
448 | boolean *unknown));
|
---|
449 |
|
---|
450 | boolean
|
---|
451 | NAME(aout,set_arch_mach) PARAMS ((bfd *abfd, enum bfd_architecture arch,
|
---|
452 | unsigned long machine));
|
---|
453 |
|
---|
454 | boolean
|
---|
455 | NAME(aout,new_section_hook) PARAMS ((bfd *abfd, asection *newsect));
|
---|
456 |
|
---|
457 | boolean
|
---|
458 | NAME(aout,set_section_contents) PARAMS ((bfd *abfd, sec_ptr section,
|
---|
459 | PTR location, file_ptr offset, bfd_size_type count));
|
---|
460 |
|
---|
461 | asymbol *
|
---|
462 | NAME(aout,make_empty_symbol) PARAMS ((bfd *abfd));
|
---|
463 |
|
---|
464 | boolean
|
---|
465 | NAME(aout,translate_symbol_table) PARAMS ((bfd *, aout_symbol_type *,
|
---|
466 | struct external_nlist *,
|
---|
467 | bfd_size_type, char *,
|
---|
468 | bfd_size_type,
|
---|
469 | boolean dynamic));
|
---|
470 |
|
---|
471 | boolean
|
---|
472 | NAME(aout,slurp_symbol_table) PARAMS ((bfd *abfd));
|
---|
473 |
|
---|
474 | boolean
|
---|
475 | NAME(aout,write_syms) PARAMS ((bfd *abfd));
|
---|
476 |
|
---|
477 | void
|
---|
478 | NAME(aout,reclaim_symbol_table) PARAMS ((bfd *abfd));
|
---|
479 |
|
---|
480 | long
|
---|
481 | NAME(aout,get_symtab_upper_bound) PARAMS ((bfd *abfd));
|
---|
482 |
|
---|
483 | long
|
---|
484 | NAME(aout,get_symtab) PARAMS ((bfd *abfd, asymbol **location));
|
---|
485 |
|
---|
486 | void
|
---|
487 | NAME(aout,swap_ext_reloc_in) PARAMS ((bfd *, struct reloc_ext_external *,
|
---|
488 | arelent *, asymbol **, bfd_size_type));
|
---|
489 | void
|
---|
490 | NAME(aout,swap_std_reloc_in) PARAMS ((bfd *, struct reloc_std_external *,
|
---|
491 | arelent *, asymbol **, bfd_size_type));
|
---|
492 |
|
---|
493 | reloc_howto_type *
|
---|
494 | NAME(aout,reloc_type_lookup) PARAMS ((bfd *abfd,
|
---|
495 | bfd_reloc_code_real_type code));
|
---|
496 |
|
---|
497 | boolean
|
---|
498 | NAME(aout,slurp_reloc_table) PARAMS ((bfd *abfd, sec_ptr asect,
|
---|
499 | asymbol **symbols));
|
---|
500 |
|
---|
501 | long
|
---|
502 | NAME(aout,canonicalize_reloc) PARAMS ((bfd *abfd, sec_ptr section,
|
---|
503 | arelent **relptr, asymbol **symbols));
|
---|
504 |
|
---|
505 | long
|
---|
506 | NAME(aout,get_reloc_upper_bound) PARAMS ((bfd *abfd, sec_ptr asect));
|
---|
507 |
|
---|
508 | void
|
---|
509 | NAME(aout,reclaim_reloc) PARAMS ((bfd *ignore_abfd, sec_ptr ignore));
|
---|
510 |
|
---|
511 | alent *
|
---|
512 | NAME(aout,get_lineno) PARAMS ((bfd *ignore_abfd, asymbol *ignore_symbol));
|
---|
513 |
|
---|
514 | void
|
---|
515 | NAME(aout,print_symbol) PARAMS ((bfd *ignore_abfd, PTR file,
|
---|
516 | asymbol *symbol, bfd_print_symbol_type how));
|
---|
517 |
|
---|
518 | void
|
---|
519 | NAME(aout,get_symbol_info) PARAMS ((bfd *ignore_abfd,
|
---|
520 | asymbol *symbol, symbol_info *ret));
|
---|
521 |
|
---|
522 | boolean
|
---|
523 | NAME(aout,find_nearest_line) PARAMS ((bfd *abfd, asection *section,
|
---|
524 | asymbol **symbols, bfd_vma offset, CONST char **filename_ptr,
|
---|
525 | CONST char **functionname_ptr, unsigned int *line_ptr));
|
---|
526 |
|
---|
527 | long
|
---|
528 | NAME(aout,read_minisymbols) PARAMS ((bfd *, boolean, PTR *, unsigned int *));
|
---|
529 |
|
---|
530 | asymbol *
|
---|
531 | NAME(aout,minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
|
---|
532 | asymbol *));
|
---|
533 |
|
---|
534 | int
|
---|
535 | NAME(aout,sizeof_headers) PARAMS ((bfd *abfd, boolean exec));
|
---|
536 |
|
---|
537 | boolean
|
---|
538 | NAME(aout,adjust_sizes_and_vmas) PARAMS ((bfd *abfd,
|
---|
539 | bfd_size_type *text_size, file_ptr *text_end));
|
---|
540 |
|
---|
541 | void
|
---|
542 | NAME(aout,swap_exec_header_in) PARAMS ((bfd *abfd,
|
---|
543 | struct external_exec *raw_bytes, struct internal_exec *execp));
|
---|
544 |
|
---|
545 | void
|
---|
546 | NAME(aout,swap_exec_header_out) PARAMS ((bfd *abfd,
|
---|
547 | struct internal_exec *execp, struct external_exec *raw_bytes));
|
---|
548 |
|
---|
549 | struct bfd_hash_entry *
|
---|
550 | NAME(aout,link_hash_newfunc)
|
---|
551 | PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
|
---|
552 |
|
---|
553 | boolean
|
---|
554 | NAME(aout,link_hash_table_init)
|
---|
555 | PARAMS ((struct aout_link_hash_table *, bfd *,
|
---|
556 | struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
|
---|
557 | struct bfd_hash_table *,
|
---|
558 | const char *)));
|
---|
559 |
|
---|
560 | struct bfd_link_hash_table *
|
---|
561 | NAME(aout,link_hash_table_create) PARAMS ((bfd *));
|
---|
562 |
|
---|
563 | boolean
|
---|
564 | NAME(aout,link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
|
---|
565 |
|
---|
566 | boolean
|
---|
567 | NAME(aout,final_link) PARAMS ((bfd *, struct bfd_link_info *,
|
---|
568 | void (*) (bfd *, file_ptr *, file_ptr *,
|
---|
569 | file_ptr *)));
|
---|
570 |
|
---|
571 | boolean
|
---|
572 | NAME(aout,bfd_free_cached_info) PARAMS ((bfd *));
|
---|
573 |
|
---|
574 | /* A.out uses the generic versions of these routines... */
|
---|
575 |
|
---|
576 | #define aout_32_get_section_contents _bfd_generic_get_section_contents
|
---|
577 |
|
---|
578 | #define aout_64_get_section_contents _bfd_generic_get_section_contents
|
---|
579 | #ifndef NO_WRITE_HEADER_KLUDGE
|
---|
580 | #define NO_WRITE_HEADER_KLUDGE 0
|
---|
581 | #endif
|
---|
582 |
|
---|
583 | #ifndef aout_32_bfd_is_local_label_name
|
---|
584 | #define aout_32_bfd_is_local_label_name bfd_generic_is_local_label_name
|
---|
585 | #endif
|
---|
586 |
|
---|
587 | #ifndef WRITE_HEADERS
|
---|
588 | #define WRITE_HEADERS(abfd, execp) \
|
---|
589 | { \
|
---|
590 | bfd_size_type text_size; /* dummy vars */ \
|
---|
591 | file_ptr text_end; \
|
---|
592 | if (adata(abfd).magic == undecided_magic) \
|
---|
593 | NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end); \
|
---|
594 | \
|
---|
595 | execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \
|
---|
596 | execp->a_entry = bfd_get_start_address (abfd); \
|
---|
597 | \
|
---|
598 | execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * \
|
---|
599 | obj_reloc_entry_size (abfd)); \
|
---|
600 | execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \
|
---|
601 | obj_reloc_entry_size (abfd)); \
|
---|
602 | NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \
|
---|
603 | \
|
---|
604 | if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return false; \
|
---|
605 | if (bfd_write ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd) \
|
---|
606 | != EXEC_BYTES_SIZE) \
|
---|
607 | return false; \
|
---|
608 | /* Now write out reloc info, followed by syms and strings */ \
|
---|
609 | \
|
---|
610 | if (bfd_get_outsymbols (abfd) != (asymbol **) NULL \
|
---|
611 | && bfd_get_symcount (abfd) != 0) \
|
---|
612 | { \
|
---|
613 | if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*execp)), SEEK_SET) != 0) \
|
---|
614 | return false; \
|
---|
615 | \
|
---|
616 | if (! NAME(aout,write_syms)(abfd)) return false; \
|
---|
617 | } \
|
---|
618 | \
|
---|
619 | if (bfd_seek (abfd, (file_ptr)(N_TRELOFF(*execp)), SEEK_SET) != 0) \
|
---|
620 | return false; \
|
---|
621 | if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) \
|
---|
622 | return false; \
|
---|
623 | \
|
---|
624 | if (bfd_seek (abfd, (file_ptr)(N_DRELOFF(*execp)), SEEK_SET) != 0) \
|
---|
625 | return false; \
|
---|
626 | if (!NAME(aout,squirt_out_relocs)(abfd, obj_datasec (abfd))) \
|
---|
627 | return false; \
|
---|
628 | }
|
---|
629 | #endif
|
---|
630 |
|
---|
631 | #endif /* ! defined (LIBAOUT_H) */
|
---|