1 /* BFD back-end data structures for a.out (and similar) files.
2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4 Free Software Foundation, Inc.
5 Written by Cygnus Support.
7 This file is part of BFD, the Binary File Descriptor library.
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.
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.
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. */
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. */
32 /* Macros for accessing components in an aout header. Saves cluttering
33 the source with (bfd_vma) and (bfd_byte *) casts. */
35 #define H_PUT_64(abfd, val, where) \
36 bfd_h_put_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
38 #define H_PUT_32(abfd, val, where) \
39 bfd_h_put_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
41 #define H_PUT_16(abfd, val, where) \
42 bfd_h_put_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
44 #define H_PUT_8 bfd_h_put_8
46 #define H_PUT_S64(abfd, val, where) \
47 bfd_h_put_signed_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
49 #define H_PUT_S32(abfd, val, where) \
50 bfd_h_put_signed_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
52 #define H_PUT_S16(abfd, val, where) \
53 bfd_h_put_signed_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
55 #define H_PUT_S8 bfd_h_put_signed_8
57 #define H_GET_64(abfd, where) \
58 bfd_h_get_64 ((abfd), (bfd_byte *) (where))
60 #define H_GET_32(abfd, where) \
61 bfd_h_get_32 ((abfd), (bfd_byte *) (where))
63 #define H_GET_16(abfd, where) \
64 bfd_h_get_16 ((abfd), (bfd_byte *) (where))
66 #define H_GET_8 bfd_h_get_8
68 #define H_GET_S64(abfd, where) \
69 bfd_h_get_signed_64 ((abfd), (bfd_byte *) (where))
71 #define H_GET_S32(abfd, where) \
72 bfd_h_get_signed_32 ((abfd), (bfd_byte *) (where))
74 #define H_GET_S16(abfd, where) \
75 bfd_h_get_signed_16 ((abfd), (bfd_byte *) (where))
77 #define H_GET_S8 bfd_h_get_signed_8
79 /* Parameterize the a.out code based on whether it is being built
80 for a 32-bit architecture or a 64-bit architecture. */
81 /* Do not "beautify" the CONCAT* macro args. Traditional C will not
82 remove whitespace added here, and thus will fail to concatenate
85 #define GET_WORD H_GET_64
86 #define GET_SWORD H_GET_S64
87 #define GET_MAGIC H_GET_32
88 #define PUT_WORD H_PUT_64
89 #define PUT_MAGIC H_PUT_32
91 #define NAME(x,y) CONCAT3 (x,_64_,y)
93 #define JNAME(x) CONCAT2 (x,_64)
94 #define BYTES_IN_WORD 8
97 #define GET_WORD H_GET_16
98 #define GET_SWORD H_GET_S16
99 #define GET_MAGIC H_GET_16
100 #define PUT_WORD H_PUT_16
101 #define PUT_MAGIC H_PUT_16
103 #define NAME(x,y) CONCAT3 (x,_16_,y)
105 #define JNAME(x) CONCAT2 (x,_16)
106 #define BYTES_IN_WORD 2
107 #else /* ARCH_SIZE == 32 */
108 #define GET_WORD H_GET_32
109 #define GET_SWORD H_GET_S32
110 #define GET_MAGIC H_GET_32
111 #define PUT_WORD H_PUT_32
112 #define PUT_MAGIC H_PUT_32
114 #define NAME(x,y) CONCAT3 (x,_32_,y)
116 #define JNAME(x) CONCAT2 (x,_32)
117 #define BYTES_IN_WORD 4
118 #endif /* ARCH_SIZE==32 */
119 #endif /* ARCH_SIZE==64 */
121 /* Declare at file level, since used in parameter lists, which have
123 struct external_exec
;
124 struct external_nlist
;
125 struct reloc_ext_external
;
126 struct reloc_std_external
;
128 /* a.out backend linker hash table entries. */
130 struct aout_link_hash_entry
132 struct bfd_link_hash_entry root
;
133 /* Whether this symbol has been written out. */
135 /* Symbol index in output file. */
139 /* a.out backend linker hash table. */
141 struct aout_link_hash_table
143 struct bfd_link_hash_table root
;
146 /* Look up an entry in an a.out link hash table. */
148 #define aout_link_hash_lookup(table, string, create, copy, follow) \
149 ((struct aout_link_hash_entry *) \
150 bfd_link_hash_lookup (&(table)->root, (string), (create), (copy), (follow)))
152 /* Traverse an a.out link hash table. */
154 #define aout_link_hash_traverse(table, func, info) \
155 (bfd_link_hash_traverse \
157 (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
160 /* Get the a.out link hash table from the info structure. This is
163 #define aout_hash_table(p) ((struct aout_link_hash_table *) ((p)->hash))
165 /* Back-end information for various a.out targets. */
166 struct aout_backend_data
168 /* Are ZMAGIC files mapped contiguously? If so, the text section may
169 need more padding, if the segment size (granularity for memory access
170 control) is larger than the page size. */
171 unsigned char zmagic_mapped_contiguous
;
172 /* If this flag is set, ZMAGIC/NMAGIC file headers get mapped in with the
173 text section, which starts immediately after the file header.
174 If not, the text section starts on the next page. */
175 unsigned char text_includes_header
;
177 /* If this flag is set, then if the entry address is not in the
178 first SEGMENT_SIZE bytes of the text section, it is taken to be
179 the address of the start of the text section. This can be useful
181 unsigned char entry_is_text_address
;
183 /* The value to pass to N_SET_FLAGS. */
184 unsigned char exec_hdr_flags
;
186 /* If the text section VMA isn't specified, and we need an absolute
187 address, use this as the default. If we're producing a relocatable
188 file, zero is always used. */
189 /* ?? Perhaps a callback would be a better choice? Will this do anything
190 reasonable for a format that handles multiple CPUs with different
191 load addresses for each? */
192 bfd_vma default_text_vma
;
194 /* Callback for setting the page and segment sizes, if they can't be
195 trivially determined from the architecture. */
199 /* zmagic files only. For go32, the length of the exec header contributes
200 to the size of the text section in the file for alignment purposes but
201 does *not* get counted in the length of the text section. */
202 unsigned char exec_header_not_counted
;
204 /* Callback from the add symbols phase of the linker code to handle
206 boolean (*add_dynamic_symbols
)
207 PARAMS ((bfd
*, struct bfd_link_info
*, struct external_nlist
**,
208 bfd_size_type
*, char **));
210 /* Callback from the add symbols phase of the linker code to handle
211 adding a single symbol to the global linker hash table. */
212 boolean (*add_one_symbol
)
213 PARAMS ((struct bfd_link_info
*, bfd
*, const char *, flagword
,
214 asection
*, bfd_vma
, const char *, boolean
, boolean
,
215 struct bfd_link_hash_entry
**));
217 /* Called to handle linking a dynamic object. */
218 boolean (*link_dynamic_object
)
219 PARAMS ((struct bfd_link_info
*, bfd
*));
221 /* Called for each global symbol being written out by the linker.
222 This should write out the dynamic symbol information. */
223 boolean (*write_dynamic_symbol
)
224 PARAMS ((bfd
*, struct bfd_link_info
*, struct aout_link_hash_entry
*));
226 /* If this callback is not NULL, the linker calls it for each reloc.
227 RELOC is a pointer to the unswapped reloc. If *SKIP is set to
228 true, the reloc will be skipped. *RELOCATION may be changed to
229 change the effects of the relocation. */
230 boolean (*check_dynamic_reloc
)
231 PARAMS ((struct bfd_link_info
*info
, bfd
*input_bfd
,
232 asection
*input_section
, struct aout_link_hash_entry
*h
,
233 PTR reloc
, bfd_byte
*contents
, boolean
*skip
,
234 bfd_vma
*relocation
));
236 /* Called at the end of a link to finish up any dynamic linking
238 boolean (*finish_dynamic_link
)
239 PARAMS ((bfd
*, struct bfd_link_info
*));
241 #define aout_backend_info(abfd) \
242 ((const struct aout_backend_data *)((abfd)->xvec->backend_data))
244 /* This is the layout in memory of a "struct exec" while we process it.
245 All 'lengths' are given as a number of bytes.
246 All 'alignments' are for relinkable files only; an alignment of
247 'n' indicates the corresponding segment must begin at an
248 address that is a multiple of (2**n). */
252 long a_info
; /* Magic number and flags, packed */
253 bfd_vma a_text
; /* length of text, in bytes */
254 bfd_vma a_data
; /* length of data, in bytes */
255 bfd_vma a_bss
; /* length of uninitialized data area in mem */
256 bfd_vma a_syms
; /* length of symbol table data in file */
257 bfd_vma a_entry
; /* start address */
258 bfd_vma a_trsize
; /* length of text's relocation info, in bytes */
259 bfd_vma a_drsize
; /* length of data's relocation info, in bytes */
261 bfd_vma a_tload
; /* Text runtime load address */
262 bfd_vma a_dload
; /* Data runtime load address */
263 unsigned char a_talign
; /* Alignment of text segment */
264 unsigned char a_dalign
; /* Alignment of data segment */
265 unsigned char a_balign
; /* Alignment of bss segment */
266 char a_relaxable
; /* Enough info for linker relax */
269 /* Magic number is written
271 3130292827262524232221201918171615141312111009080706050403020100
272 < FLAGS >< MACHINE TYPE >< MAGIC NUMBER >
274 /* Magic number for NetBSD is
276 3130292827262524232221201918171615141312111009080706050403020100
277 < FLAGS >< MACHINE TYPE >< MAGIC NUMBER >
285 /* skip a bunch so we don't run into any of suns numbers */
286 /* make these up for the ns32k*/
287 M_NS32032
= (64), /* ns32032 running ? */
288 M_NS32532
= (64 + 5), /* ns32532 running mach */
291 M_29K
= 101, /* AMD 29000 */
292 M_386_DYNIX
= 102, /* Sequent running dynix */
293 M_ARM
= 103, /* Advanced Risc Machines ARM */
294 M_SPARCLET
= 131, /* SPARClet = M_SPARC + 128 */
295 M_386_NETBSD
= 134, /* NetBSD/i386 binary */
296 M_68K_NETBSD
= 135, /* NetBSD/m68k binary */
297 M_68K4K_NETBSD
= 136, /* NetBSD/m68k4k binary */
298 M_532_NETBSD
= 137, /* NetBSD/ns32k binary */
299 M_SPARC_NETBSD
= 138, /* NetBSD/sparc binary */
300 M_PMAX_NETBSD
= 139, /* NetBSD/pmax (MIPS little-endian) binary */
301 M_VAX_NETBSD
= 140, /* NetBSD/vax binary */
302 M_ALPHA_NETBSD
= 141, /* NetBSD/alpha binary */
303 M_ARM6_NETBSD
= 143, /* NetBSD/arm32 binary */
304 M_SPARCLET_1
= 147, /* 0x93, reserved */
305 M_MIPS1
= 151, /* MIPS R2000/R3000 binary */
306 M_MIPS2
= 152, /* MIPS R4000/R6000 binary */
307 M_SPARCLET_2
= 163, /* 0xa3, reserved */
308 M_SPARCLET_3
= 179, /* 0xb3, reserved */
309 M_SPARCLET_4
= 195, /* 0xc3, reserved */
310 M_HP200
= 200, /* HP 200 (68010) BSD binary */
311 M_HP300
= (300 % 256), /* HP 300 (68020+68881) BSD binary */
312 M_HPUX
= (0x20c % 256), /* HP 200/300 HPUX binary */
313 M_SPARCLET_5
= 211, /* 0xd3, reserved */
314 M_SPARCLET_6
= 227, /* 0xe3, reserved */
315 /* M_SPARCLET_7 = 243 / * 0xf3, reserved */
316 M_SPARCLITE_LE
= 243,
317 M_CRIS
= 255 /* Axis CRIS binary. */
320 #define N_DYNAMIC(exec) ((exec).a_info & 0x80000000)
323 # define N_MAGIC(exec) ((exec).a_info & 0xffff)
327 # define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
331 # define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
335 # define N_SET_INFO(exec, magic, type, flags) \
336 ((exec).a_info = ((magic) & 0xffff) \
337 | (((int)(type) & 0xff) << 16) \
338 | (((flags) & 0xff) << 24))
341 #ifndef N_SET_DYNAMIC
342 # define N_SET_DYNAMIC(exec, dynamic) \
343 ((exec).a_info = (dynamic) ? (long) ((exec).a_info | 0x80000000) : \
344 ((exec).a_info & 0x7fffffff))
348 # define N_SET_MAGIC(exec, magic) \
349 ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
352 #ifndef N_SET_MACHTYPE
353 # define N_SET_MACHTYPE(exec, machtype) \
355 ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
359 # define N_SET_FLAGS(exec, flags) \
361 ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
364 typedef struct aout_symbol
{
371 /* The `tdata' struct for all a.out-like object file formats.
372 Various things depend on this struct being around any time an a.out
373 file is being handled. An example is dbxread.c in GDB. */
376 struct internal_exec
*hdr
; /* exec file header */
377 aout_symbol_type
*symbols
; /* symtab for input bfd */
379 /* For ease, we do this */
384 /* We remember these offsets so that after check_file_format, we have
385 no dependencies on the particular format of the exec_hdr. */
386 file_ptr sym_filepos
;
387 file_ptr str_filepos
;
389 /* Size of a relocation entry in external form */
390 unsigned reloc_entry_size
;
392 /* Size of a symbol table entry in external form */
393 unsigned symbol_entry_size
;
395 /* Page size - needed for alignment of demand paged files. */
396 unsigned long page_size
;
398 /* Segment size - needed for alignment of demand paged files. */
399 unsigned long segment_size
;
401 /* Zmagic disk block size - need to align the start of the text
402 section in ZMAGIC binaries. Normally the same as page_size. */
403 unsigned long zmagic_disk_block_size
;
405 unsigned exec_bytes_size
;
406 unsigned vma_adjusted
: 1;
408 /* used when a bfd supports several highly similar formats */
412 /* Used on HP 9000/300 running HP/UX. See hp300hpux.c. */
414 /* Used on Linux, 386BSD, etc. See include/aout/aout64.h. */
426 /* A buffer for find_nearest_line. */
429 /* The external symbol information. */
430 struct external_nlist
*external_syms
;
431 bfd_size_type external_sym_count
;
432 bfd_window sym_window
;
433 char *external_strings
;
434 bfd_size_type external_string_size
;
435 bfd_window string_window
;
436 struct aout_link_hash_entry
**sym_hashes
;
438 /* A pointer for shared library information. */
441 /* A mapping from local symbols to offsets into the global offset
442 table, used when linking on SunOS. This is indexed by the symbol
444 bfd_vma
*local_got_offsets
;
447 struct aout_data_struct
{
449 struct internal_exec e
;
452 #define adata(bfd) ((bfd)->tdata.aout_data->a)
453 #define exec_hdr(bfd) (adata(bfd).hdr)
454 #define obj_aout_symbols(bfd) (adata(bfd).symbols)
455 #define obj_textsec(bfd) (adata(bfd).textsec)
456 #define obj_datasec(bfd) (adata(bfd).datasec)
457 #define obj_bsssec(bfd) (adata(bfd).bsssec)
458 #define obj_sym_filepos(bfd) (adata(bfd).sym_filepos)
459 #define obj_str_filepos(bfd) (adata(bfd).str_filepos)
460 #define obj_reloc_entry_size(bfd) (adata(bfd).reloc_entry_size)
461 #define obj_symbol_entry_size(bfd) (adata(bfd).symbol_entry_size)
462 #define obj_aout_subformat(bfd) (adata(bfd).subformat)
463 #define obj_aout_external_syms(bfd) (adata(bfd).external_syms)
464 #define obj_aout_external_sym_count(bfd) (adata(bfd).external_sym_count)
465 #define obj_aout_sym_window(bfd) (adata(bfd).sym_window)
466 #define obj_aout_external_strings(bfd) (adata(bfd).external_strings)
467 #define obj_aout_external_string_size(bfd) (adata(bfd).external_string_size)
468 #define obj_aout_string_window(bfd) (adata(bfd).string_window)
469 #define obj_aout_sym_hashes(bfd) (adata(bfd).sym_hashes)
470 #define obj_aout_dynamic_info(bfd) (adata(bfd).dynamic_info)
472 /* We take the address of the first element of an asymbol to ensure that the
473 macro is only ever applied to an asymbol */
474 #define aout_symbol(asymbol) ((aout_symbol_type *)(&(asymbol)->the_bfd))
476 /* Information we keep for each a.out section. This is currently only
477 used by the a.out backend linker. */
479 struct aout_section_data_struct
481 /* The unswapped relocation entries for this section. */
485 #define aout_section_data(s) \
486 ((struct aout_section_data_struct *) (s)->used_by_bfd)
488 #define set_aout_section_data(s,v) \
489 ((s)->used_by_bfd = (PTR)&(v)->relocs)
491 /* Prototype declarations for functions defined in aoutx.h */
493 extern boolean
NAME(aout
,squirt_out_relocs
)
494 PARAMS ((bfd
*, asection
*));
496 extern boolean
NAME(aout
,make_sections
)
499 extern const bfd_target
* NAME(aout
,some_aout_object_p
)
500 PARAMS ((bfd
*, struct internal_exec
*, const bfd_target
*(*) (bfd
*)));
502 extern boolean
NAME(aout
,mkobject
)
505 extern enum machine_type
NAME(aout
,machine_type
)
506 PARAMS ((enum bfd_architecture
, unsigned long, boolean
*));
508 extern boolean
NAME(aout
,set_arch_mach
)
509 PARAMS ((bfd
*, enum bfd_architecture
, unsigned long));
511 extern boolean
NAME(aout
,new_section_hook
)
512 PARAMS ((bfd
*, asection
*));
514 extern boolean
NAME(aout
,set_section_contents
)
515 PARAMS ((bfd
*, sec_ptr
, PTR
, file_ptr
, bfd_size_type
));
517 extern asymbol
* NAME(aout
,make_empty_symbol
)
520 extern boolean
NAME(aout
,translate_symbol_table
)
521 PARAMS ((bfd
*, aout_symbol_type
*, struct external_nlist
*, bfd_size_type
,
522 char *, bfd_size_type
, boolean
));
524 extern boolean
NAME(aout
,slurp_symbol_table
)
527 extern boolean
NAME(aout
,write_syms
)
530 extern void NAME(aout
,reclaim_symbol_table
)
533 extern long NAME(aout
,get_symtab_upper_bound
)
536 extern long NAME(aout
,get_symtab
)
537 PARAMS ((bfd
*, asymbol
**));
539 extern void NAME(aout
,swap_ext_reloc_in
)
540 PARAMS ((bfd
*, struct reloc_ext_external
*, arelent
*, asymbol
**,
542 extern void NAME(aout
,swap_std_reloc_in
)
543 PARAMS ((bfd
*, struct reloc_std_external
*, arelent
*, asymbol
**,
546 extern reloc_howto_type
* NAME(aout
,reloc_type_lookup
)
547 PARAMS ((bfd
*, bfd_reloc_code_real_type
));
549 extern boolean
NAME(aout
,slurp_reloc_table
)
550 PARAMS ((bfd
*, sec_ptr
, asymbol
**));
552 extern long NAME(aout
,canonicalize_reloc
)
553 PARAMS ((bfd
*, sec_ptr
, arelent
**, asymbol
**));
555 extern long NAME(aout
,get_reloc_upper_bound
)
556 PARAMS ((bfd
*, sec_ptr
));
558 extern void NAME(aout
,reclaim_reloc
)
559 PARAMS ((bfd
*, sec_ptr
));
561 extern alent
* NAME(aout
,get_lineno
)
562 PARAMS ((bfd
*, asymbol
*));
564 extern void NAME(aout
,print_symbol
)
565 PARAMS ((bfd
*, PTR
, asymbol
*, bfd_print_symbol_type
));
567 extern void NAME(aout
,get_symbol_info
)
568 PARAMS ((bfd
*, asymbol
*, symbol_info
*));
570 extern boolean
NAME(aout
,find_nearest_line
)
571 PARAMS ((bfd
*, asection
*, asymbol
**, bfd_vma
, const char **,
572 const char **, unsigned int *));
574 extern long NAME(aout
,read_minisymbols
)
575 PARAMS ((bfd
*, boolean
, PTR
*, unsigned int *));
577 extern asymbol
* NAME(aout
,minisymbol_to_symbol
)
578 PARAMS ((bfd
*, boolean
, const PTR
, asymbol
*));
580 extern int NAME(aout
,sizeof_headers
)
581 PARAMS ((bfd
*, boolean
));
583 extern boolean
NAME(aout
,adjust_sizes_and_vmas
)
584 PARAMS ((bfd
*, bfd_size_type
*, file_ptr
*));
586 extern void NAME(aout
,swap_exec_header_in
)
587 PARAMS ((bfd
*, struct external_exec
*, struct internal_exec
*));
589 extern void NAME(aout
,swap_exec_header_out
)
590 PARAMS ((bfd
*, struct internal_exec
*, struct external_exec
*));
592 extern struct bfd_hash_entry
* NAME(aout
,link_hash_newfunc
)
593 PARAMS ((struct bfd_hash_entry
*, struct bfd_hash_table
*, const char *));
595 extern boolean
NAME(aout
,link_hash_table_init
)
596 PARAMS ((struct aout_link_hash_table
*, bfd
*,
597 struct bfd_hash_entry
*(*) (struct bfd_hash_entry
*,
598 struct bfd_hash_table
*,
601 extern struct bfd_link_hash_table
* NAME(aout
,link_hash_table_create
)
604 extern boolean
NAME(aout
,link_add_symbols
)
605 PARAMS ((bfd
*, struct bfd_link_info
*));
607 extern boolean
NAME(aout
,final_link
)
608 PARAMS ((bfd
*, struct bfd_link_info
*,
609 void (*) (bfd
*, file_ptr
*, file_ptr
*, file_ptr
*)));
611 extern boolean
NAME(aout
,bfd_free_cached_info
)
614 /* A.out uses the generic versions of these routines... */
616 #define aout_16_get_section_contents _bfd_generic_get_section_contents
618 #define aout_32_get_section_contents _bfd_generic_get_section_contents
620 #define aout_64_get_section_contents _bfd_generic_get_section_contents
621 #ifndef NO_WRITE_HEADER_KLUDGE
622 #define NO_WRITE_HEADER_KLUDGE 0
625 #ifndef aout_32_bfd_is_local_label_name
626 #define aout_32_bfd_is_local_label_name bfd_generic_is_local_label_name
629 #ifndef WRITE_HEADERS
630 #define WRITE_HEADERS(abfd, execp) \
632 bfd_size_type text_size; /* dummy vars */ \
634 if (adata(abfd).magic == undecided_magic) \
635 NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end); \
637 execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \
638 execp->a_entry = bfd_get_start_address (abfd); \
640 execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * \
641 obj_reloc_entry_size (abfd)); \
642 execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \
643 obj_reloc_entry_size (abfd)); \
644 NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \
646 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 \
647 || bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \
648 abfd) != EXEC_BYTES_SIZE) \
650 /* Now write out reloc info, followed by syms and strings */ \
652 if (bfd_get_outsymbols (abfd) != (asymbol **) NULL \
653 && bfd_get_symcount (abfd) != 0) \
655 if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0)\
658 if (! NAME(aout,write_syms) (abfd)) \
662 if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0) \
664 if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) \
667 if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0) \
669 if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) \
674 #endif /* ! defined (LIBAOUT_H) */