Back to index

cell-binutils  2.17cvs20070401
libaout.h
Go to the documentation of this file.
00001 /* BFD back-end data structures for a.out (and similar) files.
00002    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
00003    2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
00004    Free Software Foundation, Inc.
00005    Written by Cygnus Support.
00006 
00007    This file is part of BFD, the Binary File Descriptor library.
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; either version 2 of the License, or
00012    (at your option) any later version.
00013 
00014    This program is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017    GNU General Public License for more details.
00018 
00019    You should have received a copy of the GNU General Public License
00020    along with this program; if not, write to the Free Software
00021    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00022 
00023 #ifndef LIBAOUT_H
00024 #define LIBAOUT_H
00025 
00026 /* We try to encapsulate the differences in the various a.out file
00027    variants in a few routines, and otherwise share large masses of code.
00028    This means we only have to fix bugs in one place, most of the time.  */
00029 
00030 #include "bfdlink.h"
00031 
00032 /* Macros for accessing components in an aout header.  */
00033 
00034 #define H_PUT_64  bfd_h_put_64
00035 #define H_PUT_32  bfd_h_put_32
00036 #define H_PUT_16  bfd_h_put_16
00037 #define H_PUT_8   bfd_h_put_8
00038 #define H_PUT_S64 bfd_h_put_signed_64
00039 #define H_PUT_S32 bfd_h_put_signed_32
00040 #define H_PUT_S16 bfd_h_put_signed_16
00041 #define H_PUT_S8  bfd_h_put_signed_8
00042 #define H_GET_64  bfd_h_get_64
00043 #define H_GET_32  bfd_h_get_32
00044 #define H_GET_16  bfd_h_get_16
00045 #define H_GET_8   bfd_h_get_8
00046 #define H_GET_S64 bfd_h_get_signed_64
00047 #define H_GET_S32 bfd_h_get_signed_32
00048 #define H_GET_S16 bfd_h_get_signed_16
00049 #define H_GET_S8  bfd_h_get_signed_8
00050 
00051 /* Parameterize the a.out code based on whether it is being built
00052    for a 32-bit architecture or a 64-bit architecture.  */
00053 /* Do not "beautify" the CONCAT* macro args.  Traditional C will not
00054    remove whitespace added here, and thus will fail to concatenate
00055    the tokens.  */
00056 #if ARCH_SIZE==64
00057 #define GET_WORD  H_GET_64
00058 #define GET_SWORD H_GET_S64
00059 #define GET_MAGIC H_GET_32
00060 #define PUT_WORD  H_PUT_64
00061 #define PUT_MAGIC H_PUT_32
00062 #ifndef NAME
00063 #define NAME(x,y) CONCAT3 (x,_64_,y)
00064 #endif
00065 #define JNAME(x) CONCAT2 (x,_64)
00066 #define BYTES_IN_WORD 8
00067 #else
00068 #if ARCH_SIZE==16
00069 #define GET_WORD  H_GET_16
00070 #define GET_SWORD H_GET_S16
00071 #define GET_MAGIC H_GET_16
00072 #define PUT_WORD  H_PUT_16
00073 #define PUT_MAGIC H_PUT_16
00074 #ifndef NAME
00075 #define NAME(x,y) CONCAT3 (x,_16_,y)
00076 #endif
00077 #define JNAME(x) CONCAT2 (x,_16)
00078 #define BYTES_IN_WORD 2
00079 #else /* ARCH_SIZE == 32 */
00080 #define GET_WORD  H_GET_32
00081 #define GET_SWORD H_GET_S32
00082 #define GET_MAGIC H_GET_32
00083 #define PUT_WORD  H_PUT_32
00084 #define PUT_MAGIC H_PUT_32
00085 #ifndef NAME
00086 #define NAME(x,y) CONCAT3 (x,_32_,y)
00087 #endif
00088 #define JNAME(x) CONCAT2 (x,_32)
00089 #define BYTES_IN_WORD 4
00090 #endif /* ARCH_SIZE==32 */
00091 #endif /* ARCH_SIZE==64 */
00092 
00093 /* Declare at file level, since used in parameter lists, which have
00094    weird scope.  */
00095 struct external_exec;
00096 struct external_nlist;
00097 struct reloc_ext_external;
00098 struct reloc_std_external;
00099 
00100 /* a.out backend linker hash table entries.  */
00101 
00102 struct aout_link_hash_entry
00103 {
00104   struct bfd_link_hash_entry root;
00105   /* Whether this symbol has been written out.  */
00106   bfd_boolean written;
00107   /* Symbol index in output file.  */
00108   int indx;
00109 };
00110 
00111 /* a.out backend linker hash table.  */
00112 
00113 struct aout_link_hash_table
00114 {
00115   struct bfd_link_hash_table root;
00116 };
00117 
00118 /* Look up an entry in an a.out link hash table.  */
00119 
00120 #define aout_link_hash_lookup(table, string, create, copy, follow) \
00121   ((struct aout_link_hash_entry *) \
00122    bfd_link_hash_lookup (&(table)->root, (string), (create), (copy), (follow)))
00123 
00124 /* Traverse an a.out link hash table.  */
00125 
00126 #define aout_link_hash_traverse(table, func, info)                    \
00127   (bfd_link_hash_traverse                                      \
00128    (&(table)->root,                                            \
00129     (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func),  \
00130     (info)))
00131 
00132 /* Get the a.out link hash table from the info structure.  This is
00133    just a cast.  */
00134 
00135 #define aout_hash_table(p) ((struct aout_link_hash_table *) ((p)->hash))
00136 
00137 /* Back-end information for various a.out targets.  */
00138 struct aout_backend_data
00139 {
00140   /* Are ZMAGIC files mapped contiguously?  If so, the text section may
00141      need more padding, if the segment size (granularity for memory access
00142      control) is larger than the page size.  */
00143   unsigned char zmagic_mapped_contiguous;
00144   /* If this flag is set, ZMAGIC/NMAGIC file headers get mapped in with the
00145      text section, which starts immediately after the file header.
00146      If not, the text section starts on the next page.  */
00147   unsigned char text_includes_header;
00148 
00149   /* If this flag is set, then if the entry address is not in the
00150      first SEGMENT_SIZE bytes of the text section, it is taken to be
00151      the address of the start of the text section.  This can be useful
00152      for kernels.  */
00153   unsigned char entry_is_text_address;
00154 
00155   /* The value to pass to N_SET_FLAGS.  */
00156   unsigned char exec_hdr_flags;
00157 
00158   /* If the text section VMA isn't specified, and we need an absolute
00159      address, use this as the default.  If we're producing a relocatable
00160      file, zero is always used.  */
00161   /* ?? Perhaps a callback would be a better choice?  Will this do anything
00162      reasonable for a format that handles multiple CPUs with different
00163      load addresses for each?  */
00164   bfd_vma default_text_vma;
00165 
00166   /* Callback for setting the page and segment sizes, if they can't be
00167      trivially determined from the architecture.  */
00168   bfd_boolean (*set_sizes) (bfd *);
00169 
00170   /* zmagic files only. For go32, the length of the exec header contributes
00171      to the size of the text section in the file for alignment purposes but
00172      does *not* get counted in the length of the text section. */
00173   unsigned char exec_header_not_counted;
00174 
00175   /* Callback from the add symbols phase of the linker code to handle
00176      a dynamic object.  */
00177   bfd_boolean (*add_dynamic_symbols)
00178     (bfd *, struct bfd_link_info *, struct external_nlist **,
00179      bfd_size_type *, char **);
00180 
00181   /* Callback from the add symbols phase of the linker code to handle
00182      adding a single symbol to the global linker hash table.  */
00183   bfd_boolean (*add_one_symbol)
00184     (struct bfd_link_info *, bfd *, const char *, flagword,
00185      asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
00186      struct bfd_link_hash_entry **);
00187 
00188   /* Called to handle linking a dynamic object.  */
00189   bfd_boolean (*link_dynamic_object)
00190     (struct bfd_link_info *, bfd *);
00191 
00192   /* Called for each global symbol being written out by the linker.
00193      This should write out the dynamic symbol information.  */
00194   bfd_boolean (*write_dynamic_symbol)
00195     (bfd *, struct bfd_link_info *, struct aout_link_hash_entry *);
00196 
00197   /* If this callback is not NULL, the linker calls it for each reloc.
00198      RELOC is a pointer to the unswapped reloc.  If *SKIP is set to
00199      TRUE, the reloc will be skipped.  *RELOCATION may be changed to
00200      change the effects of the relocation.  */
00201   bfd_boolean (*check_dynamic_reloc)
00202     (struct bfd_link_info *info, bfd *input_bfd,
00203      asection *input_section, struct aout_link_hash_entry *h,
00204      void * reloc, bfd_byte *contents, bfd_boolean *skip,
00205      bfd_vma *relocation);
00206 
00207   /* Called at the end of a link to finish up any dynamic linking
00208      information.  */
00209   bfd_boolean (*finish_dynamic_link) (bfd *, struct bfd_link_info *);
00210 };
00211 #define aout_backend_info(abfd) \
00212        ((const struct aout_backend_data *)((abfd)->xvec->backend_data))
00213 
00214 /* This is the layout in memory of a "struct exec" while we process it.
00215    All 'lengths' are given as a number of bytes.
00216    All 'alignments' are for relinkable files only;  an alignment of
00217        'n' indicates the corresponding segment must begin at an
00218        address that is a multiple of (2**n).  */
00219 
00220 struct internal_exec
00221 {
00222   long a_info;                     /* Magic number and flags, packed.  */
00223   bfd_vma a_text;           /* Length of text, in bytes.  */
00224   bfd_vma a_data;           /* Length of data, in bytes.  */
00225   bfd_vma a_bss;            /* Length of uninitialized data area in mem.  */
00226   bfd_vma a_syms;           /* Length of symbol table data in file.  */
00227   bfd_vma a_entry;          /* Start address.  */
00228   bfd_vma a_trsize;         /* Length of text's relocation info, in bytes.  */
00229   bfd_vma a_drsize;         /* Length of data's relocation info, in bytes.  */
00230   /* Added for i960 */
00231   bfd_vma a_tload;          /* Text runtime load address.  */
00232   bfd_vma a_dload;          /* Data runtime load address.  */
00233   unsigned char a_talign;   /* Alignment of text segment.  */
00234   unsigned char a_dalign;   /* Alignment of data segment.  */
00235   unsigned char a_balign;   /* Alignment of bss segment.  */
00236   char a_relaxable;                /* Enough info for linker relax.  */
00237 };
00238 
00239 /* Magic number is written
00240    < MSB          >
00241    3130292827262524232221201918171615141312111009080706050403020100
00242    < FLAGS        >< MACHINE TYPE ><  MAGIC NUMBER                >  */
00243 
00244 /* Magic number for NetBSD is
00245    <MSB           >
00246    3130292827262524232221201918171615141312111009080706050403020100
00247    < FLAGS    >< MACHINE TYPE     ><  MAGIC NUMBER                >  */
00248 
00249 enum machine_type
00250 {
00251   M_UNKNOWN = 0,
00252   M_68010 = 1,
00253   M_68020 = 2,
00254   M_SPARC = 3,
00255   /* Skip a bunch so we don't run into any of SUN's numbers.  */
00256   /* Make these up for the ns32k.  */
00257   M_NS32032 = (64),    /* NS32032 running ?  */
00258   M_NS32532 = (64 + 5),       /* NS32532 running mach.  */
00259   M_386 = 100,
00260   M_29K = 101,            /* AMD 29000.  */
00261   M_386_DYNIX = 102,   /* Sequent running dynix.  */
00262   M_ARM = 103,                /* Advanced Risc Machines ARM.  */
00263   M_SPARCLET = 131,    /* SPARClet = M_SPARC + 128.  */
00264   M_386_NETBSD = 134,         /* NetBSD/i386 binary.  */
00265   M_68K_NETBSD = 135,         /* NetBSD/m68k binary.  */
00266   M_68K4K_NETBSD = 136,       /* NetBSD/m68k4k binary.  */
00267   M_532_NETBSD = 137,         /* NetBSD/ns32k binary.  */
00268   M_SPARC_NETBSD = 138,       /* NetBSD/sparc binary.  */
00269   M_PMAX_NETBSD = 139,        /* NetBSD/pmax (MIPS little-endian) binary.  */
00270   M_VAX_NETBSD = 140,         /* NetBSD/vax binary.  */
00271   M_ALPHA_NETBSD = 141,       /* NetBSD/alpha binary.  */
00272   M_ARM6_NETBSD = 143,        /* NetBSD/arm32 binary.  */
00273   M_SPARCLET_1 = 147,         /* 0x93, reserved.  */
00274   M_POWERPC_NETBSD = 149, /* NetBSD/powerpc (big-endian) binary.  */
00275   M_VAX4K_NETBSD = 150,       /* NetBSD/vax 4K pages binary.  */
00276   M_MIPS1 = 151,          /* MIPS R2000/R3000 binary.  */
00277   M_MIPS2 = 152,          /* MIPS R4000/R6000 binary.  */
00278   M_88K_OPENBSD = 153,        /* OpenBSD/m88k binary.  */
00279   M_HPPA_OPENBSD = 154,       /* OpenBSD/hppa binary.  */
00280   M_SPARC64_NETBSD = 156, /* NetBSD/sparc64 binary.  */
00281   M_X86_64_NETBSD = 157,  /* NetBSD/amd64 binary.  */
00282   M_SPARCLET_2 = 163,         /* 0xa3, reserved.  */
00283   M_SPARCLET_3 = 179,         /* 0xb3, reserved.  */
00284   M_SPARCLET_4 = 195,         /* 0xc3, reserved.  */
00285   M_HP200 = 200,       /* HP 200 (68010) BSD binary.  */
00286   M_HP300 = (300 % 256),  /* HP 300 (68020+68881) BSD binary.  */
00287   M_HPUX = (0x20c % 256), /* HP 200/300 HPUX binary.  */
00288   M_SPARCLET_5 = 211,         /* 0xd3, reserved.  */
00289   M_SPARCLET_6 = 227,         /* 0xe3, reserved.  */
00290 /*M_SPARCLET_7 = 243  / * 0xf3, reserved.  */
00291   M_SPARCLITE_LE = 243,
00292   M_CRIS = 255                /* Axis CRIS binary.  */
00293 };
00294 
00295 #define N_DYNAMIC(exec) ((exec).a_info & 0x80000000)
00296 
00297 #ifndef N_MAGIC
00298 # define N_MAGIC(exec) ((exec).a_info & 0xffff)
00299 #endif
00300 
00301 #ifndef N_MACHTYPE
00302 # define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
00303 #endif
00304 
00305 #ifndef N_FLAGS
00306 # define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
00307 #endif
00308 
00309 #ifndef N_SET_INFO
00310 # define N_SET_INFO(exec, magic, type, flags) \
00311 ((exec).a_info = ((magic) & 0xffff) \
00312  | (((int)(type) & 0xff) << 16) \
00313  | (((flags) & 0xff) << 24))
00314 #endif
00315 
00316 #ifndef N_SET_DYNAMIC
00317 # define N_SET_DYNAMIC(exec, dynamic) \
00318 ((exec).a_info = (dynamic) ? (long) ((exec).a_info | 0x80000000) : \
00319 ((exec).a_info & 0x7fffffff))
00320 #endif
00321 
00322 #ifndef N_SET_MAGIC
00323 # define N_SET_MAGIC(exec, magic) \
00324 ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
00325 #endif
00326 
00327 #ifndef N_SET_MACHTYPE
00328 # define N_SET_MACHTYPE(exec, machtype) \
00329 ((exec).a_info = \
00330  ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
00331 #endif
00332 
00333 #ifndef N_SET_FLAGS
00334 # define N_SET_FLAGS(exec, flags) \
00335 ((exec).a_info = \
00336  ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
00337 #endif
00338 
00339 typedef struct aout_symbol
00340 {
00341   asymbol symbol;
00342   short desc;
00343   char other;
00344   unsigned char type;
00345 } aout_symbol_type;
00346 
00347 /* The `tdata' struct for all a.out-like object file formats.
00348    Various things depend on this struct being around any time an a.out
00349    file is being handled.  An example is dbxread.c in GDB.  */
00350 
00351 struct aoutdata
00352 {
00353   struct internal_exec *hdr;              /* Exec file header.  */
00354   aout_symbol_type *symbols;              /* Symtab for input bfd.  */
00355 
00356   /* For ease, we do this.  */
00357   asection *textsec;
00358   asection *datasec;
00359   asection *bsssec;
00360 
00361   /* We remember these offsets so that after check_file_format, we have
00362      no dependencies on the particular format of the exec_hdr.  */
00363   file_ptr sym_filepos;
00364   file_ptr str_filepos;
00365 
00366   /* Size of a relocation entry in external form.  */
00367   unsigned reloc_entry_size;
00368 
00369   /* Size of a symbol table entry in external form.  */
00370   unsigned symbol_entry_size;
00371 
00372   /* Page size - needed for alignment of demand paged files.  */
00373   unsigned long page_size;
00374 
00375   /* Segment size - needed for alignment of demand paged files.  */
00376   unsigned long segment_size;
00377 
00378   /* Zmagic disk block size - need to align the start of the text
00379      section in ZMAGIC binaries.  Normally the same as page_size.  */
00380   unsigned long zmagic_disk_block_size;
00381 
00382   unsigned exec_bytes_size;
00383   unsigned vma_adjusted : 1;
00384 
00385   /* Used when a bfd supports several highly similar formats.  */
00386   enum
00387     {
00388       default_format = 0,
00389       /* Used on HP 9000/300 running HP/UX.  See hp300hpux.c.  */
00390       gnu_encap_format,
00391       /* Used on Linux, 386BSD, etc.  See include/aout/aout64.h.  */
00392       q_magic_format
00393     } subformat;
00394 
00395   enum
00396     {
00397       undecided_magic = 0,
00398       z_magic,
00399       o_magic,
00400       n_magic
00401     } magic;
00402 
00403   /* A buffer for find_nearest_line.  */
00404   char *line_buf;
00405 
00406   /* The external symbol information.  */
00407   struct external_nlist *external_syms;
00408   bfd_size_type external_sym_count;
00409   bfd_window sym_window;
00410   char *external_strings;
00411   bfd_size_type external_string_size;
00412   bfd_window string_window;
00413   struct aout_link_hash_entry **sym_hashes;
00414 
00415   /* A pointer for shared library information.  */
00416   void * dynamic_info;
00417 
00418   /* A mapping from local symbols to offsets into the global offset
00419      table, used when linking on SunOS.  This is indexed by the symbol
00420      index.  */
00421   bfd_vma *local_got_offsets;
00422 };
00423 
00424 struct  aout_data_struct
00425 {
00426   struct aoutdata a;
00427   struct internal_exec e;
00428 };
00429 
00430 #define       adata(bfd)                      ((bfd)->tdata.aout_data->a)
00431 #define       exec_hdr(bfd)                   (adata (bfd).hdr)
00432 #define       obj_aout_symbols(bfd)                  (adata (bfd).symbols)
00433 #define       obj_textsec(bfd)                (adata (bfd).textsec)
00434 #define       obj_datasec(bfd)                (adata (bfd).datasec)
00435 #define       obj_bsssec(bfd)                        (adata (bfd).bsssec)
00436 #define       obj_sym_filepos(bfd)            (adata (bfd).sym_filepos)
00437 #define       obj_str_filepos(bfd)            (adata (bfd).str_filepos)
00438 #define       obj_reloc_entry_size(bfd)          (adata (bfd).reloc_entry_size)
00439 #define       obj_symbol_entry_size(bfd)         (adata (bfd).symbol_entry_size)
00440 #define obj_aout_subformat(bfd)               (adata (bfd).subformat)
00441 #define obj_aout_external_syms(bfd)        (adata (bfd).external_syms)
00442 #define obj_aout_external_sym_count(bfd)   (adata (bfd).external_sym_count)
00443 #define obj_aout_sym_window(bfd)           (adata (bfd).sym_window)
00444 #define obj_aout_external_strings(bfd)     (adata (bfd).external_strings)
00445 #define obj_aout_external_string_size(bfd) (adata (bfd).external_string_size)
00446 #define obj_aout_string_window(bfd)        (adata (bfd).string_window)
00447 #define obj_aout_sym_hashes(bfd)           (adata (bfd).sym_hashes)
00448 #define obj_aout_dynamic_info(bfd)         (adata (bfd).dynamic_info)
00449 
00450 /* We take the address of the first element of an asymbol to ensure that the
00451    macro is only ever applied to an asymbol.  */
00452 #define aout_symbol(asymbol) ((aout_symbol_type *)(&(asymbol)->the_bfd))
00453 
00454 /* Information we keep for each a.out section.  This is currently only
00455    used by the a.out backend linker.  */
00456 
00457 struct aout_section_data_struct
00458 {
00459   /* The unswapped relocation entries for this section.  */
00460   void * relocs;
00461 };
00462 
00463 #define aout_section_data(s) \
00464   ((struct aout_section_data_struct *) (s)->used_by_bfd)
00465 
00466 #define set_aout_section_data(s,v) \
00467   ((s)->used_by_bfd = (void *)&(v)->relocs)
00468 
00469 /* Prototype declarations for functions defined in aoutx.h.  */
00470 
00471 extern bfd_boolean NAME (aout, squirt_out_relocs)
00472   (bfd *, asection *);
00473 
00474 extern bfd_boolean NAME (aout, make_sections)
00475   (bfd *);
00476 
00477 extern const bfd_target * NAME (aout, some_aout_object_p)
00478   (bfd *, struct internal_exec *, const bfd_target *(*) (bfd *));
00479 
00480 extern bfd_boolean NAME (aout, mkobject)
00481   (bfd *);
00482 
00483 extern enum machine_type NAME (aout, machine_type)
00484   (enum bfd_architecture, unsigned long, bfd_boolean *);
00485 
00486 extern bfd_boolean NAME (aout, set_arch_mach)
00487   (bfd *, enum bfd_architecture, unsigned long);
00488 
00489 extern bfd_boolean NAME (aout, new_section_hook)
00490   (bfd *, asection *);
00491 
00492 extern bfd_boolean NAME (aout, set_section_contents)
00493   (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type);
00494 
00495 extern asymbol * NAME (aout, make_empty_symbol)
00496   (bfd *);
00497 
00498 extern bfd_boolean NAME (aout, translate_symbol_table)
00499   (bfd *, aout_symbol_type *, struct external_nlist *, bfd_size_type,
00500           char *, bfd_size_type, bfd_boolean);
00501 
00502 extern bfd_boolean NAME (aout, slurp_symbol_table)
00503   (bfd *);
00504 
00505 extern bfd_boolean NAME (aout, write_syms)
00506   (bfd *);
00507 
00508 extern void NAME (aout, reclaim_symbol_table)
00509   (bfd *);
00510 
00511 extern long NAME (aout, get_symtab_upper_bound)
00512   (bfd *);
00513 
00514 extern long NAME (aout, canonicalize_symtab)
00515   (bfd *, asymbol **);
00516 
00517 extern void NAME (aout, swap_ext_reloc_in)
00518   (bfd *, struct reloc_ext_external *, arelent *, asymbol **,
00519    bfd_size_type);
00520 
00521 extern void NAME (aout, swap_std_reloc_in)
00522   (bfd *, struct reloc_std_external *, arelent *, asymbol **,
00523    bfd_size_type);
00524 
00525 extern reloc_howto_type * NAME (aout, reloc_type_lookup)
00526   (bfd *, bfd_reloc_code_real_type);
00527 
00528 extern reloc_howto_type * NAME (aout, reloc_name_lookup)
00529   (bfd *, const char *);
00530 
00531 extern bfd_boolean NAME (aout, slurp_reloc_table)
00532   (bfd *, sec_ptr, asymbol **);
00533 
00534 extern long NAME (aout, canonicalize_reloc)
00535   (bfd *, sec_ptr, arelent **, asymbol **);
00536 
00537 extern long NAME (aout, get_reloc_upper_bound)
00538   (bfd *, sec_ptr);
00539 
00540 extern void NAME (aout, reclaim_reloc)
00541   (bfd *, sec_ptr);
00542 
00543 extern alent * NAME (aout, get_lineno)
00544   (bfd *, asymbol *);
00545 
00546 extern void NAME (aout, print_symbol)
00547   (bfd *, void *, asymbol *, bfd_print_symbol_type);
00548 
00549 extern void NAME (aout, get_symbol_info)
00550   (bfd *, asymbol *, symbol_info *);
00551 
00552 extern bfd_boolean NAME (aout, find_nearest_line)
00553   (bfd *, asection *, asymbol **, bfd_vma, const char **,
00554    const char **, unsigned int *);
00555 
00556 extern long NAME (aout, read_minisymbols)
00557   (bfd *, bfd_boolean, void * *, unsigned int *);
00558 
00559 extern asymbol * NAME (aout, minisymbol_to_symbol)
00560   (bfd *, bfd_boolean, const void *, asymbol *);
00561 
00562 extern int NAME (aout, sizeof_headers)
00563   (bfd *, struct bfd_link_info *);
00564 
00565 extern bfd_boolean NAME (aout, adjust_sizes_and_vmas)
00566   (bfd *, bfd_size_type *, file_ptr *);
00567 
00568 extern void NAME (aout, swap_exec_header_in)
00569   (bfd *, struct external_exec *, struct internal_exec *);
00570 
00571 extern void NAME (aout, swap_exec_header_out)
00572   (bfd *, struct internal_exec *, struct external_exec *);
00573 
00574 extern struct bfd_hash_entry * NAME (aout, link_hash_newfunc)
00575   (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
00576 
00577 extern bfd_boolean NAME (aout, link_hash_table_init)
00578   (struct aout_link_hash_table *, bfd *,
00579    struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
00580                             struct bfd_hash_table *,
00581                             const char *),
00582    unsigned int);
00583 
00584 extern struct bfd_link_hash_table * NAME (aout, link_hash_table_create)
00585   (bfd *);
00586 
00587 extern bfd_boolean NAME (aout, link_add_symbols)
00588   (bfd *, struct bfd_link_info *);
00589 
00590 extern bfd_boolean NAME (aout, final_link)
00591   (bfd *, struct bfd_link_info *,
00592    void (*) (bfd *, file_ptr *, file_ptr *, file_ptr *));
00593 
00594 extern bfd_boolean NAME (aout, bfd_free_cached_info)
00595   (bfd *);
00596 
00597 #define aout_32_find_inliner_info  _bfd_nosymbols_find_inliner_info
00598 #if 0  /* Are these needed? */
00599 #define aout_16_find_inliner_info  _bfd_nosymbols_find_inliner_info
00600 #define aout_64_find_inliner_info  _bfd_nosymbols_find_inliner_info
00601 #endif
00602 
00603 /* A.out uses the generic versions of these routines...  */
00604 
00605 #define       aout_16_get_section_contents       _bfd_generic_get_section_contents
00606 
00607 #define       aout_32_get_section_contents       _bfd_generic_get_section_contents
00608 
00609 #define       aout_64_get_section_contents       _bfd_generic_get_section_contents
00610 #ifndef NO_WRITE_HEADER_KLUDGE
00611 #define NO_WRITE_HEADER_KLUDGE 0
00612 #endif
00613 
00614 #ifndef aout_32_bfd_is_local_label_name
00615 #define aout_32_bfd_is_local_label_name bfd_generic_is_local_label_name
00616 #endif
00617 
00618 #ifndef aout_32_bfd_is_target_special_symbol
00619 #define aout_32_bfd_is_target_special_symbol \
00620   ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
00621 #endif
00622 
00623 #ifndef WRITE_HEADERS
00624 #define WRITE_HEADERS(abfd, execp)                                   \
00625       {                                                                     \
00626        bfd_size_type text_size; /* Dummy vars.  */                          \
00627        file_ptr text_end;                                            \
00628                                                                             \
00629        if (adata(abfd).magic == undecided_magic)                     \
00630          NAME (aout, adjust_sizes_and_vmas) (abfd, & text_size, & text_end); \
00631                                                                      \
00632        execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE;       \
00633        execp->a_entry = bfd_get_start_address (abfd);                       \
00634                                                                      \
00635        execp->a_trsize = ((obj_textsec (abfd)->reloc_count) *               \
00636                         obj_reloc_entry_size (abfd));                \
00637        execp->a_drsize = ((obj_datasec (abfd)->reloc_count) *               \
00638                         obj_reloc_entry_size (abfd));                \
00639        NAME (aout, swap_exec_header_out) (abfd, execp, & exec_bytes);       \
00640                                                                      \
00641        if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0              \
00642            || bfd_bwrite (& exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE,     \
00643                        abfd) != EXEC_BYTES_SIZE)                     \
00644          return FALSE;                                                      \
00645        /* Now write out reloc info, followed by syms and strings.  */       \
00646                                                                      \
00647        if (bfd_get_outsymbols (abfd) != NULL                                \
00648            && bfd_get_symcount (abfd) != 0)                                 \
00649          {                                                           \
00650            if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0)\
00651              return FALSE;                                           \
00652                                                                      \
00653            if (! NAME (aout, write_syms) (abfd))                     \
00654              return FALSE;                                           \
00655          }                                                           \
00656                                                                      \
00657        if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (*execp)), SEEK_SET) != 0)  \
00658          return FALSE;                                                      \
00659        if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd)))       \
00660          return FALSE;                                                      \
00661                                                                      \
00662        if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*execp)), SEEK_SET) != 0)  \
00663          return FALSE;                                                      \
00664        if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd)))       \
00665          return FALSE;                                                      \
00666       }
00667 #endif
00668 
00669 /* Test if a read-only section can be merged with .text.  This is
00670    possible if:
00671 
00672    1. Section has file contents and is read-only.
00673    2. The VMA of the section is after the end of .text and before
00674       the start of .data.
00675    3. The image is demand-pageable (otherwise, a_text in the header
00676       will not reflect the gap between .text and .data).  */
00677 
00678 #define aout_section_merge_with_text_p(abfd, sec)                     \
00679   (((sec)->flags & (SEC_HAS_CONTENTS | SEC_READONLY)) ==              \
00680       (SEC_HAS_CONTENTS | SEC_READONLY)                               \
00681    && obj_textsec (abfd) != NULL                               \
00682    && obj_datasec (abfd) != NULL                               \
00683    && (sec)->vma >= (obj_textsec (abfd)->vma +                        \
00684                    obj_textsec (abfd)->size)                          \
00685    && ((sec)->vma + (sec)->size) <= obj_datasec (abfd)->vma           \
00686    && ((abfd)->flags & D_PAGED) != 0)
00687 
00688 #endif /* ! defined (LIBAOUT_H) */