1 |
/* BFD COFF object file private structure. |
/* BFD COFF object file private structure. |
2 |
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
3 |
2000, 2001, 2002 |
2000, 2001, 2002, 2003, 2004 |
4 |
Free Software Foundation, Inc. |
Free Software Foundation, Inc. |
5 |
Written by Cygnus Support. |
Written by Cygnus Support. |
6 |
|
|
74 |
/* The unswapped external symbols. May be NULL. Read by |
/* The unswapped external symbols. May be NULL. Read by |
75 |
_bfd_coff_get_external_symbols. */ |
_bfd_coff_get_external_symbols. */ |
76 |
PTR external_syms; |
PTR external_syms; |
77 |
/* If this is true, the external_syms may not be freed. */ |
/* If this is TRUE, the external_syms may not be freed. */ |
78 |
boolean keep_syms; |
bfd_boolean keep_syms; |
79 |
|
|
80 |
/* The string table. May be NULL. Read by |
/* The string table. May be NULL. Read by |
81 |
_bfd_coff_read_string_table. */ |
_bfd_coff_read_string_table. */ |
82 |
char *strings; |
char *strings; |
83 |
/* If this is true, the strings may not be freed. */ |
/* If this is TRUE, the strings may not be freed. */ |
84 |
boolean keep_strings; |
bfd_boolean keep_strings; |
85 |
/* If this is true, the strings have been written out already. */ |
/* If this is TRUE, the strings have been written out already. */ |
86 |
boolean strings_written; |
bfd_boolean strings_written; |
87 |
|
|
88 |
/* is this a PE format coff file */ |
/* is this a PE format coff file */ |
89 |
int pe; |
int pe; |
117 |
struct internal_extra_pe_aouthdr pe_opthdr; |
struct internal_extra_pe_aouthdr pe_opthdr; |
118 |
int dll; |
int dll; |
119 |
int has_reloc_section; |
int has_reloc_section; |
120 |
boolean (*in_reloc_p) PARAMS((bfd *, reloc_howto_type *)); |
bfd_boolean (*in_reloc_p) PARAMS((bfd *, reloc_howto_type *)); |
121 |
flagword real_flags; |
flagword real_flags; |
122 |
int target_subsystem; |
int target_subsystem; |
123 |
boolean force_minimum_alignment; |
bfd_boolean force_minimum_alignment; |
124 |
} pe_data_type; |
} pe_data_type; |
125 |
|
|
126 |
#define pe_data(bfd) ((bfd)->tdata.pe_obj_data) |
#define pe_data(bfd) ((bfd)->tdata.pe_obj_data) |
132 |
/* Basic COFF information. */ |
/* Basic COFF information. */ |
133 |
coff_data_type coff; |
coff_data_type coff; |
134 |
|
|
135 |
/* True if this is an XCOFF64 file. */ |
/* TRUE if this is an XCOFF64 file. */ |
136 |
boolean xcoff64; |
bfd_boolean xcoff64; |
137 |
|
|
138 |
/* True if a large a.out header should be generated. */ |
/* TRUE if a large a.out header should be generated. */ |
139 |
boolean full_aouthdr; |
bfd_boolean full_aouthdr; |
140 |
|
|
141 |
/* TOC value. */ |
/* TOC value. */ |
142 |
bfd_vma toc; |
bfd_vma toc; |
184 |
{ |
{ |
185 |
/* The relocs, swapped into COFF internal form. This may be NULL. */ |
/* The relocs, swapped into COFF internal form. This may be NULL. */ |
186 |
struct internal_reloc *relocs; |
struct internal_reloc *relocs; |
187 |
/* If this is true, the relocs entry may not be freed. */ |
/* If this is TRUE, the relocs entry may not be freed. */ |
188 |
boolean keep_relocs; |
bfd_boolean keep_relocs; |
189 |
/* The section contents. This may be NULL. */ |
/* The section contents. This may be NULL. */ |
190 |
bfd_byte *contents; |
bfd_byte *contents; |
191 |
/* If this is true, the contents entry may not be freed. */ |
/* If this is TRUE, the contents entry may not be freed. */ |
192 |
boolean keep_contents; |
bfd_boolean keep_contents; |
193 |
/* Information cached by coff_find_nearest_line. */ |
/* Information cached by coff_find_nearest_line. */ |
194 |
bfd_vma offset; |
bfd_vma offset; |
195 |
unsigned int i; |
unsigned int i; |
196 |
const char *function; |
const char *function; |
197 |
|
/* Optional information about a COMDAT entry; NULL if not COMDAT. */ |
198 |
|
struct coff_comdat_info *comdat; |
199 |
int line_base; |
int line_base; |
200 |
/* A pointer used for .stab linking optimizations. */ |
/* A pointer used for .stab linking optimizations. */ |
201 |
PTR stab_info; |
PTR stab_info; |
278 |
{ |
{ |
279 |
struct bfd_link_hash_table root; |
struct bfd_link_hash_table root; |
280 |
/* A pointer to information used to link stabs in sections. */ |
/* A pointer to information used to link stabs in sections. */ |
281 |
PTR stab_info; |
struct stab_info stab_info; |
282 |
}; |
}; |
283 |
|
|
284 |
/* Look up an entry in a COFF linker hash table. */ |
/* Look up an entry in a COFF linker hash table. */ |
293 |
#define coff_link_hash_traverse(table, func, info) \ |
#define coff_link_hash_traverse(table, func, info) \ |
294 |
(bfd_link_hash_traverse \ |
(bfd_link_hash_traverse \ |
295 |
(&(table)->root, \ |
(&(table)->root, \ |
296 |
(boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \ |
(bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \ |
297 |
(info))) |
(info))) |
298 |
|
|
299 |
/* Get the COFF linker hash table from a link_info structure. */ |
/* Get the COFF linker hash table from a link_info structure. */ |
303 |
/* Functions in coffgen.c. */ |
/* Functions in coffgen.c. */ |
304 |
extern const bfd_target *coff_object_p |
extern const bfd_target *coff_object_p |
305 |
PARAMS ((bfd *)); |
PARAMS ((bfd *)); |
306 |
extern struct sec *coff_section_from_bfd_index |
extern struct bfd_section *coff_section_from_bfd_index |
307 |
PARAMS ((bfd *, int)); |
PARAMS ((bfd *, int)); |
308 |
extern long coff_get_symtab_upper_bound |
extern long coff_get_symtab_upper_bound |
309 |
PARAMS ((bfd *)); |
PARAMS ((bfd *)); |
310 |
extern long coff_get_symtab |
extern long coff_canonicalize_symtab |
311 |
PARAMS ((bfd *, asymbol **)); |
PARAMS ((bfd *, asymbol **)); |
312 |
extern int coff_count_linenumbers |
extern int coff_count_linenumbers |
313 |
PARAMS ((bfd *)); |
PARAMS ((bfd *)); |
314 |
extern struct coff_symbol_struct *coff_symbol_from |
extern struct coff_symbol_struct *coff_symbol_from |
315 |
PARAMS ((bfd *, asymbol *)); |
PARAMS ((bfd *, asymbol *)); |
316 |
extern boolean coff_renumber_symbols |
extern bfd_boolean coff_renumber_symbols |
317 |
PARAMS ((bfd *, int *)); |
PARAMS ((bfd *, int *)); |
318 |
extern void coff_mangle_symbols |
extern void coff_mangle_symbols |
319 |
PARAMS ((bfd *)); |
PARAMS ((bfd *)); |
320 |
extern boolean coff_write_symbols |
extern bfd_boolean coff_write_symbols |
321 |
PARAMS ((bfd *)); |
PARAMS ((bfd *)); |
322 |
extern boolean coff_write_linenumbers |
extern bfd_boolean coff_write_linenumbers |
323 |
PARAMS ((bfd *)); |
PARAMS ((bfd *)); |
324 |
extern alent *coff_get_lineno |
extern alent *coff_get_lineno |
325 |
PARAMS ((bfd *, asymbol *)); |
PARAMS ((bfd *, asymbol *)); |
326 |
extern asymbol *coff_section_symbol |
extern asymbol *coff_section_symbol |
327 |
PARAMS ((bfd *, char *)); |
PARAMS ((bfd *, char *)); |
328 |
extern boolean _bfd_coff_get_external_symbols |
extern bfd_boolean _bfd_coff_get_external_symbols |
329 |
PARAMS ((bfd *)); |
PARAMS ((bfd *)); |
330 |
extern const char *_bfd_coff_read_string_table |
extern const char *_bfd_coff_read_string_table |
331 |
PARAMS ((bfd *)); |
PARAMS ((bfd *)); |
332 |
extern boolean _bfd_coff_free_symbols |
extern bfd_boolean _bfd_coff_free_symbols |
333 |
PARAMS ((bfd *)); |
PARAMS ((bfd *)); |
334 |
extern struct coff_ptr_struct *coff_get_normalized_symtab |
extern struct coff_ptr_struct *coff_get_normalized_symtab |
335 |
PARAMS ((bfd *)); |
PARAMS ((bfd *)); |
341 |
PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type)); |
PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type)); |
342 |
extern void coff_get_symbol_info |
extern void coff_get_symbol_info |
343 |
PARAMS ((bfd *, asymbol *, symbol_info *ret)); |
PARAMS ((bfd *, asymbol *, symbol_info *ret)); |
344 |
extern boolean _bfd_coff_is_local_label_name |
extern bfd_boolean _bfd_coff_is_local_label_name |
345 |
PARAMS ((bfd *, const char *)); |
PARAMS ((bfd *, const char *)); |
346 |
extern asymbol *coff_bfd_make_debug_symbol |
extern asymbol *coff_bfd_make_debug_symbol |
347 |
PARAMS ((bfd *, PTR, unsigned long)); |
PARAMS ((bfd *, PTR, unsigned long)); |
348 |
extern boolean coff_find_nearest_line |
extern bfd_boolean coff_find_nearest_line |
349 |
PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, |
PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, |
350 |
const char **, unsigned int *)); |
const char **, unsigned int *)); |
351 |
extern int coff_sizeof_headers |
extern int coff_sizeof_headers |
352 |
PARAMS ((bfd *, boolean)); |
PARAMS ((bfd *, bfd_boolean)); |
353 |
extern boolean bfd_coff_reloc16_relax_section |
extern bfd_boolean bfd_coff_reloc16_relax_section |
354 |
PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *)); |
PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); |
355 |
extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents |
extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents |
356 |
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, |
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, |
357 |
bfd_byte *, boolean, asymbol **)); |
bfd_byte *, bfd_boolean, asymbol **)); |
358 |
extern bfd_vma bfd_coff_reloc16_get_value |
extern bfd_vma bfd_coff_reloc16_get_value |
359 |
PARAMS ((arelent *, struct bfd_link_info *, asection *)); |
PARAMS ((arelent *, struct bfd_link_info *, asection *)); |
360 |
extern void bfd_perform_slip |
extern void bfd_perform_slip |
436 |
bfd_hash_lookup (&(table)->root, (string), (create), (copy))) |
bfd_hash_lookup (&(table)->root, (string), (create), (copy))) |
437 |
|
|
438 |
/* Information we keep for each section in the output file when doing |
/* Information we keep for each section in the output file when doing |
439 |
a relocateable link. */ |
a relocatable link. */ |
440 |
|
|
441 |
struct coff_link_section_info |
struct coff_link_section_info |
442 |
{ |
{ |
456 |
/* Output BFD. */ |
/* Output BFD. */ |
457 |
bfd *output_bfd; |
bfd *output_bfd; |
458 |
/* Used to indicate failure in traversal routine. */ |
/* Used to indicate failure in traversal routine. */ |
459 |
boolean failed; |
bfd_boolean failed; |
460 |
/* If doing "task linking" set only during the time when we want the |
/* If doing "task linking" set only during the time when we want the |
461 |
global symbol writer to convert the storage class of defined global |
global symbol writer to convert the storage class of defined global |
462 |
symbols from global to static. */ |
symbols from global to static. */ |
463 |
boolean global_to_static; |
bfd_boolean global_to_static; |
464 |
/* Hash table for long symbol names. */ |
/* Hash table for long symbol names. */ |
465 |
struct bfd_strtab_hash *strtab; |
struct bfd_strtab_hash *strtab; |
466 |
/* When doing a relocateable link, an array of information kept for |
/* When doing a relocatable link, an array of information kept for |
467 |
each output section, indexed by the target_index field. */ |
each output section, indexed by the target_index field. */ |
468 |
struct coff_link_section_info *section_info; |
struct coff_link_section_info *section_info; |
469 |
/* Symbol index of last C_FILE symbol (-1 if none). */ |
/* Symbol index of last C_FILE symbol (-1 if none). */ |
534 |
|
|
535 |
extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc |
extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc |
536 |
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); |
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); |
537 |
extern boolean _bfd_coff_link_hash_table_init |
extern bfd_boolean _bfd_coff_link_hash_table_init |
538 |
PARAMS ((struct coff_link_hash_table *, bfd *, |
PARAMS ((struct coff_link_hash_table *, bfd *, |
539 |
struct bfd_hash_entry *(*) (struct bfd_hash_entry *, |
struct bfd_hash_entry *(*) (struct bfd_hash_entry *, |
540 |
struct bfd_hash_table *, |
struct bfd_hash_table *, |
543 |
PARAMS ((bfd *)); |
PARAMS ((bfd *)); |
544 |
extern const char *_bfd_coff_internal_syment_name |
extern const char *_bfd_coff_internal_syment_name |
545 |
PARAMS ((bfd *, const struct internal_syment *, char *)); |
PARAMS ((bfd *, const struct internal_syment *, char *)); |
546 |
extern boolean _bfd_coff_link_add_symbols |
extern bfd_boolean _bfd_coff_link_add_symbols |
547 |
PARAMS ((bfd *, struct bfd_link_info *)); |
PARAMS ((bfd *, struct bfd_link_info *)); |
548 |
extern boolean _bfd_coff_final_link |
extern bfd_boolean _bfd_coff_final_link |
549 |
PARAMS ((bfd *, struct bfd_link_info *)); |
PARAMS ((bfd *, struct bfd_link_info *)); |
550 |
extern struct internal_reloc *_bfd_coff_read_internal_relocs |
extern struct internal_reloc *_bfd_coff_read_internal_relocs |
551 |
PARAMS ((bfd *, asection *, boolean, bfd_byte *, boolean, |
PARAMS ((bfd *, asection *, bfd_boolean, bfd_byte *, bfd_boolean, |
552 |
struct internal_reloc *)); |
struct internal_reloc *)); |
553 |
extern boolean _bfd_coff_generic_relocate_section |
extern bfd_boolean _bfd_coff_generic_relocate_section |
554 |
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, |
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, |
555 |
struct internal_reloc *, struct internal_syment *, asection **)); |
struct internal_reloc *, struct internal_syment *, asection **)); |
556 |
|
|
557 |
extern struct bfd_hash_entry *_bfd_coff_debug_merge_hash_newfunc |
extern struct bfd_hash_entry *_bfd_coff_debug_merge_hash_newfunc |
558 |
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); |
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); |
559 |
extern boolean _bfd_coff_write_global_sym |
extern bfd_boolean _bfd_coff_write_global_sym |
560 |
PARAMS ((struct coff_link_hash_entry *, PTR)); |
PARAMS ((struct coff_link_hash_entry *, PTR)); |
561 |
extern boolean _bfd_coff_write_task_globals |
extern bfd_boolean _bfd_coff_write_task_globals |
562 |
PARAMS ((struct coff_link_hash_entry *, PTR)); |
PARAMS ((struct coff_link_hash_entry *, PTR)); |
563 |
extern boolean _bfd_coff_link_input_bfd |
extern bfd_boolean _bfd_coff_link_input_bfd |
564 |
PARAMS ((struct coff_final_link_info *, bfd *)); |
PARAMS ((struct coff_final_link_info *, bfd *)); |
565 |
extern boolean _bfd_coff_reloc_link_order |
extern bfd_boolean _bfd_coff_reloc_link_order |
566 |
PARAMS ((bfd *, struct coff_final_link_info *, asection *, |
PARAMS ((bfd *, struct coff_final_link_info *, asection *, |
567 |
struct bfd_link_order *)); |
struct bfd_link_order *)); |
568 |
|
|
584 |
PARAMS ((bfd *)); |
PARAMS ((bfd *)); |
585 |
extern void _bfd_xcoff_bfd_link_hash_table_free |
extern void _bfd_xcoff_bfd_link_hash_table_free |
586 |
PARAMS ((struct bfd_link_hash_table *)); |
PARAMS ((struct bfd_link_hash_table *)); |
587 |
extern boolean _bfd_xcoff_bfd_link_add_symbols |
extern bfd_boolean _bfd_xcoff_bfd_link_add_symbols |
588 |
PARAMS ((bfd *, struct bfd_link_info *)); |
PARAMS ((bfd *, struct bfd_link_info *)); |
589 |
extern boolean _bfd_xcoff_bfd_final_link |
extern bfd_boolean _bfd_xcoff_bfd_final_link |
590 |
PARAMS ((bfd *, struct bfd_link_info *)); |
PARAMS ((bfd *, struct bfd_link_info *)); |
591 |
extern boolean _bfd_ppc_xcoff_relocate_section |
extern bfd_boolean _bfd_ppc_xcoff_relocate_section |
592 |
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, |
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, |
593 |
struct internal_reloc *, struct internal_syment *, asection **)); |
struct internal_reloc *, struct internal_syment *, asection **)); |
594 |
|
|
595 |
/* Functions in coff-ppc.c. FIXME: These are called be pe.em in the |
/* Functions in coff-ppc.c. FIXME: These are called be pe.em in the |
596 |
linker, and so should start with bfd and be declared in bfd.h. */ |
linker, and so should start with bfd and be declared in bfd.h. */ |
597 |
|
|
598 |
extern boolean ppc_allocate_toc_section |
extern bfd_boolean ppc_allocate_toc_section |
599 |
PARAMS ((struct bfd_link_info *)); |
PARAMS ((struct bfd_link_info *)); |
600 |
extern boolean ppc_process_before_allocation |
extern bfd_boolean ppc_process_before_allocation |
601 |
PARAMS ((bfd *, struct bfd_link_info *)); |
PARAMS ((bfd *, struct bfd_link_info *)); |
602 |
|
|