+/* Information we keep for each a.out section. This is currently only
+ used by the a.out backend linker. */
+
+struct aout_section_data_struct
+{
+ /* The unswapped relocation entries for this section. */
+ void * relocs;
+};
+
+#define aout_section_data(s) \
+ ((struct aout_section_data_struct *) (s)->used_by_bfd)
+
+#define set_aout_section_data(s,v) \
+ ((s)->used_by_bfd = (void *)&(v)->relocs)
+
+/* Prototype declarations for functions defined in aoutx.h. */
+
+extern bfd_boolean NAME (aout, squirt_out_relocs)
+ (bfd *, asection *);
+
+extern bfd_boolean NAME (aout, make_sections)
+ (bfd *);
+
+extern const bfd_target * NAME (aout, some_aout_object_p)
+ (bfd *, struct internal_exec *, const bfd_target *(*) (bfd *));
+
+extern bfd_boolean NAME (aout, mkobject)
+ (bfd *);
+
+extern enum machine_type NAME (aout, machine_type)
+ (enum bfd_architecture, unsigned long, bfd_boolean *);
+
+extern bfd_boolean NAME (aout, set_arch_mach)
+ (bfd *, enum bfd_architecture, unsigned long);
+
+extern bfd_boolean NAME (aout, new_section_hook)
+ (bfd *, asection *);
+
+extern bfd_boolean NAME (aout, set_section_contents)
+ (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type);
+
+extern asymbol * NAME (aout, make_empty_symbol)
+ (bfd *);
+
+extern bfd_boolean NAME (aout, translate_symbol_table)
+ (bfd *, aout_symbol_type *, struct external_nlist *, bfd_size_type,
+ char *, bfd_size_type, bfd_boolean);
+
+extern bfd_boolean NAME (aout, slurp_symbol_table)
+ (bfd *);
+
+extern bfd_boolean NAME (aout, write_syms)
+ (bfd *);
+
+extern void NAME (aout, reclaim_symbol_table)
+ (bfd *);
+
+extern long NAME (aout, get_symtab_upper_bound)
+ (bfd *);
+
+extern long NAME (aout, canonicalize_symtab)
+ (bfd *, asymbol **);
+
+extern void NAME (aout, swap_ext_reloc_in)
+ (bfd *, struct reloc_ext_external *, arelent *, asymbol **,
+ bfd_size_type);
+
+extern void NAME (aout, swap_std_reloc_in)
+ (bfd *, struct reloc_std_external *, arelent *, asymbol **,
+ bfd_size_type);
+
+extern reloc_howto_type * NAME (aout, reloc_type_lookup)
+ (bfd *, bfd_reloc_code_real_type);
+
+extern reloc_howto_type * NAME (aout, reloc_name_lookup)
+ (bfd *, const char *);
+
+extern bfd_boolean NAME (aout, slurp_reloc_table)
+ (bfd *, sec_ptr, asymbol **);
+
+extern long NAME (aout, canonicalize_reloc)
+ (bfd *, sec_ptr, arelent **, asymbol **);
+
+extern long NAME (aout, get_reloc_upper_bound)
+ (bfd *, sec_ptr);
+
+extern void NAME (aout, reclaim_reloc)
+ (bfd *, sec_ptr);
+
+extern alent * NAME (aout, get_lineno)
+ (bfd *, asymbol *);
+
+extern void NAME (aout, print_symbol)
+ (bfd *, void *, asymbol *, bfd_print_symbol_type);
+
+extern void NAME (aout, get_symbol_info)
+ (bfd *, asymbol *, symbol_info *);
+
+extern bfd_boolean NAME (aout, find_nearest_line)
+ (bfd *, asection *, asymbol **, bfd_vma, const char **,
+ const char **, unsigned int *);
+
+extern long NAME (aout, read_minisymbols)
+ (bfd *, bfd_boolean, void * *, unsigned int *);
+
+extern asymbol * NAME (aout, minisymbol_to_symbol)
+ (bfd *, bfd_boolean, const void *, asymbol *);
+
+extern int NAME (aout, sizeof_headers)
+ (bfd *, struct bfd_link_info *);
+
+extern bfd_boolean NAME (aout, adjust_sizes_and_vmas)
+ (bfd *, bfd_size_type *, file_ptr *);
+
+extern void NAME (aout, swap_exec_header_in)
+ (bfd *, struct external_exec *, struct internal_exec *);
+
+extern void NAME (aout, swap_exec_header_out)
+ (bfd *, struct internal_exec *, struct external_exec *);
+
+extern struct bfd_hash_entry * NAME (aout, link_hash_newfunc)
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
+
+extern bfd_boolean NAME (aout, link_hash_table_init)
+ (struct aout_link_hash_table *, bfd *,
+ struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *),
+ unsigned int);
+
+extern struct bfd_link_hash_table * NAME (aout, link_hash_table_create)
+ (bfd *);
+
+extern bfd_boolean NAME (aout, link_add_symbols)
+ (bfd *, struct bfd_link_info *);
+
+extern bfd_boolean NAME (aout, final_link)
+ (bfd *, struct bfd_link_info *,
+ void (*) (bfd *, file_ptr *, file_ptr *, file_ptr *));
+
+extern bfd_boolean NAME (aout, bfd_free_cached_info)
+ (bfd *);
+
+#define aout_32_find_inliner_info _bfd_nosymbols_find_inliner_info
+#if 0 /* Are these needed? */
+#define aout_16_find_inliner_info _bfd_nosymbols_find_inliner_info
+#define aout_64_find_inliner_info _bfd_nosymbols_find_inliner_info
+#endif
+
+/* A.out uses the generic versions of these routines... */
+
+#define aout_16_get_section_contents _bfd_generic_get_section_contents
+
+#define aout_32_get_section_contents _bfd_generic_get_section_contents
+
+#define aout_64_get_section_contents _bfd_generic_get_section_contents
+#ifndef NO_WRITE_HEADER_KLUDGE
+#define NO_WRITE_HEADER_KLUDGE 0
+#endif
+
+#ifndef aout_32_bfd_is_local_label_name
+#define aout_32_bfd_is_local_label_name bfd_generic_is_local_label_name
+#endif
+
+#ifndef aout_32_bfd_is_target_special_symbol
+#define aout_32_bfd_is_target_special_symbol \
+ ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
+#endif
+
+#ifndef WRITE_HEADERS
+#define WRITE_HEADERS(abfd, execp) \
+ { \
+ bfd_size_type text_size; /* Dummy vars. */ \
+ file_ptr text_end; \
+ \
+ if (adata(abfd).magic == undecided_magic) \
+ NAME (aout, adjust_sizes_and_vmas) (abfd, & text_size, & text_end); \
+ \
+ execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \
+ execp->a_entry = bfd_get_start_address (abfd); \
+ \
+ execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * \
+ obj_reloc_entry_size (abfd)); \
+ execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \
+ obj_reloc_entry_size (abfd)); \
+ NAME (aout, swap_exec_header_out) (abfd, execp, & exec_bytes); \
+ \
+ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 \
+ || bfd_bwrite (& exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \
+ abfd) != EXEC_BYTES_SIZE) \
+ return FALSE; \
+ /* Now write out reloc info, followed by syms and strings. */ \
+ \
+ if (bfd_get_outsymbols (abfd) != NULL \
+ && bfd_get_symcount (abfd) != 0) \
+ { \
+ if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0)\
+ return FALSE; \
+ \
+ if (! NAME (aout, write_syms) (abfd)) \
+ return FALSE; \
+ } \
+ \
+ if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (*execp)), SEEK_SET) != 0) \
+ return FALSE; \
+ if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd))) \
+ return FALSE; \
+ \
+ if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*execp)), SEEK_SET) != 0) \
+ return FALSE; \
+ if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) \
+ return FALSE; \
+ }
+#endif
+
+/* Test if a read-only section can be merged with .text. This is
+ possible if: