1 /* xSYM symbol-file support for BFD.
2 Copyright 1999, 2000, 2001, 2002, 2003
3 Free Software Foundation, Inc.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
26 #define bfd_sym_close_and_cleanup _bfd_generic_close_and_cleanup
27 #define bfd_sym_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
28 #define bfd_sym_new_section_hook _bfd_generic_new_section_hook
29 #define bfd_sym_bfd_is_local_label_name bfd_generic_is_local_label_name
30 #define bfd_sym_get_lineno _bfd_nosymbols_get_lineno
31 #define bfd_sym_find_nearest_line _bfd_nosymbols_find_nearest_line
32 #define bfd_sym_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
33 #define bfd_sym_read_minisymbols _bfd_generic_read_minisymbols
34 #define bfd_sym_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
35 #define bfd_sym_get_reloc_upper_bound _bfd_norelocs_get_reloc_upper_bound
36 #define bfd_sym_canonicalize_reloc _bfd_norelocs_canonicalize_reloc
37 #define bfd_sym_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
38 #define bfd_sym_set_arch_mach _bfd_generic_set_arch_mach
39 #define bfd_sym_get_section_contents _bfd_generic_get_section_contents
40 #define bfd_sym_set_section_contents _bfd_generic_set_section_contents
41 #define bfd_sym_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
42 #define bfd_sym_bfd_relax_section bfd_generic_relax_section
43 #define bfd_sym_bfd_gc_sections bfd_generic_gc_sections
44 #define bfd_sym_bfd_merge_sections bfd_generic_merge_sections
45 #define bfd_sym_bfd_discard_group bfd_generic_discard_group
46 #define bfd_sym_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
47 #define bfd_sym_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
48 #define bfd_sym_bfd_link_add_symbols _bfd_generic_link_add_symbols
49 #define bfd_sym_bfd_link_just_syms _bfd_generic_link_just_syms
50 #define bfd_sym_bfd_final_link _bfd_generic_final_link
51 #define bfd_sym_bfd_link_split_section _bfd_generic_link_split_section
52 #define bfd_sym_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
54 static int pstrcmp
PARAMS ((unsigned char *, unsigned char *));
55 static unsigned long compute_offset
56 PARAMS ((unsigned long, unsigned long, unsigned long, unsigned long));
58 extern const bfd_target sym_vec
;
68 clen
= (a
[0] > b
[0]) ? a
[0] : b
[0];
69 ret
= memcmp (a
+ 1, b
+ 1, clen
);
82 compute_offset (first_page
, page_size
, entry_size
, index
)
83 unsigned long first_page
;
84 unsigned long page_size
;
85 unsigned long entry_size
;
88 unsigned long entries_per_page
= page_size
/ entry_size
;
89 unsigned long page_number
= first_page
+ (index
/ entries_per_page
);
90 unsigned long page_offset
= (index
% entries_per_page
) * entry_size
;
92 return (page_number
* page_size
) + page_offset
;
96 bfd_sym_mkobject (abfd
)
97 bfd
*abfd ATTRIBUTE_UNUSED
;
103 bfd_sym_print_symbol (abfd
, afile
, symbol
, how
)
104 bfd
*abfd ATTRIBUTE_UNUSED
;
105 PTR afile ATTRIBUTE_UNUSED
;
106 asymbol
*symbol ATTRIBUTE_UNUSED
;
107 bfd_print_symbol_type how ATTRIBUTE_UNUSED
;
116 if (abfd
== NULL
|| abfd
->xvec
== NULL
)
119 return abfd
->xvec
== &sym_vec
;
123 bfd_sym_read_name_table (abfd
, dshb
)
125 bfd_sym_header_block
*dshb
;
129 size_t table_size
= dshb
->dshb_nte
.dti_page_count
* dshb
->dshb_page_size
;
130 size_t table_offset
= dshb
->dshb_nte
.dti_first_page
* dshb
->dshb_page_size
;
132 rstr
= (unsigned char *) bfd_alloc (abfd
, table_size
);
136 bfd_seek (abfd
, table_offset
, SEEK_SET
);
137 ret
= bfd_bread (rstr
, table_size
, abfd
);
138 if (ret
< 0 || (unsigned long) ret
!= table_size
)
140 bfd_release (abfd
, rstr
);
148 bfd_sym_parse_file_reference_v32 (buf
, len
, entry
)
151 bfd_sym_file_reference
*entry
;
153 BFD_ASSERT (len
== 6);
155 entry
->fref_frte_index
= bfd_getb16 (buf
);
156 entry
->fref_offset
= bfd_getb32 (buf
+ 2);
160 bfd_sym_parse_disk_table_v32 (buf
, len
, table
)
163 bfd_sym_table_info
*table
;
165 BFD_ASSERT (len
== 8);
167 table
->dti_first_page
= bfd_getb16 (buf
);
168 table
->dti_page_count
= bfd_getb16 (buf
+ 2);
169 table
->dti_object_count
= bfd_getb32 (buf
+ 4);
173 bfd_sym_parse_header_v32 (buf
, len
, header
)
176 bfd_sym_header_block
*header
;
178 BFD_ASSERT (len
== 154);
180 memcpy (header
->dshb_id
, buf
, 32);
181 header
->dshb_page_size
= bfd_getb16 (buf
+ 32);
182 header
->dshb_hash_page
= bfd_getb16 (buf
+ 34);
183 header
->dshb_root_mte
= bfd_getb16 (buf
+ 36);
184 header
->dshb_mod_date
= bfd_getb32 (buf
+ 38);
186 bfd_sym_parse_disk_table_v32 (buf
+ 42, 8, &header
->dshb_frte
);
187 bfd_sym_parse_disk_table_v32 (buf
+ 50, 8, &header
->dshb_rte
);
188 bfd_sym_parse_disk_table_v32 (buf
+ 58, 8, &header
->dshb_mte
);
189 bfd_sym_parse_disk_table_v32 (buf
+ 66, 8, &header
->dshb_cmte
);
190 bfd_sym_parse_disk_table_v32 (buf
+ 74, 8, &header
->dshb_cvte
);
191 bfd_sym_parse_disk_table_v32 (buf
+ 82, 8, &header
->dshb_csnte
);
192 bfd_sym_parse_disk_table_v32 (buf
+ 90, 8, &header
->dshb_clte
);
193 bfd_sym_parse_disk_table_v32 (buf
+ 98, 8, &header
->dshb_ctte
);
194 bfd_sym_parse_disk_table_v32 (buf
+ 106, 8, &header
->dshb_tte
);
195 bfd_sym_parse_disk_table_v32 (buf
+ 114, 8, &header
->dshb_nte
);
196 bfd_sym_parse_disk_table_v32 (buf
+ 122, 8, &header
->dshb_tinfo
);
197 bfd_sym_parse_disk_table_v32 (buf
+ 130, 8, &header
->dshb_fite
);
198 bfd_sym_parse_disk_table_v32 (buf
+ 138, 8, &header
->dshb_const
);
200 memcpy (&header
->dshb_file_creator
, buf
+ 146, 4);
201 memcpy (&header
->dshb_file_type
, buf
+ 150, 4);
205 bfd_sym_read_header_v32 (abfd
, header
)
207 bfd_sym_header_block
*header
;
209 unsigned char buf
[154];
212 ret
= bfd_bread (buf
, 154, abfd
);
216 bfd_sym_parse_header_v32 (buf
, 154, header
);
222 bfd_sym_read_header_v34 (abfd
, header
)
223 bfd
*abfd ATTRIBUTE_UNUSED
;
224 bfd_sym_header_block
*header ATTRIBUTE_UNUSED
;
230 bfd_sym_read_header (abfd
, header
, version
)
232 bfd_sym_header_block
*header
;
233 bfd_sym_version version
;
237 case BFD_SYM_VERSION_3_5
:
238 case BFD_SYM_VERSION_3_4
:
239 return bfd_sym_read_header_v34 (abfd
, header
);
240 case BFD_SYM_VERSION_3_3
:
241 case BFD_SYM_VERSION_3_2
:
242 return bfd_sym_read_header_v32 (abfd
, header
);
243 case BFD_SYM_VERSION_3_1
:
250 bfd_sym_read_version (abfd
, version
)
252 bfd_sym_version
*version
;
254 unsigned char version_string
[32];
257 ret
= bfd_bread (version_string
, sizeof (version_string
), abfd
);
258 if (ret
!= sizeof (version_string
))
261 if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_1
) == 0)
262 *version
= BFD_SYM_VERSION_3_1
;
263 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_2
) == 0)
264 *version
= BFD_SYM_VERSION_3_2
;
265 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_3
) == 0)
266 *version
= BFD_SYM_VERSION_3_3
;
267 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_4
) == 0)
268 *version
= BFD_SYM_VERSION_3_4
;
269 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_5
) == 0)
270 *version
= BFD_SYM_VERSION_3_5
;
278 bfd_sym_display_table_summary (f
, dti
, name
)
280 bfd_sym_table_info
*dti
;
283 fprintf (f
, "%-6s %13ld %13ld %13ld\n",
287 dti
->dti_object_count
);
291 bfd_sym_display_header (f
, dshb
)
293 bfd_sym_header_block
*dshb
;
295 fprintf (f
, " Version: %.*s\n", dshb
->dshb_id
[0], dshb
->dshb_id
+ 1);
296 fprintf (f
, " Page Size: 0x%x\n", dshb
->dshb_page_size
);
297 fprintf (f
, " Hash Page: %lu\n", dshb
->dshb_hash_page
);
298 fprintf (f
, " Root MTE: %lu\n", dshb
->dshb_root_mte
);
299 fprintf (f
, " Modification Date: ");
300 fprintf (f
, "[unimplemented]");
301 fprintf (f
, " (0x%lx)\n", dshb
->dshb_mod_date
);
303 fprintf (f
, " File Creator: %.4s Type: %.4s\n\n",
304 dshb
->dshb_file_creator
, dshb
->dshb_file_type
);
306 fprintf (f
, "Table Name First Page Page Count Object Count\n");
307 fprintf (f
, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
309 bfd_sym_display_table_summary (f
, &dshb
->dshb_nte
, "NTE");
310 bfd_sym_display_table_summary (f
, &dshb
->dshb_rte
, "RTE");
311 bfd_sym_display_table_summary (f
, &dshb
->dshb_mte
, "MTE");
312 bfd_sym_display_table_summary (f
, &dshb
->dshb_frte
, "FRTE");
313 bfd_sym_display_table_summary (f
, &dshb
->dshb_cmte
, "CMTE");
314 bfd_sym_display_table_summary (f
, &dshb
->dshb_cvte
, "CVTE");
315 bfd_sym_display_table_summary (f
, &dshb
->dshb_csnte
, "CSNTE");
316 bfd_sym_display_table_summary (f
, &dshb
->dshb_clte
, "CLTE");
317 bfd_sym_display_table_summary (f
, &dshb
->dshb_ctte
, "CTTE");
318 bfd_sym_display_table_summary (f
, &dshb
->dshb_tte
, "TTE");
319 bfd_sym_display_table_summary (f
, &dshb
->dshb_tinfo
, "TINFO");
320 bfd_sym_display_table_summary (f
, &dshb
->dshb_fite
, "FITE");
321 bfd_sym_display_table_summary (f
, &dshb
->dshb_const
, "CONST");
327 bfd_sym_parse_resources_table_entry_v32 (buf
, len
, entry
)
330 bfd_sym_resources_table_entry
*entry
;
332 BFD_ASSERT (len
== 18);
334 memcpy (&entry
->rte_res_type
, buf
, 4);
335 entry
->rte_res_number
= bfd_getb16 (buf
+ 4);
336 entry
->rte_nte_index
= bfd_getb32 (buf
+ 6);
337 entry
->rte_mte_first
= bfd_getb16 (buf
+ 10);
338 entry
->rte_mte_last
= bfd_getb16 (buf
+ 12);
339 entry
->rte_res_size
= bfd_getb32 (buf
+ 14);
343 bfd_sym_parse_modules_table_entry_v33 (buf
, len
, entry
)
346 bfd_sym_modules_table_entry
*entry
;
348 BFD_ASSERT (len
== 46);
350 entry
->mte_rte_index
= bfd_getb16 (buf
);
351 entry
->mte_res_offset
= bfd_getb32 (buf
+ 2);
352 entry
->mte_size
= bfd_getb32 (buf
+ 6);
353 entry
->mte_kind
= buf
[10];
354 entry
->mte_scope
= buf
[11];
355 entry
->mte_parent
= bfd_getb16 (buf
+ 12);
356 bfd_sym_parse_file_reference_v32 (buf
+ 14, 6, &entry
->mte_imp_fref
);
357 entry
->mte_imp_end
= bfd_getb32 (buf
+ 20);
358 entry
->mte_nte_index
= bfd_getb32 (buf
+ 24);
359 entry
->mte_cmte_index
= bfd_getb16 (buf
+ 28);
360 entry
->mte_cvte_index
= bfd_getb32 (buf
+ 30);
361 entry
->mte_clte_index
= bfd_getb16 (buf
+ 34);
362 entry
->mte_ctte_index
= bfd_getb16 (buf
+ 36);
363 entry
->mte_csnte_idx_1
= bfd_getb32 (buf
+ 38);
364 entry
->mte_csnte_idx_2
= bfd_getb32 (buf
+ 42);
368 bfd_sym_parse_file_references_table_entry_v32 (buf
, len
, entry
)
371 bfd_sym_file_references_table_entry
*entry
;
375 BFD_ASSERT (len
== 10);
377 memset (entry
, 0, sizeof (bfd_sym_file_references_table_entry
));
378 type
= bfd_getb16 (buf
);
382 case BFD_SYM_END_OF_LIST_3_2
:
383 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
386 case BFD_SYM_FILE_NAME_INDEX_3_2
:
387 entry
->filename
.type
= BFD_SYM_FILE_NAME_INDEX
;
388 entry
->filename
.nte_index
= bfd_getb32 (buf
+ 2);
389 entry
->filename
.mod_date
= bfd_getb32 (buf
+ 6);
393 entry
->entry
.mte_index
= type
;
394 entry
->entry
.file_offset
= bfd_getb32 (buf
+ 2);
399 bfd_sym_parse_contained_modules_table_entry_v32 (buf
, len
, entry
)
402 bfd_sym_contained_modules_table_entry
*entry
;
406 BFD_ASSERT (len
== 6);
408 memset (entry
, 0, sizeof (bfd_sym_contained_modules_table_entry
));
409 type
= bfd_getb16 (buf
);
413 case BFD_SYM_END_OF_LIST_3_2
:
414 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
418 entry
->entry
.mte_index
= type
;
419 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 2);
425 bfd_sym_parse_contained_variables_table_entry_v32 (buf
, len
, entry
)
428 bfd_sym_contained_variables_table_entry
*entry
;
432 BFD_ASSERT (len
== 26);
434 memset (entry
, 0, sizeof (bfd_sym_contained_variables_table_entry
));
435 type
= bfd_getb16 (buf
);
439 case BFD_SYM_END_OF_LIST_3_2
:
440 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
443 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
444 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
445 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
449 entry
->entry
.tte_index
= type
;
450 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 2);
451 entry
->entry
.file_delta
= bfd_getb16 (buf
+ 6);
452 entry
->entry
.scope
= buf
[8];
453 entry
->entry
.la_size
= buf
[9];
455 if (entry
->entry
.la_size
== BFD_SYM_CVTE_SCA
)
457 entry
->entry
.address
.scstruct
.sca_kind
= buf
[10];
458 entry
->entry
.address
.scstruct
.sca_class
= buf
[11];
459 entry
->entry
.address
.scstruct
.sca_offset
= bfd_getb32 (buf
+ 12);
461 else if (entry
->entry
.la_size
<= BFD_SYM_CVTE_SCA
)
463 memcpy (&entry
->entry
.address
.lastruct
.la
, buf
+ 10, BFD_SYM_CVTE_SCA
);
464 entry
->entry
.address
.lastruct
.la_kind
= buf
[23];
466 else if (entry
->entry
.la_size
== BFD_SYM_CVTE_BIG_LA
)
468 entry
->entry
.address
.biglastruct
.big_la
= bfd_getb32 (buf
+ 10);
469 entry
->entry
.address
.biglastruct
.big_la_kind
= buf
[12];
475 bfd_sym_parse_contained_statements_table_entry_v32 (buf
, len
, entry
)
478 bfd_sym_contained_statements_table_entry
*entry
;
482 BFD_ASSERT (len
== 8);
484 memset (entry
, 0, sizeof (bfd_sym_contained_statements_table_entry
));
485 type
= bfd_getb16 (buf
);
489 case BFD_SYM_END_OF_LIST_3_2
:
490 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
493 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
494 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
495 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
499 entry
->entry
.mte_index
= type
;
500 entry
->entry
.mte_offset
= bfd_getb16 (buf
+ 2);
501 entry
->entry
.file_delta
= bfd_getb32 (buf
+ 4);
507 bfd_sym_parse_contained_labels_table_entry_v32 (buf
, len
, entry
)
510 bfd_sym_contained_labels_table_entry
*entry
;
514 BFD_ASSERT (len
== 12);
516 memset (entry
, 0, sizeof (bfd_sym_contained_labels_table_entry
));
517 type
= bfd_getb16 (buf
);
521 case BFD_SYM_END_OF_LIST_3_2
:
522 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
525 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
526 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
527 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
531 entry
->entry
.mte_index
= type
;
532 entry
->entry
.mte_offset
= bfd_getb16 (buf
+ 2);
533 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 4);
534 entry
->entry
.file_delta
= bfd_getb16 (buf
+ 8);
535 entry
->entry
.scope
= bfd_getb16 (buf
+ 10);
541 bfd_sym_parse_type_table_entry_v32 (buf
, len
, entry
)
544 bfd_sym_type_table_entry
*entry
;
546 BFD_ASSERT (len
== 4);
548 *entry
= bfd_getb32 (buf
);
552 bfd_sym_fetch_resources_table_entry (abfd
, entry
, index
)
554 bfd_sym_resources_table_entry
*entry
;
557 void (*parser
) PARAMS ((unsigned char *, size_t,
558 bfd_sym_resources_table_entry
*));
559 unsigned long offset
;
560 unsigned long entry_size
;
561 unsigned char buf
[18];
562 bfd_sym_data_struct
*sdata
= NULL
;
565 BFD_ASSERT (bfd_sym_valid (abfd
));
566 sdata
= abfd
->tdata
.sym_data
;
571 switch (sdata
->version
)
573 case BFD_SYM_VERSION_3_5
:
574 case BFD_SYM_VERSION_3_4
:
577 case BFD_SYM_VERSION_3_3
:
578 case BFD_SYM_VERSION_3_2
:
580 parser
= bfd_sym_parse_resources_table_entry_v32
;
583 case BFD_SYM_VERSION_3_1
:
590 offset
= compute_offset (sdata
->header
.dshb_rte
.dti_first_page
,
591 sdata
->header
.dshb_page_size
,
594 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
596 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
599 (*parser
) (buf
, entry_size
, entry
);
605 bfd_sym_fetch_modules_table_entry (abfd
, entry
, index
)
607 bfd_sym_modules_table_entry
*entry
;
610 void (*parser
) PARAMS ((unsigned char *, size_t,
611 bfd_sym_modules_table_entry
*));
612 unsigned long offset
;
613 unsigned long entry_size
;
614 unsigned char buf
[46];
615 bfd_sym_data_struct
*sdata
= NULL
;
618 BFD_ASSERT (bfd_sym_valid (abfd
));
619 sdata
= abfd
->tdata
.sym_data
;
624 switch (sdata
->version
)
626 case BFD_SYM_VERSION_3_5
:
627 case BFD_SYM_VERSION_3_4
:
630 case BFD_SYM_VERSION_3_3
:
632 parser
= bfd_sym_parse_modules_table_entry_v33
;
635 case BFD_SYM_VERSION_3_2
:
636 case BFD_SYM_VERSION_3_1
:
643 offset
= compute_offset (sdata
->header
.dshb_mte
.dti_first_page
,
644 sdata
->header
.dshb_page_size
,
647 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
649 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
652 (*parser
) (buf
, entry_size
, entry
);
658 bfd_sym_fetch_file_references_table_entry (abfd
, entry
, index
)
660 bfd_sym_file_references_table_entry
*entry
;
663 void (*parser
) PARAMS ((unsigned char *, size_t,
664 bfd_sym_file_references_table_entry
*));
665 unsigned long offset
;
666 unsigned long entry_size
= 0;
667 unsigned char buf
[8];
668 bfd_sym_data_struct
*sdata
= NULL
;
671 BFD_ASSERT (bfd_sym_valid (abfd
));
672 sdata
= abfd
->tdata
.sym_data
;
677 switch (sdata
->version
)
679 case BFD_SYM_VERSION_3_3
:
680 case BFD_SYM_VERSION_3_2
:
682 parser
= bfd_sym_parse_file_references_table_entry_v32
;
685 case BFD_SYM_VERSION_3_5
:
686 case BFD_SYM_VERSION_3_4
:
687 case BFD_SYM_VERSION_3_1
:
695 offset
= compute_offset (sdata
->header
.dshb_frte
.dti_first_page
,
696 sdata
->header
.dshb_page_size
,
699 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
701 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
704 (*parser
) (buf
, entry_size
, entry
);
710 bfd_sym_fetch_contained_modules_table_entry (abfd
, entry
, index
)
712 bfd_sym_contained_modules_table_entry
*entry
;
715 void (*parser
) PARAMS ((unsigned char *, size_t,
716 bfd_sym_contained_modules_table_entry
*));
717 unsigned long offset
;
718 unsigned long entry_size
= 0;
719 unsigned char buf
[6];
720 bfd_sym_data_struct
*sdata
= NULL
;
723 BFD_ASSERT (bfd_sym_valid (abfd
));
724 sdata
= abfd
->tdata
.sym_data
;
729 switch (sdata
->version
)
731 case BFD_SYM_VERSION_3_3
:
732 case BFD_SYM_VERSION_3_2
:
734 parser
= bfd_sym_parse_contained_modules_table_entry_v32
;
737 case BFD_SYM_VERSION_3_5
:
738 case BFD_SYM_VERSION_3_4
:
739 case BFD_SYM_VERSION_3_1
:
747 offset
= compute_offset (sdata
->header
.dshb_cmte
.dti_first_page
,
748 sdata
->header
.dshb_page_size
,
751 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
753 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
756 (*parser
) (buf
, entry_size
, entry
);
762 bfd_sym_fetch_contained_variables_table_entry (abfd
, entry
, index
)
764 bfd_sym_contained_variables_table_entry
*entry
;
767 void (*parser
) PARAMS ((unsigned char *, size_t,
768 bfd_sym_contained_variables_table_entry
*));
769 unsigned long offset
;
770 unsigned long entry_size
= 0;
771 unsigned char buf
[26];
772 bfd_sym_data_struct
*sdata
= NULL
;
775 BFD_ASSERT (bfd_sym_valid (abfd
));
776 sdata
= abfd
->tdata
.sym_data
;
781 switch (sdata
->version
)
783 case BFD_SYM_VERSION_3_3
:
784 case BFD_SYM_VERSION_3_2
:
786 parser
= bfd_sym_parse_contained_variables_table_entry_v32
;
789 case BFD_SYM_VERSION_3_5
:
790 case BFD_SYM_VERSION_3_4
:
791 case BFD_SYM_VERSION_3_1
:
799 offset
= compute_offset (sdata
->header
.dshb_cvte
.dti_first_page
,
800 sdata
->header
.dshb_page_size
,
803 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
805 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
808 (*parser
) (buf
, entry_size
, entry
);
814 bfd_sym_fetch_contained_statements_table_entry (abfd
, entry
, index
)
816 bfd_sym_contained_statements_table_entry
*entry
;
819 void (*parser
) PARAMS ((unsigned char *, size_t,
820 bfd_sym_contained_statements_table_entry
*));
821 unsigned long offset
;
822 unsigned long entry_size
= 0;
823 unsigned char buf
[8];
824 bfd_sym_data_struct
*sdata
= NULL
;
827 BFD_ASSERT (bfd_sym_valid (abfd
));
828 sdata
= abfd
->tdata
.sym_data
;
833 switch (sdata
->version
)
835 case BFD_SYM_VERSION_3_3
:
836 case BFD_SYM_VERSION_3_2
:
838 parser
= bfd_sym_parse_contained_statements_table_entry_v32
;
841 case BFD_SYM_VERSION_3_5
:
842 case BFD_SYM_VERSION_3_4
:
843 case BFD_SYM_VERSION_3_1
:
851 offset
= compute_offset (sdata
->header
.dshb_csnte
.dti_first_page
,
852 sdata
->header
.dshb_page_size
,
855 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
857 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
860 (*parser
) (buf
, entry_size
, entry
);
866 bfd_sym_fetch_contained_labels_table_entry (abfd
, entry
, index
)
868 bfd_sym_contained_labels_table_entry
*entry
;
871 void (*parser
) PARAMS ((unsigned char *, size_t,
872 bfd_sym_contained_labels_table_entry
*));
873 unsigned long offset
;
874 unsigned long entry_size
= 0;
875 unsigned char buf
[12];
876 bfd_sym_data_struct
*sdata
= NULL
;
879 BFD_ASSERT (bfd_sym_valid (abfd
));
880 sdata
= abfd
->tdata
.sym_data
;
885 switch (sdata
->version
)
887 case BFD_SYM_VERSION_3_3
:
888 case BFD_SYM_VERSION_3_2
:
890 parser
= bfd_sym_parse_contained_labels_table_entry_v32
;
893 case BFD_SYM_VERSION_3_5
:
894 case BFD_SYM_VERSION_3_4
:
895 case BFD_SYM_VERSION_3_1
:
903 offset
= compute_offset (sdata
->header
.dshb_clte
.dti_first_page
,
904 sdata
->header
.dshb_page_size
,
907 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
909 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
912 (*parser
) (buf
, entry_size
, entry
);
918 bfd_sym_fetch_contained_types_table_entry (abfd
, entry
, index
)
920 bfd_sym_contained_types_table_entry
*entry
;
923 void (*parser
) PARAMS ((unsigned char *, size_t,
924 bfd_sym_contained_types_table_entry
*));
925 unsigned long offset
;
926 unsigned long entry_size
= 0;
927 unsigned char buf
[0];
928 bfd_sym_data_struct
*sdata
= NULL
;
931 BFD_ASSERT (bfd_sym_valid (abfd
));
932 sdata
= abfd
->tdata
.sym_data
;
937 switch (sdata
->version
)
939 case BFD_SYM_VERSION_3_3
:
940 case BFD_SYM_VERSION_3_2
:
945 case BFD_SYM_VERSION_3_5
:
946 case BFD_SYM_VERSION_3_4
:
947 case BFD_SYM_VERSION_3_1
:
955 offset
= compute_offset (sdata
->header
.dshb_ctte
.dti_first_page
,
956 sdata
->header
.dshb_page_size
,
959 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
961 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
964 (*parser
) (buf
, entry_size
, entry
);
970 bfd_sym_fetch_file_references_index_table_entry (abfd
, entry
, index
)
972 bfd_sym_file_references_index_table_entry
*entry
;
975 void (*parser
) PARAMS ((unsigned char *, size_t,
976 bfd_sym_file_references_index_table_entry
*));
977 unsigned long offset
;
978 unsigned long entry_size
= 0;
979 unsigned char buf
[0];
980 bfd_sym_data_struct
*sdata
= NULL
;
983 BFD_ASSERT (bfd_sym_valid (abfd
));
984 sdata
= abfd
->tdata
.sym_data
;
989 switch (sdata
->version
)
991 case BFD_SYM_VERSION_3_3
:
992 case BFD_SYM_VERSION_3_2
:
997 case BFD_SYM_VERSION_3_5
:
998 case BFD_SYM_VERSION_3_4
:
999 case BFD_SYM_VERSION_3_1
:
1007 offset
= compute_offset (sdata
->header
.dshb_fite
.dti_first_page
,
1008 sdata
->header
.dshb_page_size
,
1011 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1013 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1016 (*parser
) (buf
, entry_size
, entry
);
1022 bfd_sym_fetch_constant_pool_entry (abfd
, entry
, index
)
1024 bfd_sym_constant_pool_entry
*entry
;
1025 unsigned long index
;
1027 void (*parser
) PARAMS ((unsigned char *, size_t,
1028 bfd_sym_constant_pool_entry
*));
1029 unsigned long offset
;
1030 unsigned long entry_size
= 0;
1031 unsigned char buf
[0];
1032 bfd_sym_data_struct
*sdata
= NULL
;
1035 BFD_ASSERT (bfd_sym_valid (abfd
));
1036 sdata
= abfd
->tdata
.sym_data
;
1041 switch (sdata
->version
)
1043 case BFD_SYM_VERSION_3_3
:
1044 case BFD_SYM_VERSION_3_2
:
1049 case BFD_SYM_VERSION_3_5
:
1050 case BFD_SYM_VERSION_3_4
:
1051 case BFD_SYM_VERSION_3_1
:
1059 offset
= compute_offset (sdata
->header
.dshb_fite
.dti_first_page
,
1060 sdata
->header
.dshb_page_size
,
1063 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1065 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1068 (*parser
) (buf
, entry_size
, entry
);
1074 bfd_sym_fetch_type_table_entry (abfd
, entry
, index
)
1076 bfd_sym_type_table_entry
*entry
;
1077 unsigned long index
;
1079 void (*parser
) PARAMS ((unsigned char *, size_t,
1080 bfd_sym_type_table_entry
*));
1081 unsigned long offset
;
1082 unsigned long entry_size
= 0;
1083 unsigned char buf
[4];
1084 bfd_sym_data_struct
*sdata
= NULL
;
1087 BFD_ASSERT (bfd_sym_valid (abfd
));
1088 sdata
= abfd
->tdata
.sym_data
;
1090 switch (sdata
->version
)
1092 case BFD_SYM_VERSION_3_3
:
1093 case BFD_SYM_VERSION_3_2
:
1095 parser
= bfd_sym_parse_type_table_entry_v32
;
1098 case BFD_SYM_VERSION_3_5
:
1099 case BFD_SYM_VERSION_3_4
:
1100 case BFD_SYM_VERSION_3_1
:
1108 offset
= compute_offset (sdata
->header
.dshb_tte
.dti_first_page
,
1109 sdata
->header
.dshb_page_size
,
1112 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1114 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1117 (*parser
) (buf
, entry_size
, entry
);
1123 bfd_sym_fetch_type_information_table_entry (abfd
, entry
, offset
)
1125 bfd_sym_type_information_table_entry
*entry
;
1126 unsigned long offset
;
1128 unsigned char buf
[4];
1129 bfd_sym_data_struct
*sdata
= NULL
;
1131 BFD_ASSERT (bfd_sym_valid (abfd
));
1132 sdata
= abfd
->tdata
.sym_data
;
1137 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1140 if (bfd_bread (buf
, 4, abfd
) != 4)
1142 entry
->nte_index
= bfd_getb32 (buf
);
1144 if (bfd_bread (buf
, 2, abfd
) != 2)
1146 entry
->physical_size
= bfd_getb16 (buf
);
1148 if (entry
->physical_size
& 0x8000)
1150 if (bfd_bread (buf
, 4, abfd
) != 4)
1152 entry
->physical_size
&= 0x7fff;
1153 entry
->logical_size
= bfd_getb32 (buf
);
1154 entry
->offset
= offset
+ 10;
1158 if (bfd_bread (buf
, 2, abfd
) != 2)
1160 entry
->physical_size
&= 0x7fff;
1161 entry
->logical_size
= bfd_getb16 (buf
);
1162 entry
->offset
= offset
+ 8;
1169 bfd_sym_fetch_type_table_information (abfd
, entry
, index
)
1171 bfd_sym_type_information_table_entry
*entry
;
1172 unsigned long index
;
1174 bfd_sym_type_table_entry tindex
;
1175 bfd_sym_data_struct
*sdata
= NULL
;
1177 BFD_ASSERT (bfd_sym_valid (abfd
));
1178 sdata
= abfd
->tdata
.sym_data
;
1180 if (sdata
->header
.dshb_tte
.dti_object_count
<= 99)
1185 if (bfd_sym_fetch_type_table_entry (abfd
, &tindex
, index
- 100) < 0)
1187 if (bfd_sym_fetch_type_information_table_entry (abfd
, entry
, tindex
) < 0)
1193 const unsigned char *
1194 bfd_sym_symbol_name (abfd
, index
)
1196 unsigned long index
;
1198 bfd_sym_data_struct
*sdata
= NULL
;
1200 BFD_ASSERT (bfd_sym_valid (abfd
));
1201 sdata
= abfd
->tdata
.sym_data
;
1207 if ((index
/ sdata
->header
.dshb_page_size
)
1208 > sdata
->header
.dshb_nte
.dti_page_count
)
1209 return "\009[INVALID]";
1211 return (const unsigned char *) sdata
->name_table
+ index
;
1214 const unsigned char *
1215 bfd_sym_module_name (abfd
, index
)
1217 unsigned long index
;
1219 bfd_sym_modules_table_entry entry
;
1221 if (bfd_sym_fetch_modules_table_entry (abfd
, &entry
, index
) < 0)
1222 return "\011[INVALID]";
1224 return bfd_sym_symbol_name (abfd
, entry
.mte_nte_index
);
1228 bfd_sym_unparse_storage_kind (kind
)
1229 enum bfd_sym_storage_kind kind
;
1233 case BFD_SYM_STORAGE_KIND_LOCAL
: return "LOCAL";
1234 case BFD_SYM_STORAGE_KIND_VALUE
: return "VALUE";
1235 case BFD_SYM_STORAGE_KIND_REFERENCE
: return "REFERENCE";
1236 case BFD_SYM_STORAGE_KIND_WITH
: return "WITH";
1237 default: return "[UNKNOWN]";
1242 bfd_sym_unparse_storage_class (kind
)
1243 enum bfd_sym_storage_class kind
;
1247 case BFD_SYM_STORAGE_CLASS_REGISTER
: return "REGISTER";
1248 case BFD_SYM_STORAGE_CLASS_GLOBAL
: return "GLOBAL";
1249 case BFD_SYM_STORAGE_CLASS_FRAME_RELATIVE
: return "FRAME_RELATIVE";
1250 case BFD_SYM_STORAGE_CLASS_STACK_RELATIVE
: return "STACK_RELATIVE";
1251 case BFD_SYM_STORAGE_CLASS_ABSOLUTE
: return "ABSOLUTE";
1252 case BFD_SYM_STORAGE_CLASS_CONSTANT
: return "CONSTANT";
1253 case BFD_SYM_STORAGE_CLASS_RESOURCE
: return "RESOURCE";
1254 case BFD_SYM_STORAGE_CLASS_BIGCONSTANT
: return "BIGCONSTANT";
1255 default: return "[UNKNOWN]";
1260 bfd_sym_unparse_module_kind (kind
)
1261 enum bfd_sym_module_kind kind
;
1265 case BFD_SYM_MODULE_KIND_NONE
: return "NONE";
1266 case BFD_SYM_MODULE_KIND_PROGRAM
: return "PROGRAM";
1267 case BFD_SYM_MODULE_KIND_UNIT
: return "UNIT";
1268 case BFD_SYM_MODULE_KIND_PROCEDURE
: return "PROCEDURE";
1269 case BFD_SYM_MODULE_KIND_FUNCTION
: return "FUNCTION";
1270 case BFD_SYM_MODULE_KIND_DATA
: return "DATA";
1271 case BFD_SYM_MODULE_KIND_BLOCK
: return "BLOCK";
1272 default: return "[UNKNOWN]";
1277 bfd_sym_unparse_symbol_scope (scope
)
1278 enum bfd_sym_symbol_scope scope
;
1282 case BFD_SYM_SYMBOL_SCOPE_LOCAL
: return "LOCAL";
1283 case BFD_SYM_SYMBOL_SCOPE_GLOBAL
: return "GLOBAL";
1290 bfd_sym_print_file_reference (abfd
, f
, entry
)
1293 bfd_sym_file_reference
*entry
;
1295 bfd_sym_file_references_table_entry frtentry
;
1298 ret
= bfd_sym_fetch_file_references_table_entry (abfd
, &frtentry
,
1299 entry
->fref_frte_index
);
1300 fprintf (f
, "FILE ");
1302 if ((ret
< 0) || (frtentry
.generic
.type
!= BFD_SYM_FILE_NAME_INDEX
))
1303 fprintf (f
, "[INVALID]");
1305 fprintf (f
, "\"%.*s\"",
1306 bfd_sym_symbol_name (abfd
, frtentry
.filename
.nte_index
)[0],
1307 &bfd_sym_symbol_name (abfd
, frtentry
.filename
.nte_index
)[1]);
1309 fprintf (f
, " (FRTE %lu)", entry
->fref_frte_index
);
1313 bfd_sym_print_resources_table_entry (abfd
, f
, entry
)
1316 bfd_sym_resources_table_entry
*entry
;
1318 fprintf (f
, " \"%.*s\" (NTE %lu), type \"%.4s\", num %u, size %lu, MTE %lu -- %lu",
1319 bfd_sym_symbol_name (abfd
, entry
->rte_nte_index
)[0],
1320 &bfd_sym_symbol_name (abfd
, entry
->rte_nte_index
)[1],
1321 entry
->rte_nte_index
, entry
->rte_res_type
, entry
->rte_res_number
,
1322 entry
->rte_res_size
, entry
->rte_mte_first
, entry
->rte_mte_last
);
1326 bfd_sym_print_modules_table_entry (abfd
, f
, entry
)
1329 bfd_sym_modules_table_entry
*entry
;
1331 fprintf (f
, "\"%.*s\" (NTE %lu)",
1332 bfd_sym_symbol_name (abfd
, entry
->mte_nte_index
)[0],
1333 &bfd_sym_symbol_name (abfd
, entry
->mte_nte_index
)[1],
1334 entry
->mte_nte_index
);
1338 bfd_sym_print_file_reference (abfd
, f
, &entry
->mte_imp_fref
);
1339 fprintf (f
, " range %lu -- %lu",
1340 entry
->mte_imp_fref
.fref_offset
, entry
->mte_imp_end
);
1344 fprintf (f
, "kind %s", bfd_sym_unparse_module_kind (entry
->mte_kind
));
1345 fprintf (f
, ", scope %s", bfd_sym_unparse_symbol_scope (entry
->mte_scope
));
1347 fprintf (f
, ", RTE %lu, offset %lu, size %lu",
1348 entry
->mte_rte_index
, entry
->mte_res_offset
, entry
->mte_size
);
1352 fprintf (f
, "CMTE %lu, CVTE %lu, CLTE %lu, CTTE %lu, CSNTE1 %lu, CSNTE2 %lu",
1353 entry
->mte_cmte_index
, entry
->mte_cvte_index
,
1354 entry
->mte_clte_index
, entry
->mte_ctte_index
,
1355 entry
->mte_csnte_idx_1
, entry
->mte_csnte_idx_2
);
1357 if (entry
->mte_parent
!= 0)
1358 fprintf (f
, ", parent %lu", entry
->mte_parent
);
1360 fprintf (f
, ", no parent");
1362 if (entry
->mte_cmte_index
!= 0)
1363 fprintf (f
, ", child %lu", entry
->mte_cmte_index
);
1365 fprintf (f
, ", no child");
1369 MTE bfd_sym_modules_table_entry pentry
;
1371 ret
= bfd_sym_fetch_modules_table_entry (abfd
, &pentry
, entry
->mte_parent
);
1373 fprintf (f
, " parent MTE %lu [INVALID]\n", entry
->mte_parent
);
1375 fprintf (f
, " parent MTE %lu \"%.*s\"\n",
1377 bfd_sym_symbol_name (abfd
, pentry
.mte_nte_index
)[0],
1378 &bfd_sym_symbol_name (abfd
, pentry
.mte_nte_index
)[1]);
1384 bfd_sym_print_file_references_table_entry (abfd
, f
, entry
)
1387 bfd_sym_file_references_table_entry
*entry
;
1389 switch (entry
->generic
.type
)
1391 case BFD_SYM_FILE_NAME_INDEX
:
1392 fprintf (f
, "FILE \"%.*s\" (NTE %lu), modtime ",
1393 bfd_sym_symbol_name (abfd
, entry
->filename
.nte_index
)[0],
1394 &bfd_sym_symbol_name (abfd
, entry
->filename
.nte_index
)[1],
1395 entry
->filename
.nte_index
);
1397 fprintf (f
, "[UNIMPLEMENTED]");
1398 /* printModDate (entry->filename.mod_date); */
1399 fprintf (f
, " (0x%lx)", entry
->filename
.mod_date
);
1402 case BFD_SYM_END_OF_LIST
:
1407 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu",
1408 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1409 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1410 entry
->entry
.mte_index
,
1411 entry
->entry
.file_offset
);
1417 bfd_sym_print_contained_modules_table_entry (abfd
, f
, entry
)
1420 bfd_sym_contained_modules_table_entry
*entry
;
1422 switch (entry
->generic
.type
)
1424 case BFD_SYM_END_OF_LIST
:
1429 fprintf (f
, "\"%.*s\" (MTE %lu, NTE %lu)",
1430 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1431 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1432 entry
->entry
.mte_index
,
1433 entry
->entry
.nte_index
);
1439 bfd_sym_print_contained_variables_table_entry (abfd
, f
, entry
)
1442 bfd_sym_contained_variables_table_entry
*entry
;
1444 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1450 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1452 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1453 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1457 fprintf (f
, "\"%.*s\" (NTE %lu)",
1458 bfd_sym_symbol_name (abfd
, entry
->entry
.nte_index
)[0],
1459 &bfd_sym_symbol_name (abfd
, entry
->entry
.nte_index
)[1],
1460 entry
->entry
.nte_index
);
1462 fprintf (f
, ", TTE %lu", entry
->entry
.tte_index
);
1463 fprintf (f
, ", offset %lu", entry
->entry
.file_delta
);
1464 fprintf (f
, ", scope %s", bfd_sym_unparse_symbol_scope (entry
->entry
.scope
));
1466 if (entry
->entry
.la_size
== BFD_SYM_CVTE_SCA
)
1467 fprintf (f
, ", latype %s, laclass %s, laoffset %lu",
1468 bfd_sym_unparse_storage_kind (entry
->entry
.address
.scstruct
.sca_kind
),
1469 bfd_sym_unparse_storage_class (entry
->entry
.address
.scstruct
.sca_class
),
1470 entry
->entry
.address
.scstruct
.sca_offset
);
1471 else if (entry
->entry
.la_size
<= BFD_SYM_CVTE_LA_MAX_SIZE
)
1475 fprintf (f
, ", la [");
1476 for (i
= 0; i
< entry
->entry
.la_size
; i
++)
1477 fprintf (f
, "0x%02x ", entry
->entry
.address
.lastruct
.la
[i
]);
1480 else if (entry
->entry
.la_size
== BFD_SYM_CVTE_BIG_LA
)
1481 fprintf (f
, ", bigla %lu, biglakind %u",
1482 entry
->entry
.address
.biglastruct
.big_la
,
1483 entry
->entry
.address
.biglastruct
.big_la_kind
);
1486 fprintf (f
, ", la [INVALID]");
1490 bfd_sym_print_contained_statements_table_entry (abfd
, f
, entry
)
1493 bfd_sym_contained_statements_table_entry
*entry
;
1495 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1501 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1503 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1504 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1508 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu, delta %lu",
1509 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1510 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1511 entry
->entry
.mte_index
,
1512 entry
->entry
.mte_offset
,
1513 entry
->entry
.file_delta
);
1517 bfd_sym_print_contained_labels_table_entry (abfd
, f
, entry
)
1520 bfd_sym_contained_labels_table_entry
*entry
;
1522 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1528 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1530 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1531 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1535 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu, delta %lu, scope %s",
1536 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1537 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1538 entry
->entry
.mte_index
,
1539 entry
->entry
.mte_offset
,
1540 entry
->entry
.file_delta
,
1541 bfd_sym_unparse_symbol_scope (entry
->entry
.scope
));
1545 bfd_sym_print_contained_types_table_entry (abfd
, f
, entry
)
1546 bfd
*abfd ATTRIBUTE_UNUSED
;
1548 bfd_sym_contained_types_table_entry
*entry ATTRIBUTE_UNUSED
;
1550 fprintf (f
, "[UNIMPLEMENTED]");
1554 bfd_sym_type_operator_name (num
)
1559 case 1: return "TTE";
1560 case 2: return "PointerTo";
1561 case 3: return "ScalarOf";
1562 case 4: return "ConstantOf";
1563 case 5: return "EnumerationOf";
1564 case 6: return "VectorOf";
1565 case 7: return "RecordOf";
1566 case 8: return "UnionOf";
1567 case 9: return "SubRangeOf";
1568 case 10: return "SetOf";
1569 case 11: return "NamedTypeOf";
1570 case 12: return "ProcOf";
1571 case 13: return "ValueOf";
1572 case 14: return "ArrayOf";
1573 default: return "[UNKNOWN OPERATOR]";
1578 bfd_sym_type_basic_name (num
)
1583 case 0: return "void";
1584 case 1: return "pascal string";
1585 case 2: return "unsigned long";
1586 case 3: return "signed long";
1587 case 4: return "extended (10 bytes)";
1588 case 5: return "pascal boolean (1 byte)";
1589 case 6: return "unsigned byte";
1590 case 7: return "signed byte";
1591 case 8: return "character (1 byte)";
1592 case 9: return "wide character (2 bytes)";
1593 case 10: return "unsigned short";
1594 case 11: return "signed short";
1595 case 12: return "singled";
1596 case 13: return "double";
1597 case 14: return "extended (12 bytes)";
1598 case 15: return "computational (8 bytes)";
1599 case 16: return "c string";
1600 case 17: return "as-is string";
1601 default: return "[UNKNOWN BASIC TYPE]";
1606 bfd_sym_fetch_long (buf
, len
, offset
, offsetptr
, value
)
1609 unsigned long offset
;
1610 unsigned long *offsetptr
;
1621 else if (! (buf
[offset
] & 0x80))
1623 *value
= buf
[offset
];
1627 else if (buf
[offset
] == 0xc0)
1629 if ((offset
+ 5) > len
)
1637 *value
= bfd_getb32 (buf
+ offset
+ 1);
1642 else if ((buf
[offset
] & 0xc0) == 0xc0)
1644 *value
= -(buf
[offset
] & 0x3f);
1648 else if ((buf
[offset
] & 0xc0) == 0x80)
1650 if ((offset
+ 2) > len
)
1658 *value
= bfd_getb16 (buf
+ offset
) & 0x3fff;
1666 if (offsetptr
!= NULL
)
1667 *offsetptr
= offset
;
1673 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, offsetptr
)
1678 unsigned long offset
;
1679 unsigned long *offsetptr
;
1685 fprintf (f
, "[NULL]");
1687 if (offsetptr
!= NULL
)
1688 *offsetptr
= offset
;
1695 if (! (type
& 0x80))
1697 fprintf (f
, "[%s] (0x%x)", bfd_sym_type_basic_name (type
& 0x7f), type
);
1699 if (offsetptr
!= NULL
)
1700 *offsetptr
= offset
;
1705 fprintf (f
, "[packed ");
1709 switch (type
& 0x3f)
1714 bfd_sym_type_information_table_entry tinfo
;
1716 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1718 fprintf (f
, "[INVALID]");
1721 if (bfd_sym_fetch_type_table_information (abfd
, &tinfo
, value
) < 0)
1722 fprintf (f
, "[INVALID]");
1724 fprintf (f
, "\"%.*s\"",
1725 bfd_sym_symbol_name (abfd
, tinfo
.nte_index
)[0],
1726 &bfd_sym_symbol_name (abfd
, tinfo
.nte_index
)[1]);
1728 fprintf (f
, " (TTE %lu)", value
);
1733 fprintf (f
, "pointer (0x%x) to ", type
);
1734 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1739 unsigned long value
;
1741 fprintf (f
, "scalar (0x%x) of ", type
);
1742 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1743 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1744 fprintf (f
, " (%lu)", value
);
1750 unsigned long lower
, upper
, nelem
;
1753 fprintf (f
, "enumeration (0x%x) of ", type
);
1754 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1755 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &lower
);
1756 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &upper
);
1757 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &nelem
);
1758 fprintf (f
, " from %lu to %lu with %lu elements: ", lower
, upper
, nelem
);
1760 for (i
= 0; i
< nelem
; i
++)
1763 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1769 fprintf (f
, "vector (0x%x)", type
);
1770 fprintf (f
, "\n index ");
1771 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1772 fprintf (f
, "\n target ");
1773 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1779 long nrec
, eloff
, i
;
1781 if ((type
& 0x3f) == 7)
1782 fprintf (f
, "record (0x%x) of ", type
);
1784 fprintf (f
, "union (0x%x) of ", type
);
1786 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &nrec
);
1787 fprintf (f
, "%lu elements: ", nrec
);
1789 for (i
= 0; i
< nrec
; i
++)
1791 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &eloff
);
1793 fprintf (f
, "offset %lu: ", eloff
);
1794 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1800 fprintf (f
, "subrange (0x%x) of ", type
);
1801 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1802 fprintf (f
, " lower ");
1803 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1804 fprintf (f
, " upper ");
1805 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1812 fprintf (f
, "named type (0x%x) ", type
);
1813 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1815 fprintf (f
, "[INVALID]");
1817 fprintf (f
, "\"%.*s\"",
1818 bfd_sym_symbol_name (abfd
, value
)[0],
1819 &bfd_sym_symbol_name (abfd
, value
)[1]);
1821 fprintf (f
, " (NTE %lu) with type ", value
);
1822 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1827 fprintf (f
, "%s (0x%x)", bfd_sym_type_operator_name (type
), type
);
1831 if (type
== (0x40 | 0x6))
1838 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &n
);
1839 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &width
);
1840 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &m
);
1841 /* fprintf (f, "\n "); */
1842 fprintf (f
, " N %ld, width %ld, M %ld, ", n
, width
, m
);
1843 for (i
= 0; i
< m
; i
++)
1845 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &l
);
1848 fprintf (f
, "%ld", l
);
1851 else if (type
& 0x40)
1853 /* Other packed type. */
1856 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &msb
);
1857 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &lsb
);
1858 /* fprintf (f, "\n "); */
1859 fprintf (f
, " msb %ld, lsb %ld", msb
, lsb
);
1864 if (offsetptr
!= NULL
)
1865 *offsetptr
= offset
;
1869 bfd_sym_print_type_information_table_entry (abfd
, f
, entry
)
1872 bfd_sym_type_information_table_entry
*entry
;
1875 unsigned long offset
;
1878 fprintf (f
, "\"%.*s\" (NTE %lu), %lu bytes at %lu, logical size %lu",
1879 bfd_sym_symbol_name (abfd
, entry
->nte_index
)[0],
1880 &bfd_sym_symbol_name (abfd
, entry
->nte_index
)[1],
1882 entry
->physical_size
, entry
->offset
, entry
->logical_size
);
1886 buf
= alloca (entry
->physical_size
);
1889 fprintf (f
, "[ERROR]\n");
1892 if (bfd_seek (abfd
, entry
->offset
, SEEK_SET
) < 0)
1894 fprintf (f
, "[ERROR]\n");
1897 if (bfd_bread (buf
, entry
->physical_size
, abfd
) != entry
->physical_size
)
1899 fprintf (f
, "[ERROR]\n");
1904 for (i
= 0; i
< entry
->physical_size
; i
++)
1907 fprintf (f
, "0x%02x", buf
[i
]);
1909 fprintf (f
, " 0x%02x", buf
[i
]);
1915 bfd_sym_print_type_information (abfd
, f
, buf
, entry
->physical_size
, 0, &offset
);
1917 if (offset
!= entry
->physical_size
)
1918 fprintf (f
, "\n [parser used %lu bytes instead of %lu]", offset
, entry
->physical_size
); }
1921 bfd_sym_print_file_references_index_table_entry (abfd
, f
, entry
)
1922 bfd
*abfd ATTRIBUTE_UNUSED
;
1924 bfd_sym_file_references_index_table_entry
*entry ATTRIBUTE_UNUSED
;
1926 fprintf (f
, "[UNIMPLEMENTED]");
1930 bfd_sym_print_constant_pool_entry (abfd
, f
, entry
)
1931 bfd
*abfd ATTRIBUTE_UNUSED
;
1933 bfd_sym_constant_pool_entry
*entry ATTRIBUTE_UNUSED
;
1935 fprintf (f
, "[UNIMPLEMENTED]");
1939 bfd_sym_display_name_table_entry (abfd
, f
, entry
)
1942 unsigned char *entry
;
1944 unsigned long index
;
1945 unsigned long offset
;
1946 bfd_sym_data_struct
*sdata
= NULL
;
1948 BFD_ASSERT (bfd_sym_valid (abfd
));
1949 sdata
= abfd
->tdata
.sym_data
;
1950 index
= (entry
- sdata
->name_table
) / 2;
1952 if (sdata
->version
>= BFD_SYM_VERSION_3_4
&& entry
[0] == 255 && entry
[1] == 0)
1954 unsigned short length
= bfd_getb16 (entry
+ 2);
1955 fprintf (f
, "[%8lu] \"%.*s\"\n", index
, length
, entry
+ 4);
1956 offset
= 2 + length
+ 1;
1960 if (! (entry
[0] == 0 || (entry
[0] == 1 && entry
[1] == '\0')))
1961 fprintf (f
, "[%8lu] \"%.*s\"\n", index
, entry
[0], entry
+ 1);
1963 if (sdata
->version
>= BFD_SYM_VERSION_3_4
)
1964 offset
= entry
[0] + 2;
1966 offset
= entry
[0] + 1;
1969 return (entry
+ offset
+ (offset
% 2));
1973 bfd_sym_display_name_table (abfd
, f
)
1977 unsigned long name_table_len
;
1978 unsigned char *name_table
, *name_table_end
, *cur
;
1979 bfd_sym_data_struct
*sdata
= NULL
;
1981 BFD_ASSERT (bfd_sym_valid (abfd
));
1982 sdata
= abfd
->tdata
.sym_data
;
1984 name_table_len
= sdata
->header
.dshb_nte
.dti_page_count
* sdata
->header
.dshb_page_size
;
1985 name_table
= sdata
->name_table
;
1986 name_table_end
= name_table
+ name_table_len
;
1988 fprintf (f
, "name table (NTE) contains %lu bytes:\n\n", name_table_len
);
1993 cur
= bfd_sym_display_name_table_entry (abfd
, f
, cur
);
1994 if (cur
>= name_table_end
)
2000 bfd_sym_display_resources_table (abfd
, f
)
2005 bfd_sym_resources_table_entry entry
;
2006 bfd_sym_data_struct
*sdata
= NULL
;
2008 BFD_ASSERT (bfd_sym_valid (abfd
));
2009 sdata
= abfd
->tdata
.sym_data
;
2011 fprintf (f
, "resource table (RTE) contains %lu objects:\n\n",
2012 sdata
->header
.dshb_rte
.dti_object_count
);
2014 for (i
= 1; i
<= sdata
->header
.dshb_rte
.dti_object_count
; i
++)
2016 if (bfd_sym_fetch_resources_table_entry (abfd
, &entry
, i
) < 0)
2017 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2020 fprintf (f
, " [%8lu] ", i
);
2021 bfd_sym_print_resources_table_entry (abfd
, f
, &entry
);
2028 bfd_sym_display_modules_table (abfd
, f
)
2033 bfd_sym_modules_table_entry entry
;
2034 bfd_sym_data_struct
*sdata
= NULL
;
2036 BFD_ASSERT (bfd_sym_valid (abfd
));
2037 sdata
= abfd
->tdata
.sym_data
;
2039 fprintf (f
, "module table (MTE) contains %lu objects:\n\n",
2040 sdata
->header
.dshb_mte
.dti_object_count
);
2042 for (i
= 1; i
<= sdata
->header
.dshb_mte
.dti_object_count
; i
++)
2044 if (bfd_sym_fetch_modules_table_entry (abfd
, &entry
, i
) < 0)
2045 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2048 fprintf (f
, " [%8lu] ", i
);
2049 bfd_sym_print_modules_table_entry (abfd
, f
, &entry
);
2056 bfd_sym_display_file_references_table (abfd
, f
)
2061 bfd_sym_file_references_table_entry entry
;
2062 bfd_sym_data_struct
*sdata
= NULL
;
2064 BFD_ASSERT (bfd_sym_valid (abfd
));
2065 sdata
= abfd
->tdata
.sym_data
;
2067 fprintf (f
, "file reference table (FRTE) contains %lu objects:\n\n",
2068 sdata
->header
.dshb_frte
.dti_object_count
);
2070 for (i
= 1; i
<= sdata
->header
.dshb_frte
.dti_object_count
; i
++)
2072 if (bfd_sym_fetch_file_references_table_entry (abfd
, &entry
, i
) < 0)
2073 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2076 fprintf (f
, " [%8lu] ", i
);
2077 bfd_sym_print_file_references_table_entry (abfd
, f
, &entry
);
2084 bfd_sym_display_contained_modules_table (abfd
, f
)
2089 bfd_sym_contained_modules_table_entry entry
;
2090 bfd_sym_data_struct
*sdata
= NULL
;
2092 BFD_ASSERT (bfd_sym_valid (abfd
));
2093 sdata
= abfd
->tdata
.sym_data
;
2095 fprintf (f
, "contained modules table (CMTE) contains %lu objects:\n\n",
2096 sdata
->header
.dshb_cmte
.dti_object_count
);
2098 for (i
= 1; i
<= sdata
->header
.dshb_cmte
.dti_object_count
; i
++)
2100 if (bfd_sym_fetch_contained_modules_table_entry (abfd
, &entry
, i
) < 0)
2101 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2104 fprintf (f
, " [%8lu] ", i
);
2105 bfd_sym_print_contained_modules_table_entry (abfd
, f
, &entry
);
2112 bfd_sym_display_contained_variables_table (abfd
, f
)
2117 bfd_sym_contained_variables_table_entry entry
;
2118 bfd_sym_data_struct
*sdata
= NULL
;
2120 BFD_ASSERT (bfd_sym_valid (abfd
));
2121 sdata
= abfd
->tdata
.sym_data
;
2123 fprintf (f
, "contained variables table (CVTE) contains %lu objects:\n\n",
2124 sdata
->header
.dshb_cvte
.dti_object_count
);
2126 for (i
= 1; i
<= sdata
->header
.dshb_cvte
.dti_object_count
; i
++)
2128 if (bfd_sym_fetch_contained_variables_table_entry (abfd
, &entry
, i
) < 0)
2129 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2132 fprintf (f
, " [%8lu] ", i
);
2133 bfd_sym_print_contained_variables_table_entry (abfd
, f
, &entry
);
2142 bfd_sym_display_contained_statements_table (abfd
, f
)
2147 bfd_sym_contained_statements_table_entry entry
;
2148 bfd_sym_data_struct
*sdata
= NULL
;
2150 BFD_ASSERT (bfd_sym_valid (abfd
));
2151 sdata
= abfd
->tdata
.sym_data
;
2153 fprintf (f
, "contained statements table (CSNTE) contains %lu objects:\n\n",
2154 sdata
->header
.dshb_csnte
.dti_object_count
);
2156 for (i
= 1; i
<= sdata
->header
.dshb_csnte
.dti_object_count
; i
++)
2158 if (bfd_sym_fetch_contained_statements_table_entry (abfd
, &entry
, i
) < 0)
2159 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2162 fprintf (f
, " [%8lu] ", i
);
2163 bfd_sym_print_contained_statements_table_entry (abfd
, f
, &entry
);
2170 bfd_sym_display_contained_labels_table (abfd
, f
)
2175 bfd_sym_contained_labels_table_entry entry
;
2176 bfd_sym_data_struct
*sdata
= NULL
;
2178 BFD_ASSERT (bfd_sym_valid (abfd
));
2179 sdata
= abfd
->tdata
.sym_data
;
2181 fprintf (f
, "contained labels table (CLTE) contains %lu objects:\n\n",
2182 sdata
->header
.dshb_clte
.dti_object_count
);
2184 for (i
= 1; i
<= sdata
->header
.dshb_clte
.dti_object_count
; i
++)
2186 if (bfd_sym_fetch_contained_labels_table_entry (abfd
, &entry
, i
) < 0)
2187 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2190 fprintf (f
, " [%8lu] ", i
);
2191 bfd_sym_print_contained_labels_table_entry (abfd
, f
, &entry
);
2198 bfd_sym_display_contained_types_table (abfd
, f
)
2203 bfd_sym_contained_types_table_entry entry
;
2204 bfd_sym_data_struct
*sdata
= NULL
;
2206 BFD_ASSERT (bfd_sym_valid (abfd
));
2207 sdata
= abfd
->tdata
.sym_data
;
2209 fprintf (f
, "contained types table (CTTE) contains %lu objects:\n\n",
2210 sdata
->header
.dshb_ctte
.dti_object_count
);
2212 for (i
= 1; i
<= sdata
->header
.dshb_ctte
.dti_object_count
; i
++)
2214 if (bfd_sym_fetch_contained_types_table_entry (abfd
, &entry
, i
) < 0)
2215 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2218 fprintf (f
, " [%8lu] ", i
);
2219 bfd_sym_print_contained_types_table_entry (abfd
, f
, &entry
);
2226 bfd_sym_display_file_references_index_table (abfd
, f
)
2231 bfd_sym_file_references_index_table_entry entry
;
2232 bfd_sym_data_struct
*sdata
= NULL
;
2234 BFD_ASSERT (bfd_sym_valid (abfd
));
2235 sdata
= abfd
->tdata
.sym_data
;
2237 fprintf (f
, "file references index table (FITE) contains %lu objects:\n\n",
2238 sdata
->header
.dshb_fite
.dti_object_count
);
2240 for (i
= 1; i
<= sdata
->header
.dshb_fite
.dti_object_count
; i
++)
2242 if (bfd_sym_fetch_file_references_index_table_entry (abfd
, &entry
, i
) < 0)
2243 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2246 fprintf (f
, " [%8lu] ", i
);
2247 bfd_sym_print_file_references_index_table_entry (abfd
, f
, &entry
);
2254 bfd_sym_display_constant_pool (abfd
, f
)
2259 bfd_sym_constant_pool_entry entry
;
2260 bfd_sym_data_struct
*sdata
= NULL
;
2262 BFD_ASSERT (bfd_sym_valid (abfd
));
2263 sdata
= abfd
->tdata
.sym_data
;
2265 fprintf (f
, "constant pool (CONST) contains %lu objects:\n\n",
2266 sdata
->header
.dshb_const
.dti_object_count
);
2268 for (i
= 1; i
<= sdata
->header
.dshb_const
.dti_object_count
; i
++)
2270 if (bfd_sym_fetch_constant_pool_entry (abfd
, &entry
, i
) < 0)
2271 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2274 fprintf (f
, " [%8lu] ", i
);
2275 bfd_sym_print_constant_pool_entry (abfd
, f
, &entry
);
2282 bfd_sym_display_type_information_table (abfd
, f
)
2287 bfd_sym_type_table_entry index
;
2288 bfd_sym_type_information_table_entry entry
;
2289 bfd_sym_data_struct
*sdata
= NULL
;
2291 BFD_ASSERT (bfd_sym_valid (abfd
));
2292 sdata
= abfd
->tdata
.sym_data
;
2294 if (sdata
->header
.dshb_tte
.dti_object_count
> 99)
2295 fprintf (f
, "type table (TINFO) contains %lu objects:\n\n",
2296 sdata
->header
.dshb_tte
.dti_object_count
- 99);
2299 fprintf (f
, "type table (TINFO) contains [INVALID] objects:\n\n");
2303 for (i
= 100; i
<= sdata
->header
.dshb_tte
.dti_object_count
; i
++)
2305 if (bfd_sym_fetch_type_table_entry (abfd
, &index
, i
- 100) < 0)
2306 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2309 fprintf (f
, " [%8lu] (TINFO %lu) ", i
, index
);
2311 if (bfd_sym_fetch_type_information_table_entry (abfd
, &entry
, index
) < 0)
2312 fprintf (f
, "[INVALID]");
2314 bfd_sym_print_type_information_table_entry (abfd
, f
, &entry
);
2322 bfd_sym_scan (abfd
, version
, mdata
)
2324 bfd_sym_version version
;
2325 bfd_sym_data_struct
*mdata
;
2328 const char *name
= "symbols";
2330 mdata
->name_table
= 0;
2332 mdata
->version
= version
;
2334 bfd_seek (abfd
, 0, SEEK_SET
);
2335 if (bfd_sym_read_header (abfd
, &mdata
->header
, mdata
->version
) != 0)
2338 mdata
->name_table
= bfd_sym_read_name_table (abfd
, &mdata
->header
);
2339 if (mdata
->name_table
== NULL
)
2342 bfdsec
= bfd_make_section_anyway (abfd
, name
);
2348 bfdsec
->_raw_size
= 0;
2349 bfdsec
->filepos
= 0;
2350 bfdsec
->alignment_power
= 0;
2352 bfdsec
->flags
= SEC_HAS_CONTENTS
;
2354 abfd
->tdata
.sym_data
= mdata
;
2360 bfd_sym_object_p (abfd
)
2363 struct bfd_preserve preserve
;
2364 bfd_sym_version version
= -1;
2366 preserve
.marker
= NULL
;
2367 bfd_seek (abfd
, 0, SEEK_SET
);
2368 if (bfd_sym_read_version (abfd
, &version
) != 0)
2371 preserve
.marker
= bfd_alloc (abfd
, sizeof (bfd_sym_data_struct
));
2372 if (preserve
.marker
== NULL
2373 || ! bfd_preserve_save (abfd
, &preserve
))
2376 if (bfd_sym_scan (abfd
, version
,
2377 (bfd_sym_data_struct
*) preserve
.marker
) != 0)
2380 bfd_preserve_finish (abfd
, &preserve
);
2384 bfd_set_error (bfd_error_wrong_format
);
2387 if (preserve
.marker
!= NULL
)
2388 bfd_preserve_restore (abfd
, &preserve
);
2393 bfd_sym_make_empty_symbol (abfd
)
2396 return (asymbol
*) bfd_alloc (abfd
, sizeof (asymbol
));
2400 bfd_sym_get_symbol_info (abfd
, symbol
, ret
)
2401 bfd
*abfd ATTRIBUTE_UNUSED
;
2405 bfd_symbol_info (symbol
, ret
);
2409 bfd_sym_get_symtab_upper_bound (abfd
)
2410 bfd
*abfd ATTRIBUTE_UNUSED
;
2416 bfd_sym_get_symtab (abfd
, sym
)
2417 bfd
*abfd ATTRIBUTE_UNUSED
;
2418 asymbol
**sym ATTRIBUTE_UNUSED
;
2424 bfd_sym_sizeof_headers (abfd
, exec
)
2425 bfd
*abfd ATTRIBUTE_UNUSED
;
2426 bfd_boolean exec ATTRIBUTE_UNUSED
;
2431 const bfd_target sym_vec
=
2434 bfd_target_sym_flavour
, /* flavour */
2435 BFD_ENDIAN_BIG
, /* byteorder */
2436 BFD_ENDIAN_BIG
, /* header_byteorder */
2437 (HAS_RELOC
| EXEC_P
| /* object flags */
2438 HAS_LINENO
| HAS_DEBUG
|
2439 HAS_SYMS
| HAS_LOCALS
| DYNAMIC
| WP_TEXT
| D_PAGED
),
2440 (SEC_ALLOC
| SEC_LOAD
| SEC_READONLY
| SEC_CODE
| SEC_DATA
2441 | SEC_ROM
| SEC_HAS_CONTENTS
), /* section_flags */
2442 0, /* symbol_leading_char */
2443 ' ', /* ar_pad_char */
2444 16, /* ar_max_namelen */
2445 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2446 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2447 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* data */
2448 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2449 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2450 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* hdrs */
2451 { /* bfd_check_format */
2453 bfd_sym_object_p
, /* bfd_check_format */
2457 { /* bfd_set_format */
2463 { /* bfd_write_contents */
2470 BFD_JUMP_TABLE_GENERIC (bfd_sym
),
2471 BFD_JUMP_TABLE_COPY (_bfd_generic
),
2472 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
2473 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive
),
2474 BFD_JUMP_TABLE_SYMBOLS (bfd_sym
),
2475 BFD_JUMP_TABLE_RELOCS (bfd_sym
),
2476 BFD_JUMP_TABLE_WRITE (bfd_sym
),
2477 BFD_JUMP_TABLE_LINK (bfd_sym
),
2478 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),