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