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