1 /* BFD COFF object file private structure.
2 Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
3 Written by Cygnus Support.
5 This file is part of BFD, the Binary File Descriptor library.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
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.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
23 /* Object file tdata; access macros */
25 #define coff_data(bfd) ((bfd)->tdata.coff_obj_data)
26 #define exec_hdr(bfd) (coff_data(bfd)->hdr)
27 #define obj_symbols(bfd) (coff_data(bfd)->symbols)
28 #define obj_sym_filepos(bfd) (coff_data(bfd)->sym_filepos)
30 #define obj_relocbase(bfd) (coff_data(bfd)->relocbase)
31 #define obj_raw_syments(bfd) (coff_data(bfd)->raw_syments)
32 #define obj_raw_syment_count(bfd) (coff_data(bfd)->raw_syment_count)
33 #define obj_convert(bfd) (coff_data(bfd)->conversion_table)
34 #define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size)
36 #define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms)
37 #define obj_coff_strings(bfd) (coff_data (bfd)->strings)
38 #define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes)
40 /* `Tdata' information kept for COFF files. */
42 typedef struct coff_tdata
44 struct coff_symbol_struct
*symbols
; /* symtab for input bfd */
45 unsigned int *conversion_table
;
49 struct coff_ptr_struct
*raw_syments
;
50 unsigned int raw_syment_count
;
52 /* These are only valid once writing has begun */
55 /* These members communicate important constants about the symbol table
56 to GDB's symbol-reading code. These `constants' unfortunately vary
57 from coff implementation to implementation... */
58 unsigned local_n_btmask
;
59 unsigned local_n_btshft
;
60 unsigned local_n_tmask
;
61 unsigned local_n_tshift
;
62 unsigned local_symesz
;
63 unsigned local_auxesz
;
64 unsigned local_linesz
;
66 /* Used by the COFF backend linker. */
69 struct coff_link_hash_entry
**sym_hashes
;
72 /* We take the address of the first element of a asymbol to ensure that the
73 * macro is only ever applied to an asymbol. */
74 #define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd)))
76 /* COFF linker hash table entries. */
78 struct coff_link_hash_entry
80 struct bfd_link_hash_entry root
;
82 /* Symbol index in output file. Set to -1 initially. Set to -2 if
83 there is a reloc against this symbol. */
92 /* Number of auxiliary entries. */
95 /* BFD to take auxiliary entries from. */
98 /* Pointer to array of auxiliary entries, if any. */
99 union internal_auxent
*aux
;
102 /* COFF linker hash table. */
104 struct coff_link_hash_table
106 struct bfd_link_hash_table root
;
109 /* Look up an entry in a COFF linker hash table. */
111 #define coff_link_hash_lookup(table, string, create, copy, follow) \
112 ((struct coff_link_hash_entry *) \
113 bfd_link_hash_lookup (&(table)->root, (string), (create), \
116 /* Traverse a COFF linker hash table. */
118 #define coff_link_hash_traverse(table, func, info) \
119 (bfd_link_hash_traverse \
121 (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
124 /* Get the COFF linker hash table from a link_info structure. */
126 #define coff_hash_table(p) ((struct coff_link_hash_table *) ((p)->hash))
128 /* Functions in coffgen.c. */
129 extern const bfd_target
*coff_object_p
PARAMS ((bfd
*));
130 extern struct sec
*coff_section_from_bfd_index
PARAMS ((bfd
*, int));
131 extern long coff_get_symtab_upper_bound
PARAMS ((bfd
*));
132 extern long coff_get_symtab
PARAMS ((bfd
*, asymbol
**));
133 extern int coff_count_linenumbers
PARAMS ((bfd
*));
134 extern struct coff_symbol_struct
*coff_symbol_from
PARAMS ((bfd
*, asymbol
*));
135 extern boolean coff_renumber_symbols
PARAMS ((bfd
*));
136 extern void coff_mangle_symbols
PARAMS ((bfd
*));
137 extern boolean coff_write_symbols
PARAMS ((bfd
*));
138 extern boolean coff_write_linenumbers
PARAMS ((bfd
*));
139 extern alent
*coff_get_lineno
PARAMS ((bfd
*, asymbol
*));
140 extern asymbol
*coff_section_symbol
PARAMS ((bfd
*, char *));
141 extern struct coff_ptr_struct
*coff_get_normalized_symtab
PARAMS ((bfd
*));
142 extern long coff_get_reloc_upper_bound
PARAMS ((bfd
*, sec_ptr
));
143 extern asymbol
*coff_make_empty_symbol
PARAMS ((bfd
*));
144 extern void coff_print_symbol
PARAMS ((bfd
*, PTR filep
, asymbol
*,
145 bfd_print_symbol_type how
));
146 extern void coff_get_symbol_info
PARAMS ((bfd
*, asymbol
*,
148 extern asymbol
*coff_bfd_make_debug_symbol
PARAMS ((bfd
*, PTR
,
150 extern boolean coff_find_nearest_line
PARAMS ((bfd
*,
154 CONST
char **filename_ptr
,
155 CONST
char **functionname_ptr
,
156 unsigned int *line_ptr
));
157 extern int coff_sizeof_headers
PARAMS ((bfd
*, boolean reloc
));
158 extern boolean bfd_coff_reloc16_relax_section
159 PARAMS ((bfd
*, asection
*, struct bfd_link_info
*, boolean
*));
160 extern bfd_byte
*bfd_coff_reloc16_get_relocated_section_contents
161 PARAMS ((bfd
*, struct bfd_link_info
*, struct bfd_link_order
*,
162 bfd_byte
*, boolean relocateable
, asymbol
**));
163 extern bfd_vma bfd_coff_reloc16_get_value
PARAMS ((arelent
*,
164 struct bfd_link_info
*,
166 extern void bfd_perform_slip
PARAMS ((bfd
*abfd
, unsigned int slip
,
167 asection
*input_section
,
170 /* Functions in cofflink.c. */
172 extern struct bfd_link_hash_table
*_bfd_coff_link_hash_table_create
174 extern boolean _bfd_coff_link_add_symbols
175 PARAMS ((bfd
*, struct bfd_link_info
*));
176 extern boolean _bfd_coff_final_link
177 PARAMS ((bfd
*, struct bfd_link_info
*));
179 /* And more taken from the source .. */