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.
71 lines
2.4 KiB
C
71 lines
2.4 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 COFF object file private structure. */
|
|
|
|
/* Object file tdata; access macros */
|
|
|
|
#define obj_icof(bfd) ((struct icofdata *) ((bfd)->tdata))
|
|
#define coff_data(bfd) ((struct icofdata *) ((bfd)->tdata))
|
|
#define exec_hdr(bfd) (obj_icof(bfd)->hdr)
|
|
#define obj_symbols(bfd) (obj_icof(bfd)->symbols)
|
|
#define obj_sym_filepos(bfd) (obj_icof(bfd)->sym_filepos)
|
|
|
|
#define obj_relocbase(bfd) (obj_icof(bfd)->relocbase)
|
|
#define obj_raw_syments(bfd) (obj_icof(bfd)->raw_syments)
|
|
#define obj_convert(bfd) (obj_icof(bfd)->conversion_table)
|
|
#define obj_symbol_slew(bfd) (obj_icof(bfd)->symbol_index_slew)
|
|
#define obj_string_table(bfd) (obj_icof(bfd)->string_table)
|
|
|
|
typedef struct {
|
|
asymbol symbol;
|
|
struct syment *native;
|
|
struct lineno_cache_entry *lineno;
|
|
} coff_symbol_type;
|
|
|
|
typedef struct icofdata
|
|
{
|
|
struct aouthdr hdr; /* exec file header */
|
|
coff_symbol_type *symbols; /* symtab for input bfd */
|
|
unsigned int *conversion_table;
|
|
file_ptr sym_filepos;
|
|
|
|
long symbol_index_slew; /* used during read to mark whether a
|
|
C_FILE symbol as been added. */
|
|
|
|
struct syment *raw_syments;
|
|
struct lineno *raw_linenos;
|
|
unsigned int raw_syment_count;
|
|
char *string_table;
|
|
unsigned short flags;
|
|
/* These are only valid once writing has begun */
|
|
long int relocbase;
|
|
} coff_data_type;
|
|
|
|
/* We take the address of the first element of a asymbol to ensure that the
|
|
* macro is only ever applied to an asymbol. */
|
|
#define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd)))
|
|
|
|
|
|
/* Generic COFF swapping routines -- also used by GDB. */
|
|
PROTO (void, bfd_coff_swap_sym, (bfd *, SYMENT *));
|
|
PROTO (void, bfd_coff_swap_aux, (bfd *, AUXENT *, int, int));
|
|
PROTO (void, bfd_coff_swap_lineno, (bfd *, LINENO *));
|