aboutsummaryrefslogtreecommitdiff
path: root/bfd/libcoff.h
blob: f43927213d42ac2b00e9ebc4d80d21a873249c9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* 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)
#if CFILE_STUFF
#define obj_symbol_slew(bfd)	(obj_icof(bfd)->symbol_index_slew)
#else
#define obj_symbol_slew(bfd) 0
#endif
#define obj_string_table(bfd)	(obj_icof(bfd)->string_table)

typedef struct {
  asymbol symbol;
  struct internal_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 internal_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 *));