fc7233808a
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.
76 lines
2.6 KiB
C
76 lines
2.6 KiB
C
/* Copyright (C) 1990, 1991 Free Software Foundation, Inc.
|
|
|
|
This file is part of BFD, the Binary File Diddler.
|
|
|
|
BFD is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 1, or (at your option)
|
|
any later version.
|
|
|
|
BFD is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with BFD; see the file COPYING. If not, write to
|
|
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)
|
|
|
|
|
|
|
|
typedef struct {
|
|
asymbol symbol;
|
|
short desc;
|
|
char other;
|
|
unsigned char type;
|
|
} aout_symbol_type;
|
|
|
|
|
|
struct sunexdata {
|
|
struct exec *hdr; /* exec file header */
|
|
aout_symbol_type *symbols; /* symtab for input bfd */
|
|
|
|
|
|
/* For ease, we do this */
|
|
asection *textsec;
|
|
asection *datasec;
|
|
asection *bsssec;
|
|
|
|
/* We remember these offsets so that after check_file_format, we have
|
|
no dependencies on the particular format of the exec_hdr. */
|
|
file_ptr sym_filepos;
|
|
file_ptr str_filepos;
|
|
};
|
|
|
|
|
|
#define obj_outsymbols(bfd) ((PTR)(((struct sunexdata *) ((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))
|