Commit | Line | Data |
---|---|---|
3c8a3c56 JG |
1 | /* BFD COFF object file private structure. |
2 | Copyright (C) 1990-1991 Free Software Foundation, Inc. | |
3 | Written by Cygnus Support. | |
4a81b561 | 4 | |
3c8a3c56 | 5 | This file is part of BFD, the Binary File Descriptor library. |
4a81b561 | 6 | |
3c8a3c56 | 7 | This program is free software; you can redistribute it and/or modify |
4a81b561 | 8 | it under the terms of the GNU General Public License as published by |
3c8a3c56 JG |
9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | |
4a81b561 | 11 | |
3c8a3c56 | 12 | This program is distributed in the hope that it will be useful, |
4a81b561 DHW |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
3c8a3c56 JG |
18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
4a81b561 | 20 | |
4a81b561 | 21 | |
4a81b561 DHW |
22 | /* Object file tdata; access macros */ |
23 | ||
2f8640fe | 24 | #define coff_data(bfd) ((bfd)->tdata.coff_obj_data) |
3b4f1a5d SC |
25 | #define exec_hdr(bfd) (coff_data(bfd)->hdr) |
26 | #define obj_symbols(bfd) (coff_data(bfd)->symbols) | |
27 | #define obj_sym_filepos(bfd) (coff_data(bfd)->sym_filepos) | |
3c8a3c56 | 28 | |
3b4f1a5d SC |
29 | #define obj_relocbase(bfd) (coff_data(bfd)->relocbase) |
30 | #define obj_raw_syments(bfd) (coff_data(bfd)->raw_syments) | |
31 | #define obj_convert(bfd) (coff_data(bfd)->conversion_table) | |
07de8e96 | 32 | #define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size) |
0cda46cf SC |
33 | #if CFILE_STUFF |
34 | #define obj_symbol_slew(bfd) (coff_data(bfd)->symbol_index_slew) | |
35 | #else | |
36 | #define obj_symbol_slew(bfd) 0 | |
37 | #endif | |
38 | ||
4a81b561 | 39 | |
3b4f1a5d | 40 | /* `Tdata' information kept for COFF files. */ |
3c8a3c56 | 41 | |
3b4f1a5d SC |
42 | typedef struct coff_tdata |
43 | { | |
44 | struct coff_symbol_struct *symbols; /* symtab for input bfd */ | |
4a81b561 | 45 | unsigned int *conversion_table; |
07de8e96 | 46 | int conv_table_size; |
4a81b561 DHW |
47 | file_ptr sym_filepos; |
48 | ||
49 | long symbol_index_slew; /* used during read to mark whether a | |
50 | C_FILE symbol as been added. */ | |
51 | ||
3b4f1a5d | 52 | struct coff_ptr_struct *raw_syments; |
4a81b561 DHW |
53 | struct lineno *raw_linenos; |
54 | unsigned int raw_syment_count; | |
9872a49c | 55 | unsigned short flags; |
3b4f1a5d | 56 | |
4a81b561 DHW |
57 | /* These are only valid once writing has begun */ |
58 | long int relocbase; | |
3b4f1a5d SC |
59 | |
60 | /* These members communicate important constants about the symbol table | |
61 | to GDB's symbol-reading code. These `constants' unfortunately vary | |
62 | from coff implementation to implementation... */ | |
63 | unsigned local_n_btmask; | |
64 | unsigned local_n_btshft; | |
65 | unsigned local_n_tmask; | |
66 | unsigned local_n_tshift; | |
67 | unsigned local_symesz; | |
68 | unsigned local_auxesz; | |
69 | unsigned local_linesz; | |
9872a49c | 70 | } coff_data_type; |
4a81b561 | 71 | |
fc723380 | 72 | /* We take the address of the first element of a asymbol to ensure that the |
4a81b561 DHW |
73 | * macro is only ever applied to an asymbol. */ |
74 | #define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd))) | |
fc723380 JG |
75 | |
76 | ||
3c8a3c56 | 77 | |
616ebcfd | 78 | /* And more taken from the source .. */ |
3c8a3c56 | 79 | |
2f8640fe | 80 | typedef struct coff_ptr_struct |
0cda46cf | 81 | { |
616ebcfd SC |
82 | |
83 | /* Remembers the offset from the first symbol in the file for | |
84 | this symbol. Generated by coff_renumber_symbols. */ | |
0cda46cf | 85 | unsigned int offset; |
616ebcfd SC |
86 | |
87 | /* Should the tag field of this symbol be renumbered. | |
88 | Created by coff_pointerize_aux. */ | |
0cda46cf | 89 | char fix_tag; |
616ebcfd SC |
90 | |
91 | /* Should the endidx field of this symbol be renumbered. | |
92 | Created by coff_pointerize_aux. */ | |
0cda46cf | 93 | char fix_end; |
616ebcfd SC |
94 | |
95 | /* The container for the symbol structure as read and translated | |
96 | from the file. */ | |
97 | ||
0cda46cf SC |
98 | union { |
99 | union internal_auxent auxent; | |
100 | struct internal_syment syment; | |
101 | } u; | |
102 | } combined_entry_type; | |
616ebcfd SC |
103 | |
104 | ||
105 | /* Each canonical asymbol really looks like this: */ | |
106 | ||
0cda46cf SC |
107 | typedef struct coff_symbol_struct |
108 | { | |
07de8e96 KR |
109 | /* The actual symbol which the rest of BFD works with */ |
110 | asymbol symbol; | |
616ebcfd | 111 | |
07de8e96 KR |
112 | /* A pointer to the hidden information for this symbol */ |
113 | combined_entry_type *native; | |
c618de01 | 114 | |
07de8e96 KR |
115 | /* A pointer to the linenumber information for this symbol */ |
116 | struct lineno_cache_entry *lineno; | |
117 | ||
118 | /* Have the line numbers been relocated yet ? */ | |
119 | boolean done_lineno; | |
616ebcfd | 120 | } coff_symbol_type; |
07de8e96 KR |
121 | typedef struct { |
122 | void (*_bfd_coff_swap_aux_in) PARAMS (( | |
123 | bfd *abfd , | |
124 | PTR ext, | |
125 | int type, | |
126 | int class , | |
127 | PTR in)); | |
128 | ||
129 | void (*_bfd_coff_swap_sym_in) PARAMS (( | |
130 | bfd *abfd , | |
131 | PTR ext, | |
132 | PTR in)); | |
133 | ||
134 | void (*_bfd_coff_swap_lineno_in) PARAMS (( | |
135 | bfd *abfd, | |
136 | PTR ext, | |
137 | PTR in)); | |
138 | ||
139 | unsigned int (*_bfd_coff_swap_aux_out) PARAMS (( | |
140 | bfd *abfd, | |
141 | PTR in, | |
142 | int type, | |
143 | int class, | |
144 | PTR ext)); | |
145 | ||
146 | unsigned int (*_bfd_coff_swap_sym_out) PARAMS (( | |
147 | bfd *abfd, | |
148 | PTR in, | |
149 | PTR ext)); | |
150 | ||
151 | unsigned int (*_bfd_coff_swap_lineno_out) PARAMS (( | |
152 | bfd *abfd, | |
153 | PTR in, | |
154 | PTR ext)); | |
155 | ||
156 | unsigned int (*_bfd_coff_swap_reloc_out) PARAMS (( | |
157 | bfd *abfd, | |
158 | PTR src, | |
159 | PTR dst)); | |
160 | ||
161 | unsigned int (*_bfd_coff_swap_filehdr_out) PARAMS (( | |
162 | bfd *abfd, | |
163 | PTR in, | |
164 | PTR out)); | |
165 | ||
166 | unsigned int (*_bfd_coff_swap_aouthdr_out) PARAMS (( | |
167 | bfd *abfd, | |
168 | PTR in, | |
169 | PTR out)); | |
170 | ||
171 | unsigned int (*_bfd_coff_swap_scnhdr_out) PARAMS (( | |
172 | bfd *abfd, | |
173 | PTR in, | |
174 | PTR out)); | |
175 | ||
176 | } bfd_coff_backend_data; | |
177 | ||
178 | extern bfd_coff_backend_data bfd_coff_std_swap_table; | |
179 | ||
180 | #define coff_backend_info(abfd) ((bfd_coff_backend_data *) (abfd)->xvec->backend_data) | |
181 | ||
182 | #define bfd_coff_swap_aux_in(a,e,t,c,i) \ | |
183 | ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,i)) | |
184 | ||
185 | #define bfd_coff_swap_sym_in(a,e,i) \ | |
186 | ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i)) | |
187 | ||
188 | #define bfd_coff_swap_lineno_in(a,e,i) \ | |
189 | ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i)) | |
190 | ||
191 | #define bfd_coff_swap_reloc_out(abfd, i, o) \ | |
192 | ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o)) | |
193 | ||
194 | #define bfd_coff_swap_lineno_out(abfd, i, o) \ | |
195 | ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o)) | |
196 | ||
197 | #define bfd_coff_swap_aux_out(abfd, i, t,c,o) \ | |
198 | ((coff_backend_info (abfd)->_bfd_coff_swap_aux_out) (abfd, i,t,c, o)) | |
199 | ||
200 | #define bfd_coff_swap_sym_out(abfd, i,o) \ | |
201 | ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o)) | |
202 | ||
203 | #define bfd_coff_swap_scnhdr_out(abfd, i,o) \ | |
204 | ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o)) | |
205 | ||
206 | #define bfd_coff_swap_filehdr_out(abfd, i,o) \ | |
207 | ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o)) | |
208 | ||
209 | #define bfd_coff_swap_aouthdr_out(abfd, i,o) \ | |
210 | ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o)) | |
211 |