aboutsummaryrefslogtreecommitdiff
path: root/bfd/libcoff.h
blob: a29b9c2ad6acbc3f46af7edeb94a8b03eb6bb0b6 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/* BFD COFF object file private structure.
   Copyright (C) 1990-1991 Free Software Foundation, Inc.
   Written by Cygnus Support.

This file is part of BFD, the Binary File Descriptor library.

This program 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 2 of the License, or
(at your option) any later version.

This program 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 this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */

/* $Id$ */

/* 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)

#if 0
typedef struct coff_ptr_struct
{
  unsigned int offset;
  char fix_tag;
  char fix_end;
  union {
    union internal_auxent auxent;
    struct internal_syment syment;
  } u;
} combined_entry_type;


typedef struct 
{
  asymbol symbol;
  combined_entry_type *native;
  struct lineno_cache_entry *lineno;
} coff_symbol_type;
#endif

typedef struct icofdata 
{

struct   coff_symbol_struct *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 coff_ptr_struct *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)))



/*THE FOLLOWING IS EXTRACTED FROM THE SOURCE*/

/* FROM coffcode.h*/
/* ------------------------------START FROM coffcode.h

The hidden information for an asymbol is:
*/

 typedef struct coff_ptr_struct
 {

/*
Remembers the offset from the first symbol in the file for this
symbol. Generated by @code{coff_renumber_symbols}.
*/

   unsigned int offset;

/*
Should the tag field of this symbol be renumbered.
Created by @code{coff_pointerize_aux}.
*/

   char fix_tag;

/*
Should the endidx field of this symbol be renumbered.
Created by @code{coff_pointerize_aux}.
*/

   char fix_end;

/*
The container for the symbol structure as read and translated from the file.
*/

   union {
     union internal_auxent auxent;
     struct internal_syment syment;
   } u;
 } combined_entry_type;

/*

Each canonical asymbol really looks like this:
*/

 typedef struct coff_symbol_struct
 {

/*
The actual symbol which the rest of BFD works with
*/

   asymbol symbol;

/*
A pointer to the hidden information for this symbol
*/

   combined_entry_type *native;

/*
A pointer to the linenumber information for this symbol
*/

   struct lineno_cache_entry *lineno;
 } coff_symbol_type;

/*

 --------------------------------END FROM coffcode.h*/