along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+/* Use builtin alloca for gcc. */
+#ifdef __GNUC__
+#ifndef alloca
+#define alloca __builtin_alloca
+#endif
+#endif
/* Align an address upward to a boundary, expressed as a number of bytes.
E.g. align to an 8-byte boundary with argument of 8. */
carsym *symdefs; /* the symdef entries */
symindex symdef_count; /* how many there are */
char *extended_names; /* clever intel extension */
+ /* when more compilers are standard C, this can be a time_t */
+ long armap_timestamp; /* Timestamp value written into armap.
+ This is used for BSD archives to check
+ that the timestamp is recent enough
+ for the BSD linker to not complain,
+ just before we finish writing an
+ archive. */
+ file_ptr armap_datepos; /* Position within archive to seek to
+ rewrite the date field. */
+ PTR tdata; /* Backend specific information. */
};
#define bfd_ardata(bfd) ((bfd)->tdata.aout_ar_data)
#define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size)
-char *zalloc PARAMS ((bfd_size_type size));
+/* There is major inconsistency in how running out of memory is handled.
+ Some routines return a NULL, and set bfd_error to no_memory.
+ However, obstack routines can't do this ... */
+
+char *bfd_zmalloc PARAMS ((bfd_size_type size));
+/* From libiberty. */
+extern PTR xmalloc PARAMS ((size_t));
+/* SIZE is bfd_size_type. */
+#define bfd_xmalloc(size) xmalloc ((size_t) size)
+/* Defined without an argument so its address can be used. */
+#define bfd_xmalloc_by_size_t xmalloc
/* These routines allocate and free things on the BFD's obstack. Note
that realloc can never occur in place. */
-PTR bfd_alloc PARAMS ((bfd *abfd, bfd_size_type size));
-PTR bfd_zalloc PARAMS ((bfd *abfd, bfd_size_type size));
-PTR bfd_realloc PARAMS ((bfd *abfd, PTR orig, bfd_size_type new));
-void bfd_alloc_grow PARAMS ((bfd *abfd, PTR thing, bfd_size_type size));
+PTR bfd_alloc PARAMS ((bfd *abfd, size_t size));
+PTR bfd_zalloc PARAMS ((bfd *abfd, size_t size));
+PTR bfd_realloc PARAMS ((bfd *abfd, PTR orig, size_t new));
+void bfd_alloc_grow PARAMS ((bfd *abfd, PTR thing, size_t size));
PTR bfd_alloc_finish PARAMS ((bfd *abfd));
PTR bfd_alloc_by_size_t PARAMS ((bfd *abfd, size_t wanted));
CONST int direction));
long bfd_tell PARAMS ((bfd *abfd));
+int bfd_flush PARAMS ((bfd *abfd));
+int bfd_stat PARAMS ((bfd *abfd, struct stat *));
+
bfd * _bfd_create_empty_archive_element_shell PARAMS ((bfd *obfd));
-bfd * look_for_bfd_in_cache PARAMS ((bfd *arch_bfd, file_ptr index));
+bfd * _bfd_look_for_bfd_in_cache PARAMS ((bfd *arch_bfd, file_ptr index));
+boolean _bfd_add_bfd_to_archive_cache PARAMS ((bfd *, file_ptr, bfd *));
boolean _bfd_generic_mkarchive PARAMS ((bfd *abfd));
-struct areltdata * snarf_ar_hdr PARAMS ((bfd *abfd));
+struct areltdata * _bfd_snarf_ar_hdr PARAMS ((bfd *abfd));
bfd_target * bfd_generic_archive_p PARAMS ((bfd *abfd));
boolean bfd_slurp_armap PARAMS ((bfd *abfd));
+boolean bfd_slurp_bsd_armap_f2 PARAMS ((bfd *abfd));
#define bfd_slurp_bsd_armap bfd_slurp_armap
#define bfd_slurp_coff_armap bfd_slurp_armap
boolean _bfd_slurp_extended_name_table PARAMS ((bfd *abfd));
boolean _bfd_write_archive_contents PARAMS ((bfd *abfd));
-bfd * new_bfd PARAMS (());
+bfd *_bfd_get_elt_at_filepos PARAMS ((bfd *archive, file_ptr filepos));
+bfd * _bfd_new_bfd PARAMS ((void));
#define DEFAULT_STRING_SPACE_SIZE 0x2000
boolean bfd_add_to_string_table PARAMS ((char **table, char *new_string,
unsigned int *table_length,
char **free_ptr));
-bfd_vma _do_getb64 PARAMS ((unsigned char *addr));
-bfd_vma _do_getl64 PARAMS ((unsigned char *addr));
-bfd_signed_vma _do_getb_signed_64 PARAMS ((unsigned char *addr));
-bfd_signed_vma _do_getl_signed_64 PARAMS ((unsigned char *addr));
-bfd_vma _do_getb32 PARAMS ((unsigned char *addr));
-bfd_vma _do_getl32 PARAMS ((unsigned char *addr));
-bfd_signed_vma _do_getb_signed_32 PARAMS ((unsigned char *addr));
-bfd_signed_vma _do_getl_signed_32 PARAMS ((unsigned char *addr));
-bfd_vma _do_getb16 PARAMS ((unsigned char *addr));
-bfd_vma _do_getl16 PARAMS ((unsigned char *addr));
-bfd_signed_vma _do_getb_signed_16 PARAMS ((unsigned char *addr));
-bfd_signed_vma _do_getl_signed_16 PARAMS ((unsigned char *addr));
-void _do_putb64 PARAMS ((bfd_vma data, unsigned char *addr));
-void _do_putl64 PARAMS ((bfd_vma data, unsigned char *addr));
-void _do_putb32 PARAMS ((bfd_vma data, unsigned char *addr));
-void _do_putl32 PARAMS ((bfd_vma data, unsigned char *addr));
-void _do_putb16 PARAMS ((bfd_vma data, unsigned char *addr));
-void _do_putl16 PARAMS ((bfd_vma data, unsigned char *addr));
boolean bfd_false PARAMS ((bfd *ignore));
boolean bfd_true PARAMS ((bfd *ignore));
unsigned int bfd_0u PARAMS ((bfd *ignore));
void bfd_void PARAMS ((bfd *ignore));
-bfd * new_bfd_contained_in PARAMS ((bfd *));
+bfd * _bfd_new_bfd_contained_in PARAMS ((bfd *));
boolean _bfd_dummy_new_section_hook PARAMS ((bfd *ignore, asection *newsect));
char * _bfd_dummy_core_file_failing_command PARAMS ((bfd *abfd));
int _bfd_dummy_core_file_failing_signal PARAMS ((bfd *abfd));
boolean bfd_generic_set_section_contents PARAMS ((bfd *abfd, sec_ptr section,
PTR location, file_ptr offset,
bfd_size_type count));
-
+\f
+/* A routine to create entries for a bfd_link_hash_table. */
+extern struct bfd_hash_entry *_bfd_link_hash_newfunc
+ PARAMS ((struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string));
+
+/* Initialize a bfd_link_hash_table. */
+extern boolean _bfd_link_hash_table_init
+ PARAMS ((struct bfd_link_hash_table *, bfd *,
+ struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *)));
+
+/* Generic link hash table creation routine. */
+extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create
+ PARAMS ((bfd *));
+
+/* Generic add symbol routine. */
+extern boolean _bfd_generic_link_add_symbols
+ PARAMS ((bfd *, struct bfd_link_info *));
+
+/* Generic archive add symbol routine. */
+extern boolean _bfd_generic_link_add_archive_symbols
+ PARAMS ((bfd *, struct bfd_link_info *,
+ boolean (*checkfn) (bfd *, struct bfd_link_info *, boolean *)));
+
+/* Forward declaration to avoid prototype errors. */
+typedef struct bfd_link_hash_entry _bfd_link_hash_entry;
+
+/* Generic routine to add a single symbol. */
+extern boolean _bfd_generic_link_add_one_symbol
+ PARAMS ((struct bfd_link_info *, bfd *, const char *name, flagword,
+ asection *, bfd_vma, const char *, boolean copy,
+ boolean constructor, unsigned int bitsize,
+ struct bfd_link_hash_entry **));
+
+/* Generic link routine. */
+extern boolean _bfd_generic_final_link
+ PARAMS ((bfd *, struct bfd_link_info *));
+
+/* Default link order processing routine. */
+extern boolean _bfd_default_link_order
+ PARAMS ((bfd *, struct bfd_link_info *, asection *,
+ struct bfd_link_order *));
+
+/* Final link relocation routine. */
+extern bfd_reloc_status_type _bfd_final_link_relocate
+ PARAMS ((const reloc_howto_type *, bfd *, asection *, bfd_byte *,
+ bfd_vma address, bfd_vma value, bfd_vma addend));
+
+/* Relocate a particular location by a howto and a value. */
+extern bfd_reloc_status_type _bfd_relocate_contents
+ PARAMS ((const reloc_howto_type *, bfd *, bfd_vma, bfd_byte *));
+\f
/* Macros to tell if bfds are read or write enabled.
Note that bfds open for read may be scribbled into if the fd passed
/* Generic routine for close_and_cleanup is really just bfd_true. */
#define bfd_generic_close_and_cleanup bfd_true
+/* List of supported target vectors, and the default vector (if
+ bfd_default_vector[0] is NULL, there is no default). */
+extern bfd_target *bfd_target_vector[];
+extern bfd_target *bfd_default_vector[];
+
/* And more follows */