1 |
/* BFD ECOFF object file private structure. |
/* BFD ECOFF object file private structure. |
2 |
Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002 |
Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002, 2003, 2004 |
3 |
Free Software Foundation, Inc. |
Free Software Foundation, Inc. |
4 |
Written by Ian Lance Taylor, Cygnus Support. |
Written by Ian Lance Taylor, Cygnus Support. |
5 |
|
|
44 |
/* The page boundary used to align sections in a demand-paged |
/* The page boundary used to align sections in a demand-paged |
45 |
executable file. E.g., 0x1000. */ |
executable file. E.g., 0x1000. */ |
46 |
bfd_vma round; |
bfd_vma round; |
47 |
/* True if the .rdata section is part of the text segment, as on the |
/* TRUE if the .rdata section is part of the text segment, as on the |
48 |
Alpha. False if .rdata is part of the data segment, as on the |
Alpha. FALSE if .rdata is part of the data segment, as on the |
49 |
MIPS. */ |
MIPS. */ |
50 |
boolean rdata_in_text; |
bfd_boolean rdata_in_text; |
51 |
/* Bitsize of constructor entries. */ |
/* Bitsize of constructor entries. */ |
52 |
unsigned int constructor_bitsize; |
unsigned int constructor_bitsize; |
53 |
/* Reloc to use for constructor entries. */ |
/* Reloc to use for constructor entries. */ |
60 |
void (*swap_reloc_in) PARAMS ((bfd *, PTR, struct internal_reloc *)); |
void (*swap_reloc_in) PARAMS ((bfd *, PTR, struct internal_reloc *)); |
61 |
void (*swap_reloc_out) PARAMS ((bfd *, const struct internal_reloc *, PTR)); |
void (*swap_reloc_out) PARAMS ((bfd *, const struct internal_reloc *, PTR)); |
62 |
/* Backend reloc tweaking. */ |
/* Backend reloc tweaking. */ |
63 |
void (*adjust_reloc_in) PARAMS ((bfd *, const struct internal_reloc *, |
void (*adjust_reloc_in) |
64 |
arelent *)); |
PARAMS ((bfd *, const struct internal_reloc *, arelent *)); |
65 |
void (*adjust_reloc_out) PARAMS ((bfd *, const arelent *, |
void (*adjust_reloc_out) |
66 |
struct internal_reloc *)); |
PARAMS ((bfd *, const arelent *, struct internal_reloc *)); |
67 |
/* Relocate section contents while linking. */ |
/* Relocate section contents while linking. */ |
68 |
boolean (*relocate_section) PARAMS ((bfd *output_bfd, struct bfd_link_info *, |
bfd_boolean (*relocate_section) |
69 |
bfd *input_bfd, asection *input_section, |
PARAMS ((bfd *output_bfd, struct bfd_link_info *, bfd *input_bfd, |
70 |
bfd_byte *contents, |
asection *input_section, bfd_byte *contents, |
71 |
PTR external_relocs)); |
PTR external_relocs)); |
72 |
/* Do final adjustments to filehdr and aouthdr. */ |
/* Do final adjustments to filehdr and aouthdr. */ |
73 |
boolean (*adjust_headers) PARAMS ((bfd *, struct internal_filehdr *, |
bfd_boolean (*adjust_headers) |
74 |
struct internal_aouthdr *)); |
PARAMS ((bfd *, struct internal_filehdr *, struct internal_aouthdr *)); |
75 |
/* Read an element from an archive at a given file position. This |
/* Read an element from an archive at a given file position. This |
76 |
is needed because OSF/1 3.2 uses a weird archive format. */ |
is needed because OSF/1 3.2 uses a weird archive format. */ |
77 |
bfd *(*get_elt_at_filepos) PARAMS ((bfd *, file_ptr)); |
bfd *(*get_elt_at_filepos) PARAMS ((bfd *, file_ptr)); |
128 |
linking. */ |
linking. */ |
129 |
asection **symndx_to_section; |
asection **symndx_to_section; |
130 |
|
|
131 |
/* True if this BFD was written by the backend linker. */ |
/* TRUE if this BFD was written by the backend linker. */ |
132 |
boolean linker; |
bfd_boolean linker; |
133 |
|
|
134 |
/* True if a warning that multiple global pointer values are |
/* TRUE if a warning that multiple global pointer values are |
135 |
needed in the output binary was issued already. */ |
needed in the output binary was issued already. */ |
136 |
boolean issued_multiple_gp_warning; |
bfd_boolean issued_multiple_gp_warning; |
137 |
|
|
138 |
/* Used by find_nearest_line entry point. The structure could be |
/* Used by find_nearest_line entry point. The structure could be |
139 |
included directly in this one, but there's no point to wasting |
included directly in this one, but there's no point to wasting |
143 |
/* Whether the .rdata section is in the text segment for this |
/* Whether the .rdata section is in the text segment for this |
144 |
particular ECOFF file. This is not valid until |
particular ECOFF file. This is not valid until |
145 |
ecoff_compute_section_file_positions is called. */ |
ecoff_compute_section_file_positions is called. */ |
146 |
boolean rdata_in_text; |
bfd_boolean rdata_in_text; |
147 |
|
|
148 |
} ecoff_data_type; |
} ecoff_data_type; |
149 |
|
|
157 |
/* The fdr for this symbol. */ |
/* The fdr for this symbol. */ |
158 |
FDR *fdr; |
FDR *fdr; |
159 |
|
|
160 |
/* true if this is a local symbol rather than an external one. */ |
/* TRUE if this is a local symbol rather than an external one. */ |
161 |
boolean local; |
bfd_boolean local; |
162 |
|
|
163 |
/* A pointer to the unswapped hidden information for this symbol. |
/* A pointer to the unswapped hidden information for this symbol. |
164 |
This is either a struct sym_ext or a struct ext_ext, depending on |
This is either a struct sym_ext or a struct ext_ext, depending on |
176 |
#define ecoff_get_sym_index(symbol) ((symbol)->udata.i) |
#define ecoff_get_sym_index(symbol) ((symbol)->udata.i) |
177 |
#define ecoff_set_sym_index(symbol, idx) ((symbol)->udata.i = (idx)) |
#define ecoff_set_sym_index(symbol, idx) ((symbol)->udata.i = (idx)) |
178 |
|
|
179 |
/* When generating MIPS embedded PIC code, the linker relaxes the code |
/* A pointer to this structure is put in the used_by_bfd pointer of |
180 |
to turn PC relative branches into longer code sequences when the PC |
a section to keep track of any per-section data. |
181 |
relative branch is out of range. This involves reading the relocs |
The user_by_bfd pointer will be NULL if the information was not |
182 |
in bfd_relax_section as well as in bfd_final_link, and requires the |
needed. */ |
|
code to keep track of which relocs have been expanded. A pointer |
|
|
to this structure is put in the used_by_bfd pointer of a section to |
|
|
keep track of this information. The user_by_bfd pointer will be |
|
|
NULL if the information was not needed. */ |
|
183 |
|
|
184 |
struct ecoff_section_tdata |
struct ecoff_section_tdata |
185 |
{ |
{ |
|
/* The unswapped relocs for this section. These are stored in |
|
|
memory so the input file does not have to be read twice. */ |
|
|
PTR external_relocs; |
|
|
|
|
|
/* The contents of the section. These bytes may or may not be saved |
|
|
in memory, but if it is this is a pointer to them. */ |
|
|
bfd_byte *contents; |
|
|
|
|
|
/* Offset adjustments for PC relative branches. A number other than |
|
|
1 is an addend for a PC relative branch, or a switch table entry |
|
|
which is the difference of two .text locations; this addend |
|
|
arises because the branch or difference crosses one or more |
|
|
branches which were expanded into a larger code sequence. A 1 |
|
|
means that this branch was itself expanded into a larger code |
|
|
sequence. 1 is not a possible offset, since all offsets must be |
|
|
multiples of the instruction size, which is 4; also, the only |
|
|
relocs with non-zero offsets will be PC relative branches or |
|
|
switch table entries within the same object file. If this field |
|
|
is NULL, no branches were expanded and no offsets are required. |
|
|
Otherwise there are as many entries as there are relocs in the |
|
|
section, and the entry for any reloc that is not PC relative is |
|
|
zero. */ |
|
|
long *offsets; |
|
|
|
|
186 |
/* When producing an executable (i.e., final, non-relocatable link) |
/* When producing an executable (i.e., final, non-relocatable link) |
187 |
on the Alpha, we may need to use multiple global pointer values |
on the Alpha, we may need to use multiple global pointer values |
188 |
to span the entire .lita section. In essence, we allow each |
to span the entire .lita section. In essence, we allow each |
221 |
}; |
}; |
222 |
|
|
223 |
/* Make an ECOFF object. */ |
/* Make an ECOFF object. */ |
224 |
extern boolean _bfd_ecoff_mkobject PARAMS ((bfd *)); |
extern bfd_boolean _bfd_ecoff_mkobject PARAMS ((bfd *)); |
225 |
|
|
226 |
/* Read in the ECOFF symbolic debugging information. */ |
/* Read in the ECOFF symbolic debugging information. */ |
227 |
extern boolean _bfd_ecoff_slurp_symbolic_info |
extern bfd_boolean _bfd_ecoff_slurp_symbolic_info |
228 |
PARAMS ((bfd *, asection *, struct ecoff_debug_info *)); |
PARAMS ((bfd *, asection *, struct ecoff_debug_info *)); |
229 |
|
|
230 |
/* Generic ECOFF BFD backend vectors. */ |
/* Generic ECOFF BFD backend vectors. */ |
231 |
|
|
232 |
extern boolean _bfd_ecoff_write_object_contents PARAMS ((bfd *abfd)); |
extern bfd_boolean _bfd_ecoff_write_object_contents PARAMS ((bfd *abfd)); |
233 |
extern const bfd_target *_bfd_ecoff_archive_p PARAMS ((bfd *abfd)); |
extern const bfd_target *_bfd_ecoff_archive_p PARAMS ((bfd *abfd)); |
234 |
|
|
235 |
#define _bfd_ecoff_close_and_cleanup _bfd_generic_close_and_cleanup |
#define _bfd_ecoff_close_and_cleanup _bfd_generic_close_and_cleanup |
236 |
#define _bfd_ecoff_bfd_free_cached_info _bfd_generic_bfd_free_cached_info |
#define _bfd_ecoff_bfd_free_cached_info _bfd_generic_bfd_free_cached_info |
237 |
extern boolean _bfd_ecoff_new_section_hook |
extern bfd_boolean _bfd_ecoff_new_section_hook |
238 |
PARAMS ((bfd *, asection *)); |
PARAMS ((bfd *, asection *)); |
239 |
extern boolean _bfd_ecoff_get_section_contents |
extern bfd_boolean _bfd_ecoff_get_section_contents |
240 |
PARAMS ((bfd *, asection *, PTR location, file_ptr, bfd_size_type)); |
PARAMS ((bfd *, asection *, PTR location, file_ptr, bfd_size_type)); |
241 |
|
|
242 |
#define _bfd_ecoff_bfd_link_split_section _bfd_generic_link_split_section |
#define _bfd_ecoff_bfd_link_split_section _bfd_generic_link_split_section |
243 |
|
|
244 |
extern boolean _bfd_ecoff_bfd_copy_private_bfd_data PARAMS ((bfd *, bfd *)); |
extern bfd_boolean _bfd_ecoff_bfd_copy_private_bfd_data |
245 |
|
PARAMS ((bfd *, bfd *)); |
246 |
#define _bfd_ecoff_bfd_copy_private_section_data \ |
#define _bfd_ecoff_bfd_copy_private_section_data \ |
247 |
_bfd_generic_bfd_copy_private_section_data |
_bfd_generic_bfd_copy_private_section_data |
248 |
|
|
249 |
#define _bfd_ecoff_bfd_copy_private_symbol_data \ |
#define _bfd_ecoff_bfd_copy_private_symbol_data \ |
250 |
_bfd_generic_bfd_copy_private_symbol_data |
_bfd_generic_bfd_copy_private_symbol_data |
251 |
|
|
252 |
|
#define _bfd_ecoff_bfd_copy_private_header_data \ |
253 |
|
_bfd_generic_bfd_copy_private_header_data |
254 |
|
|
255 |
#define _bfd_ecoff_bfd_print_private_bfd_data \ |
#define _bfd_ecoff_bfd_print_private_bfd_data \ |
256 |
_bfd_generic_bfd_print_private_bfd_data |
_bfd_generic_bfd_print_private_bfd_data |
257 |
|
|
259 |
_bfd_generic_bfd_merge_private_bfd_data |
_bfd_generic_bfd_merge_private_bfd_data |
260 |
|
|
261 |
#define _bfd_ecoff_bfd_set_private_flags _bfd_generic_bfd_set_private_flags |
#define _bfd_ecoff_bfd_set_private_flags _bfd_generic_bfd_set_private_flags |
262 |
extern boolean _bfd_ecoff_slurp_armap PARAMS ((bfd *abfd)); |
extern bfd_boolean _bfd_ecoff_slurp_armap PARAMS ((bfd *abfd)); |
263 |
#define _bfd_ecoff_slurp_extended_name_table _bfd_slurp_extended_name_table |
#define _bfd_ecoff_slurp_extended_name_table _bfd_slurp_extended_name_table |
264 |
#define _bfd_ecoff_construct_extended_name_table \ |
#define _bfd_ecoff_construct_extended_name_table \ |
265 |
_bfd_archive_bsd_construct_extended_name_table |
_bfd_archive_bsd_construct_extended_name_table |
266 |
#define _bfd_ecoff_truncate_arname bfd_dont_truncate_arname |
#define _bfd_ecoff_truncate_arname bfd_dont_truncate_arname |
267 |
extern boolean _bfd_ecoff_write_armap |
extern bfd_boolean _bfd_ecoff_write_armap |
268 |
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); |
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); |
269 |
#define _bfd_ecoff_read_ar_hdr _bfd_generic_read_ar_hdr |
#define _bfd_ecoff_read_ar_hdr _bfd_generic_read_ar_hdr |
270 |
#define _bfd_ecoff_openr_next_archived_file \ |
#define _bfd_ecoff_openr_next_archived_file \ |
272 |
#define _bfd_ecoff_get_elt_at_index _bfd_generic_get_elt_at_index |
#define _bfd_ecoff_get_elt_at_index _bfd_generic_get_elt_at_index |
273 |
#define _bfd_ecoff_generic_stat_arch_elt bfd_generic_stat_arch_elt |
#define _bfd_ecoff_generic_stat_arch_elt bfd_generic_stat_arch_elt |
274 |
#define _bfd_ecoff_update_armap_timestamp bfd_true |
#define _bfd_ecoff_update_armap_timestamp bfd_true |
275 |
|
#define _bfd_ecoff_bfd_is_target_special_symbol \ |
276 |
|
((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) |
277 |
|
|
278 |
extern long _bfd_ecoff_get_symtab_upper_bound PARAMS ((bfd *abfd)); |
extern long _bfd_ecoff_get_symtab_upper_bound PARAMS ((bfd *abfd)); |
279 |
extern long _bfd_ecoff_get_symtab PARAMS ((bfd *abfd, asymbol **alocation)); |
extern long _bfd_ecoff_canonicalize_symtab PARAMS ((bfd *abfd, asymbol **alocation)); |
280 |
extern asymbol *_bfd_ecoff_make_empty_symbol PARAMS ((bfd *abfd)); |
extern asymbol *_bfd_ecoff_make_empty_symbol PARAMS ((bfd *abfd)); |
281 |
extern void _bfd_ecoff_print_symbol |
extern void _bfd_ecoff_print_symbol |
282 |
PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type)); |
PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type)); |
283 |
extern void _bfd_ecoff_get_symbol_info |
extern void _bfd_ecoff_get_symbol_info |
284 |
PARAMS ((bfd *, asymbol *, symbol_info *)); |
PARAMS ((bfd *, asymbol *, symbol_info *)); |
285 |
extern boolean _bfd_ecoff_bfd_is_local_label_name |
extern bfd_boolean _bfd_ecoff_bfd_is_local_label_name |
286 |
PARAMS ((bfd *, const char *)); |
PARAMS ((bfd *, const char *)); |
287 |
#define _bfd_ecoff_get_lineno _bfd_nosymbols_get_lineno |
#define _bfd_ecoff_get_lineno _bfd_nosymbols_get_lineno |
288 |
extern boolean _bfd_ecoff_find_nearest_line |
extern bfd_boolean _bfd_ecoff_find_nearest_line |
289 |
PARAMS ((bfd *, asection *, asymbol **, bfd_vma offset, |
PARAMS ((bfd *, asection *, asymbol **, bfd_vma offset, |
290 |
const char **filename_ptr, const char **fnname_ptr, |
const char **filename_ptr, const char **fnname_ptr, |
291 |
unsigned int *retline_ptr)); |
unsigned int *retline_ptr)); |
298 |
PARAMS ((bfd *, asection *, arelent **, asymbol **symbols)); |
PARAMS ((bfd *, asection *, arelent **, asymbol **symbols)); |
299 |
/* ecoff_bfd_reloc_type_lookup defined by backend. */ |
/* ecoff_bfd_reloc_type_lookup defined by backend. */ |
300 |
|
|
301 |
extern boolean _bfd_ecoff_set_arch_mach |
extern bfd_boolean _bfd_ecoff_set_arch_mach |
302 |
PARAMS ((bfd *, enum bfd_architecture, unsigned long)); |
PARAMS ((bfd *, enum bfd_architecture, unsigned long)); |
303 |
extern boolean _bfd_ecoff_set_section_contents |
extern bfd_boolean _bfd_ecoff_set_section_contents |
304 |
PARAMS ((bfd *, asection *, PTR location, file_ptr, bfd_size_type)); |
PARAMS ((bfd *, asection *, const PTR location, file_ptr, bfd_size_type)); |
305 |
|
|
306 |
extern int _bfd_ecoff_sizeof_headers PARAMS ((bfd *abfd, boolean reloc)); |
extern int _bfd_ecoff_sizeof_headers PARAMS ((bfd *abfd, bfd_boolean reloc)); |
307 |
/* ecoff_bfd_get_relocated_section_contents defined by backend. */ |
/* ecoff_bfd_get_relocated_section_contents defined by backend. */ |
308 |
/* ecoff_bfd_relax_section defined by backend. */ |
/* ecoff_bfd_relax_section defined by backend. */ |
309 |
extern struct bfd_link_hash_table *_bfd_ecoff_bfd_link_hash_table_create |
extern struct bfd_link_hash_table *_bfd_ecoff_bfd_link_hash_table_create |
310 |
PARAMS ((bfd *)); |
PARAMS ((bfd *)); |
311 |
#define _bfd_ecoff_bfd_link_hash_table_free _bfd_generic_link_hash_table_free |
#define _bfd_ecoff_bfd_link_hash_table_free _bfd_generic_link_hash_table_free |
312 |
extern boolean _bfd_ecoff_bfd_link_add_symbols |
extern bfd_boolean _bfd_ecoff_bfd_link_add_symbols |
313 |
PARAMS ((bfd *, struct bfd_link_info *)); |
PARAMS ((bfd *, struct bfd_link_info *)); |
314 |
#define _bfd_ecoff_bfd_link_just_syms _bfd_generic_link_just_syms |
#define _bfd_ecoff_bfd_link_just_syms _bfd_generic_link_just_syms |
315 |
extern boolean _bfd_ecoff_bfd_final_link |
extern bfd_boolean _bfd_ecoff_bfd_final_link |
316 |
PARAMS ((bfd *, struct bfd_link_info *)); |
PARAMS ((bfd *, struct bfd_link_info *)); |
317 |
|
|
318 |
/* Hook functions for the generic COFF section reading code. */ |
/* Hook functions for the generic COFF section reading code. */ |
320 |
extern PTR _bfd_ecoff_mkobject_hook PARAMS ((bfd *, PTR filehdr, PTR aouthdr)); |
extern PTR _bfd_ecoff_mkobject_hook PARAMS ((bfd *, PTR filehdr, PTR aouthdr)); |
321 |
#define _bfd_ecoff_set_alignment_hook \ |
#define _bfd_ecoff_set_alignment_hook \ |
322 |
((void (*) PARAMS ((bfd *, asection *, PTR))) bfd_void) |
((void (*) PARAMS ((bfd *, asection *, PTR))) bfd_void) |
323 |
extern boolean _bfd_ecoff_set_arch_mach_hook PARAMS ((bfd *abfd, PTR filehdr)); |
extern bfd_boolean _bfd_ecoff_set_arch_mach_hook |
324 |
extern boolean _bfd_ecoff_styp_to_sec_flags |
PARAMS ((bfd *abfd, PTR filehdr)); |
325 |
|
extern bfd_boolean _bfd_ecoff_styp_to_sec_flags |
326 |
PARAMS ((bfd *, PTR, const char *, asection *, flagword *)); |
PARAMS ((bfd *, PTR, const char *, asection *, flagword *)); |
327 |
extern boolean _bfd_ecoff_slurp_symbol_table PARAMS ((bfd *abfd)); |
extern bfd_boolean _bfd_ecoff_slurp_symbol_table PARAMS ((bfd *abfd)); |
328 |
|
|
329 |
/* ECOFF auxiliary information swapping routines. These are the same |
/* ECOFF auxiliary information swapping routines. These are the same |
330 |
for all ECOFF targets, so they are defined in ecofflink.c. */ |
for all ECOFF targets, so they are defined in ecofflink.c. */ |