diff options
author | John Gilmore <gnu@cygnus> | 1991-05-10 23:51:35 +0000 |
---|---|---|
committer | John Gilmore <gnu@cygnus> | 1991-05-10 23:51:35 +0000 |
commit | 69ebee8678d423ef9b0eb88e0f74f998d3dc258c (patch) | |
tree | 0abe990af39f0d4664e40ed63616f6dcc5f5ceee /bfd/libaout.h | |
parent | ed9c0d48e0c7b822ab384e8d29d18ff60e7fd3ff (diff) | |
download | gdb-69ebee8678d423ef9b0eb88e0f74f998d3dc258c.zip gdb-69ebee8678d423ef9b0eb88e0f74f998d3dc258c.tar.gz gdb-69ebee8678d423ef9b0eb88e0f74f998d3dc258c.tar.bz2 |
Split up a.out handlers into generic and target-specific.
Remove close_and_cleanup. Lint.
Diffstat (limited to 'bfd/libaout.h')
-rw-r--r-- | bfd/libaout.h | 105 |
1 files changed, 77 insertions, 28 deletions
diff --git a/bfd/libaout.h b/bfd/libaout.h index 35d795b..304af5c 100644 --- a/bfd/libaout.h +++ b/bfd/libaout.h @@ -1,3 +1,9 @@ +/* BFD back-end data structures for a.out (and similar) files. + + We try to encapsulate the differences in a few routines, and otherwise + share large masses of code. This means we only have to fix bugs in + one place, most of the time. */ + /* Copyright (C) 1990, 1991 Free Software Foundation, Inc. This file is part of BFD, the Binary File Diddler. @@ -18,33 +24,24 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /* $Id$ */ -/* BFD back-end data structures for a.out (and similar) files. - - We try to encapsulate the differences in a few routines, and otherwise - share large masses of code. This means we only have to fix bugs in - one place, most of the time. */ - -/** a.out files */ - -#define exec_hdr(bfd) (((struct sunexdata *) ((bfd)->tdata))->hdr) -/*#define obj_symbols(bfd) ((((struct sunexdata *) ((bfd)->tdata))->symbols))*/ -#define obj_textsec(bfd) (((struct sunexdata *) ((bfd)->tdata))->textsec) -#define obj_datasec(bfd) (((struct sunexdata *) ((bfd)->tdata))->datasec) -#define obj_bsssec(bfd) (((struct sunexdata *) ((bfd)->tdata))->bsssec) -#define obj_sym_filepos(bfd) (((struct sunexdata *) ((bfd)->tdata))->sym_filepos) -#define obj_str_filepos(bfd) (((struct sunexdata *) ((bfd)->tdata))->str_filepos) - +#define adata(bfd) ((struct aoutdata *) ((bfd)->tdata)) +#define exec_hdr(bfd) (adata(bfd)->hdr) +#define obj_textsec(bfd) (adata(bfd)->textsec) +#define obj_datasec(bfd) (adata(bfd)->datasec) +#define obj_bsssec(bfd) (adata(bfd)->bsssec) +#define obj_sym_filepos(bfd) (adata(bfd)->sym_filepos) +#define obj_str_filepos(bfd) (adata(bfd)->str_filepos) +#define obj_reloc_entry_size(bfd) (adata(bfd)->reloc_entry_size) -typedef struct { +typedef struct aout_symbol { asymbol symbol; short desc; -char other; -unsigned char type; + char other; + unsigned char type; } aout_symbol_type; - -struct sunexdata { +struct aoutdata { struct exec *hdr; /* exec file header */ aout_symbol_type *symbols; /* symtab for input bfd */ @@ -58,19 +55,71 @@ struct sunexdata { no dependencies on the particular format of the exec_hdr. */ file_ptr sym_filepos; file_ptr str_filepos; -}; + /* Size of a relocation entry */ + unsigned reloc_entry_size; +}; -#define obj_outsymbols(bfd) ((PTR)(((struct sunexdata *) ((bfd)->tdata))->outsymbols)) +#define obj_outsymbols(bfd) ((PTR)(((struct aoutdata *) ((bfd)->tdata))->outsymbols)) /* We take the address of the first element of an asymbol to ensure that the * macro is only ever applied to an asymbol */ #define aout_symbol(asymbol) ((aout_symbol_type *)(&(asymbol)->the_bfd)) -/*#define obj_symbols(bfd) ((((struct sunexdata *) ((bfd)->tdata))->symbols))*/ -#define obj_aout_symbols(bfd) ((((struct sunexdata *) (bfd)->tdata))->symbols) -#define obj_arch_flags(bfd) ((((struct sunexdata *) (bfd)->tdata))->arch_flags) - -#define get_tdata(x) ((struct sunexdata *)((x)->tdata)) +/*#define obj_symbols(bfd) ((((struct aoutdata *) ((bfd)->tdata))->symbols))*/ +#define obj_aout_symbols(bfd) ((((struct aoutdata *) (bfd)->tdata))->symbols) +#define obj_arch_flags(bfd) ((((struct aoutdata *) (bfd)->tdata))->arch_flags) + +#define get_tdata(x) ((struct aoutdata *)((x)->tdata)) + +/* Prototype declarations for functions defined in aout.c. */ + +PROTO (boolean, aout_squirt_out_relocs,(bfd *abfd, asection *section)); + +PROTO (bfd_target *, some_aout_object_p, (bfd *abfd, + bfd_target *(*callback)())); +PROTO (boolean, aout_mkobject, (bfd *abfd)); +PROTO (enum machine_type, aout_machine_type, (enum bfd_architecture arch, + unsigned long machine)); +PROTO (boolean, aout_set_arch_mach, (bfd *abfd, enum bfd_architecture arch, + unsigned long machine)); + +PROTO (boolean, aout_new_section_hook, (bfd *abfd, asection *newsect)); +PROTO (boolean, aout_set_section_contents, (bfd *abfd, sec_ptr section, + PTR location, file_ptr offset, int count)); + +PROTO (asymbol *, aout_make_empty_symbol, (bfd *abfd)); +PROTO (boolean, aout_slurp_symbol_table, (bfd *abfd)); +PROTO (void, aout_write_syms, (bfd *abfd)); +PROTO (void, aout_reclaim_symbol_table, (bfd *abfd)); +PROTO (unsigned int, aout_get_symtab_upper_bound, (bfd *abfd)); +PROTO (unsigned int, aout_get_symtab, (bfd *abfd, asymbol **location)); +PROTO (boolean, aout_slurp_reloc_table, (bfd *abfd, sec_ptr asect, + asymbol **symbols)); +PROTO (unsigned int, aout_canonicalize_reloc, (bfd *abfd, sec_ptr section, + arelent **relptr, asymbol **symbols)); +PROTO (unsigned int, aout_get_reloc_upper_bound, (bfd *abfd, sec_ptr asect)); +PROTO (void, aout_reclaim_reloc, (bfd *ignore_abfd, sec_ptr ignore)); +PROTO (alent *, aout_get_lineno, (bfd *ignore_abfd, asymbol *ignore_symbol)); +PROTO (void, aout_print_symbol, (bfd *ignore_abfd, PTR file, + asymbol *symbol, bfd_print_symbol_enum_type how)); +PROTO (boolean, aout_close_and_cleanup, (bfd *abfd)); +PROTO (boolean, aout_find_nearest_line, (bfd *abfd, asection *section, + asymbol **symbols, bfd_vma offset, CONST char **filename_ptr, + CONST char **functionname_ptr, unsigned int *line_ptr)); +PROTO (int, aout_sizeof_headers, (bfd *ignore_abfd)); + +/* Helper routines in aout.c. */ + +PROTO (void, bfd_aout_swap_exec_header_in, (bfd *abfd, + unsigned char *raw_bytes, struct exec *execp)); + +PROTO (void, bfd_aout_swap_exec_header_out,(bfd *abfd, struct exec *execp, + unsigned char *raw_bytes)); + +/* A.out uses the generic versions of these routines... */ + +#define aout_get_section_contents bfd_generic_get_section_contents +#define aout_close_and_cleanup bfd_generic_close_and_cleanup |