aboutsummaryrefslogtreecommitdiff
path: root/bfd/libbfd.h
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1991-05-02 04:11:40 +0000
committerJohn Gilmore <gnu@cygnus>1991-05-02 04:11:40 +0000
commitfc7233808a1d88db99a5181e1ee0f6865f8f5206 (patch)
tree2f0626920d2d237a52aae12eccd0d5b8dd54ec1c /bfd/libbfd.h
parentff37ea550b842cdb18aca531e5e705c03d4eed72 (diff)
downloadgdb-fc7233808a1d88db99a5181e1ee0f6865f8f5206.zip
gdb-fc7233808a1d88db99a5181e1ee0f6865f8f5206.tar.gz
gdb-fc7233808a1d88db99a5181e1ee0f6865f8f5206.tar.bz2
Merge devo/bfd with GDB's bfd.
Remove obstack.h to ../include and obstack.c to ../libiberty. Move COFF symbol swapping code to coffswap.c where GDB can call it but it won't be duplicated if we have N different COFF targets. Add support for traditional Unix core files (with a upage). This support is from an Ultrix port, but is probably slightly broken now. Improve bfd_release's of obstack'd items on error returns. gcc -Wall fixes. Handle section alignment slightly better in coff, and comment where it needs more work (on page-aligning virtual vs file addresses for DPAGED). Use set_tdata everywhere that tdata is set, to avoid "cast to the left of assignment" problems with some compilers. Move bfd_alloc, bfd_zalloc, bfd_realloc, and bfd_release into libbfd.h (from bfd.h) since they are internal routines. Remove the redundant suffix "_struct" from struct tags. Set symbol count early in file reading, before slurping in the syms, for GDB's use.
Diffstat (limited to 'bfd/libbfd.h')
-rw-r--r--bfd/libbfd.h36
1 files changed, 20 insertions, 16 deletions
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 2ff951f..0c84796 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -1,3 +1,6 @@
+/* libbfd.h -- Declarations used by bfd library implementation.
+ This include file is not for users of the library */
+
/* Copyright (C) 1990, 1991 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Diddler.
@@ -18,20 +21,16 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* $Id$ */
-/*** libbfd.h -- Declarations used by bfd library implementation.
- This include file is not for users of the library */
-
-
-
-
-
/* If you want to read and write large blocks, you might want to do it
in quanta of this amount */
#define DEFAULT_BUFFERSIZE 8192
-/* tdata for an archive. For an input archive cache
- needs to be free()'d. For an output archive, symdefs do.
-*/
+/* Set a tdata field. Can't use the other macros for this, since they
+ do casts, and casting to the left of assignment isn't portable. */
+#define set_tdata(bfd, v) ((bfd)->tdata = (PTR) (v))
+
+/* tdata for an archive. For an input archive, cache
+ needs to be free()'d. For an output archive, symdefs do. */
struct artdata {
file_ptr first_file_filepos;
@@ -44,7 +43,6 @@ struct artdata {
};
#define bfd_ardata(bfd) ((struct artdata *) ((bfd)->tdata))
-#define bfd_set_ardata(bfd, v) ((bfd)->tdata = (PTR) (v))
/* Goes in bfd's arelt_data slot */
struct areltdata {
@@ -59,13 +57,19 @@ struct areltdata {
This can't always work, because of alignment restrictions. We should change
it before it becomes a problem -- Gumby */
-PROTO (char *, zalloc, (size_t size));
+PROTO (char *, zalloc, (bfd_size_type size));
-PROTO (bfd_target *, bfd_find_target, (CONST char *target_name));
-PROTO (size_t, bfd_read, (PTR ptr, size_t size, size_t nitems, bfd *abfd));
-PROTO (size_t, bfd_write, (PTR ptr, size_t size, size_t nitems, bfd *abfd));
+/* These routines allocate and free things on the BFD's obstack. Note
+ that realloc can never occur in place. */
+PROTO(PTR, bfd_alloc, (bfd *abfd, bfd_size_type size));
+PROTO(PTR, bfd_zalloc,(bfd *abfd, bfd_size_type size));
+PROTO(PTR, bfd_realloc,(bfd *abfd, PTR orig, bfd_size_type new));
+#define bfd_release(x,y) (void) obstack_free(&(x->memory),y)
+PROTO (bfd_target *, bfd_find_target, (CONST char *target_name));
+PROTO (bfd_size_type, bfd_read, (PTR ptr, bfd_size_type size, bfd_size_type nitems, bfd *abfd));
+PROTO (bfd_size_type, bfd_write, (PTR ptr, bfd_size_type size, bfd_size_type nitems, bfd *abfd));
PROTO (FILE *, bfd_cache_lookup, (bfd *));
PROTO (void, bfd_cache_close, (bfd *));
@@ -103,7 +107,6 @@ PROTO (int, bfd_0, (bfd *ignore));
PROTO (unsigned int, bfd_0u, (bfd *ignore));
PROTO (void, bfd_void, (bfd *ignore));
-
PROTO (bfd *,new_bfd_contained_in,(bfd *));
PROTO (boolean, _bfd_dummy_new_section_hook, (bfd *ignore, asection *newsect));
PROTO (char *, _bfd_dummy_core_file_failing_command, (bfd *abfd));
@@ -125,6 +128,7 @@ PROTO (boolean, coff_write_armap, (bfd *arch, unsigned int elength,
PROTO ( bfd *,bfd_generic_openr_next_archived_file, (bfd *archive, bfd *last_file));
PROTO(int, bfd_generic_stat_arch_elt, (bfd *, struct stat *));
+
/* Macros to tell if bfds are read or write enabled.
Note that bfds open for read may be scribbled into if the fd passed