1 /* xSYM symbol-file support for BFD.
2 Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
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_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
31 #define bfd_sym_get_lineno _bfd_nosymbols_get_lineno
32 #define bfd_sym_find_nearest_line _bfd_nosymbols_find_nearest_line
33 #define bfd_sym_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
34 #define bfd_sym_read_minisymbols _bfd_generic_read_minisymbols
35 #define bfd_sym_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
36 #define bfd_sym_get_reloc_upper_bound _bfd_norelocs_get_reloc_upper_bound
37 #define bfd_sym_canonicalize_reloc _bfd_norelocs_canonicalize_reloc
38 #define bfd_sym_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
39 #define bfd_sym_set_arch_mach _bfd_generic_set_arch_mach
40 #define bfd_sym_get_section_contents _bfd_generic_get_section_contents
41 #define bfd_sym_set_section_contents _bfd_generic_set_section_contents
42 #define bfd_sym_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
43 #define bfd_sym_bfd_relax_section bfd_generic_relax_section
44 #define bfd_sym_bfd_gc_sections bfd_generic_gc_sections
45 #define bfd_sym_bfd_merge_sections bfd_generic_merge_sections
46 #define bfd_sym_bfd_is_group_section bfd_generic_is_group_section
47 #define bfd_sym_bfd_discard_group bfd_generic_discard_group
48 #define bfd_sym_section_already_linked \
49 _bfd_generic_section_already_linked
50 #define bfd_sym_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
51 #define bfd_sym_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
52 #define bfd_sym_bfd_link_add_symbols _bfd_generic_link_add_symbols
53 #define bfd_sym_bfd_link_just_syms _bfd_generic_link_just_syms
54 #define bfd_sym_bfd_final_link _bfd_generic_final_link
55 #define bfd_sym_bfd_link_split_section _bfd_generic_link_split_section
56 #define bfd_sym_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
58 static unsigned long compute_offset
59 PARAMS ((unsigned long, unsigned long, unsigned long, unsigned long));
61 extern const bfd_target sym_vec
;
64 pstrcmp (const char *as
, const char *bs
)
66 const unsigned char *a
= (const unsigned char *) as
;
67 const unsigned char *b
= (const unsigned char *) bs
;
71 clen
= (a
[0] > b
[0]) ? b
[0] : a
[0];
72 ret
= memcmp (a
+ 1, b
+ 1, clen
);
85 compute_offset (first_page
, page_size
, entry_size
, index
)
86 unsigned long first_page
;
87 unsigned long page_size
;
88 unsigned long entry_size
;
91 unsigned long entries_per_page
= page_size
/ entry_size
;
92 unsigned long page_number
= first_page
+ (index
/ entries_per_page
);
93 unsigned long page_offset
= (index
% entries_per_page
) * entry_size
;
95 return (page_number
* page_size
) + page_offset
;
99 bfd_sym_mkobject (abfd
)
100 bfd
*abfd ATTRIBUTE_UNUSED
;
106 bfd_sym_print_symbol (abfd
, afile
, symbol
, how
)
107 bfd
*abfd ATTRIBUTE_UNUSED
;
108 PTR afile ATTRIBUTE_UNUSED
;
109 asymbol
*symbol ATTRIBUTE_UNUSED
;
110 bfd_print_symbol_type how ATTRIBUTE_UNUSED
;
119 if (abfd
== NULL
|| abfd
->xvec
== NULL
)
122 return abfd
->xvec
== &sym_vec
;
126 bfd_sym_read_name_table (abfd
, dshb
)
128 bfd_sym_header_block
*dshb
;
132 size_t table_size
= dshb
->dshb_nte
.dti_page_count
* dshb
->dshb_page_size
;
133 size_t table_offset
= dshb
->dshb_nte
.dti_first_page
* dshb
->dshb_page_size
;
135 rstr
= (unsigned char *) bfd_alloc (abfd
, table_size
);
139 bfd_seek (abfd
, table_offset
, SEEK_SET
);
140 ret
= bfd_bread (rstr
, table_size
, abfd
);
141 if (ret
< 0 || (unsigned long) ret
!= table_size
)
143 bfd_release (abfd
, rstr
);
151 bfd_sym_parse_file_reference_v32 (buf
, len
, entry
)
154 bfd_sym_file_reference
*entry
;
156 BFD_ASSERT (len
== 6);
158 entry
->fref_frte_index
= bfd_getb16 (buf
);
159 entry
->fref_offset
= bfd_getb32 (buf
+ 2);
163 bfd_sym_parse_disk_table_v32 (buf
, len
, table
)
166 bfd_sym_table_info
*table
;
168 BFD_ASSERT (len
== 8);
170 table
->dti_first_page
= bfd_getb16 (buf
);
171 table
->dti_page_count
= bfd_getb16 (buf
+ 2);
172 table
->dti_object_count
= bfd_getb32 (buf
+ 4);
176 bfd_sym_parse_header_v32 (buf
, len
, header
)
179 bfd_sym_header_block
*header
;
181 BFD_ASSERT (len
== 154);
183 memcpy (header
->dshb_id
, buf
, 32);
184 header
->dshb_page_size
= bfd_getb16 (buf
+ 32);
185 header
->dshb_hash_page
= bfd_getb16 (buf
+ 34);
186 header
->dshb_root_mte
= bfd_getb16 (buf
+ 36);
187 header
->dshb_mod_date
= bfd_getb32 (buf
+ 38);
189 bfd_sym_parse_disk_table_v32 (buf
+ 42, 8, &header
->dshb_frte
);
190 bfd_sym_parse_disk_table_v32 (buf
+ 50, 8, &header
->dshb_rte
);
191 bfd_sym_parse_disk_table_v32 (buf
+ 58, 8, &header
->dshb_mte
);
192 bfd_sym_parse_disk_table_v32 (buf
+ 66, 8, &header
->dshb_cmte
);
193 bfd_sym_parse_disk_table_v32 (buf
+ 74, 8, &header
->dshb_cvte
);
194 bfd_sym_parse_disk_table_v32 (buf
+ 82, 8, &header
->dshb_csnte
);
195 bfd_sym_parse_disk_table_v32 (buf
+ 90, 8, &header
->dshb_clte
);
196 bfd_sym_parse_disk_table_v32 (buf
+ 98, 8, &header
->dshb_ctte
);
197 bfd_sym_parse_disk_table_v32 (buf
+ 106, 8, &header
->dshb_tte
);
198 bfd_sym_parse_disk_table_v32 (buf
+ 114, 8, &header
->dshb_nte
);
199 bfd_sym_parse_disk_table_v32 (buf
+ 122, 8, &header
->dshb_tinfo
);
200 bfd_sym_parse_disk_table_v32 (buf
+ 130, 8, &header
->dshb_fite
);
201 bfd_sym_parse_disk_table_v32 (buf
+ 138, 8, &header
->dshb_const
);
203 memcpy (&header
->dshb_file_creator
, buf
+ 146, 4);
204 memcpy (&header
->dshb_file_type
, buf
+ 150, 4);
208 bfd_sym_read_header_v32 (abfd
, header
)
210 bfd_sym_header_block
*header
;
212 unsigned char buf
[154];
215 ret
= bfd_bread (buf
, 154, abfd
);
219 bfd_sym_parse_header_v32 (buf
, 154, header
);
225 bfd_sym_read_header_v34 (abfd
, header
)
226 bfd
*abfd ATTRIBUTE_UNUSED
;
227 bfd_sym_header_block
*header ATTRIBUTE_UNUSED
;
233 bfd_sym_read_header (abfd
, header
, version
)
235 bfd_sym_header_block
*header
;
236 bfd_sym_version version
;
240 case BFD_SYM_VERSION_3_5
:
241 case BFD_SYM_VERSION_3_4
:
242 return bfd_sym_read_header_v34 (abfd
, header
);
243 case BFD_SYM_VERSION_3_3
:
244 case BFD_SYM_VERSION_3_2
:
245 return bfd_sym_read_header_v32 (abfd
, header
);
246 case BFD_SYM_VERSION_3_1
:
253 bfd_sym_read_version (abfd
, version
)
255 bfd_sym_version
*version
;
257 char version_string
[32];
260 ret
= bfd_bread (version_string
, sizeof (version_string
), abfd
);
261 if (ret
!= sizeof (version_string
))
264 if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_1
) == 0)
265 *version
= BFD_SYM_VERSION_3_1
;
266 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_2
) == 0)
267 *version
= BFD_SYM_VERSION_3_2
;
268 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_3
) == 0)
269 *version
= BFD_SYM_VERSION_3_3
;
270 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_4
) == 0)
271 *version
= BFD_SYM_VERSION_3_4
;
272 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_5
) == 0)
273 *version
= BFD_SYM_VERSION_3_5
;
281 bfd_sym_display_table_summary (f
, dti
, name
)
283 bfd_sym_table_info
*dti
;
286 fprintf (f
, "%-6s %13ld %13ld %13ld\n",
290 dti
->dti_object_count
);
294 bfd_sym_display_header (f
, dshb
)
296 bfd_sym_header_block
*dshb
;
298 fprintf (f
, " Version: %.*s\n", dshb
->dshb_id
[0], dshb
->dshb_id
+ 1);
299 fprintf (f
, " Page Size: 0x%x\n", dshb
->dshb_page_size
);
300 fprintf (f
, " Hash Page: %lu\n", dshb
->dshb_hash_page
);
301 fprintf (f
, " Root MTE: %lu\n", dshb
->dshb_root_mte
);
302 fprintf (f
, " Modification Date: ");
303 fprintf (f
, "[unimplemented]");
304 fprintf (f
, " (0x%lx)\n", dshb
->dshb_mod_date
);
306 fprintf (f
, " File Creator: %.4s Type: %.4s\n\n",
307 dshb
->dshb_file_creator
, dshb
->dshb_file_type
);
309 fprintf (f
, "Table Name First Page Page Count Object Count\n");
310 fprintf (f
, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
312 bfd_sym_display_table_summary (f
, &dshb
->dshb_nte
, "NTE");
313 bfd_sym_display_table_summary (f
, &dshb
->dshb_rte
, "RTE");
314 bfd_sym_display_table_summary (f
, &dshb
->dshb_mte
, "MTE");
315 bfd_sym_display_table_summary (f
, &dshb
->dshb_frte
, "FRTE");
316 bfd_sym_display_table_summary (f
, &dshb
->dshb_cmte
, "CMTE");
317 bfd_sym_display_table_summary (f
, &dshb
->dshb_cvte
, "CVTE");
318 bfd_sym_display_table_summary (f
, &dshb
->dshb_csnte
, "CSNTE");
319 bfd_sym_display_table_summary (f
, &dshb
->dshb_clte
, "CLTE");
320 bfd_sym_display_table_summary (f
, &dshb
->dshb_ctte
, "CTTE");
321 bfd_sym_display_table_summary (f
, &dshb
->dshb_tte
, "TTE");
322 bfd_sym_display_table_summary (f
, &dshb
->dshb_tinfo
, "TINFO");
323 bfd_sym_display_table_summary (f
, &dshb
->dshb_fite
, "FITE");
324 bfd_sym_display_table_summary (f
, &dshb
->dshb_const
, "CONST");
330 bfd_sym_parse_resources_table_entry_v32 (buf
, len
, entry
)
333 bfd_sym_resources_table_entry
*entry
;
335 BFD_ASSERT (len
== 18);
337 memcpy (&entry
->rte_res_type
, buf
, 4);
338 entry
->rte_res_number
= bfd_getb16 (buf
+ 4);
339 entry
->rte_nte_index
= bfd_getb32 (buf
+ 6);
340 entry
->rte_mte_first
= bfd_getb16 (buf
+ 10);
341 entry
->rte_mte_last
= bfd_getb16 (buf
+ 12);
342 entry
->rte_res_size
= bfd_getb32 (buf
+ 14);
346 bfd_sym_parse_modules_table_entry_v33 (buf
, len
, entry
)
349 bfd_sym_modules_table_entry
*entry
;
351 BFD_ASSERT (len
== 46);
353 entry
->mte_rte_index
= bfd_getb16 (buf
);
354 entry
->mte_res_offset
= bfd_getb32 (buf
+ 2);
355 entry
->mte_size
= bfd_getb32 (buf
+ 6);
356 entry
->mte_kind
= buf
[10];
357 entry
->mte_scope
= buf
[11];
358 entry
->mte_parent
= bfd_getb16 (buf
+ 12);
359 bfd_sym_parse_file_reference_v32 (buf
+ 14, 6, &entry
->mte_imp_fref
);
360 entry
->mte_imp_end
= bfd_getb32 (buf
+ 20);
361 entry
->mte_nte_index
= bfd_getb32 (buf
+ 24);
362 entry
->mte_cmte_index
= bfd_getb16 (buf
+ 28);
363 entry
->mte_cvte_index
= bfd_getb32 (buf
+ 30);
364 entry
->mte_clte_index
= bfd_getb16 (buf
+ 34);
365 entry
->mte_ctte_index
= bfd_getb16 (buf
+ 36);
366 entry
->mte_csnte_idx_1
= bfd_getb32 (buf
+ 38);
367 entry
->mte_csnte_idx_2
= bfd_getb32 (buf
+ 42);
371 bfd_sym_parse_file_references_table_entry_v32 (buf
, len
, entry
)
374 bfd_sym_file_references_table_entry
*entry
;
378 BFD_ASSERT (len
== 10);
380 memset (entry
, 0, sizeof (bfd_sym_file_references_table_entry
));
381 type
= bfd_getb16 (buf
);
385 case BFD_SYM_END_OF_LIST_3_2
:
386 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
389 case BFD_SYM_FILE_NAME_INDEX_3_2
:
390 entry
->filename
.type
= BFD_SYM_FILE_NAME_INDEX
;
391 entry
->filename
.nte_index
= bfd_getb32 (buf
+ 2);
392 entry
->filename
.mod_date
= bfd_getb32 (buf
+ 6);
396 entry
->entry
.mte_index
= type
;
397 entry
->entry
.file_offset
= bfd_getb32 (buf
+ 2);
402 bfd_sym_parse_contained_modules_table_entry_v32 (buf
, len
, entry
)
405 bfd_sym_contained_modules_table_entry
*entry
;
409 BFD_ASSERT (len
== 6);
411 memset (entry
, 0, sizeof (bfd_sym_contained_modules_table_entry
));
412 type
= bfd_getb16 (buf
);
416 case BFD_SYM_END_OF_LIST_3_2
:
417 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
421 entry
->entry
.mte_index
= type
;
422 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 2);
428 bfd_sym_parse_contained_variables_table_entry_v32 (buf
, len
, entry
)
431 bfd_sym_contained_variables_table_entry
*entry
;
435 BFD_ASSERT (len
== 26);
437 memset (entry
, 0, sizeof (bfd_sym_contained_variables_table_entry
));
438 type
= bfd_getb16 (buf
);
442 case BFD_SYM_END_OF_LIST_3_2
:
443 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
446 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
447 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
448 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
452 entry
->entry
.tte_index
= type
;
453 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 2);
454 entry
->entry
.file_delta
= bfd_getb16 (buf
+ 6);
455 entry
->entry
.scope
= buf
[8];
456 entry
->entry
.la_size
= buf
[9];
458 if (entry
->entry
.la_size
== BFD_SYM_CVTE_SCA
)
460 entry
->entry
.address
.scstruct
.sca_kind
= buf
[10];
461 entry
->entry
.address
.scstruct
.sca_class
= buf
[11];
462 entry
->entry
.address
.scstruct
.sca_offset
= bfd_getb32 (buf
+ 12);
464 else if (entry
->entry
.la_size
<= BFD_SYM_CVTE_SCA
)
466 #if BFD_SYM_CVTE_SCA > 0
467 memcpy (&entry
->entry
.address
.lastruct
.la
, buf
+ 10, BFD_SYM_CVTE_SCA
);
469 entry
->entry
.address
.lastruct
.la_kind
= buf
[23];
471 else if (entry
->entry
.la_size
== BFD_SYM_CVTE_BIG_LA
)
473 entry
->entry
.address
.biglastruct
.big_la
= bfd_getb32 (buf
+ 10);
474 entry
->entry
.address
.biglastruct
.big_la_kind
= buf
[12];
480 bfd_sym_parse_contained_statements_table_entry_v32 (buf
, len
, entry
)
483 bfd_sym_contained_statements_table_entry
*entry
;
487 BFD_ASSERT (len
== 8);
489 memset (entry
, 0, sizeof (bfd_sym_contained_statements_table_entry
));
490 type
= bfd_getb16 (buf
);
494 case BFD_SYM_END_OF_LIST_3_2
:
495 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
498 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
499 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
500 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
504 entry
->entry
.mte_index
= type
;
505 entry
->entry
.mte_offset
= bfd_getb16 (buf
+ 2);
506 entry
->entry
.file_delta
= bfd_getb32 (buf
+ 4);
512 bfd_sym_parse_contained_labels_table_entry_v32 (buf
, len
, entry
)
515 bfd_sym_contained_labels_table_entry
*entry
;
519 BFD_ASSERT (len
== 12);
521 memset (entry
, 0, sizeof (bfd_sym_contained_labels_table_entry
));
522 type
= bfd_getb16 (buf
);
526 case BFD_SYM_END_OF_LIST_3_2
:
527 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
530 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
531 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
532 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
536 entry
->entry
.mte_index
= type
;
537 entry
->entry
.mte_offset
= bfd_getb16 (buf
+ 2);
538 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 4);
539 entry
->entry
.file_delta
= bfd_getb16 (buf
+ 8);
540 entry
->entry
.scope
= bfd_getb16 (buf
+ 10);
546 bfd_sym_parse_type_table_entry_v32 (buf
, len
, entry
)
549 bfd_sym_type_table_entry
*entry
;
551 BFD_ASSERT (len
== 4);
553 *entry
= bfd_getb32 (buf
);
557 bfd_sym_fetch_resources_table_entry (abfd
, entry
, index
)
559 bfd_sym_resources_table_entry
*entry
;
562 void (*parser
) PARAMS ((unsigned char *, size_t,
563 bfd_sym_resources_table_entry
*));
564 unsigned long offset
;
565 unsigned long entry_size
;
566 unsigned char buf
[18];
567 bfd_sym_data_struct
*sdata
= NULL
;
570 BFD_ASSERT (bfd_sym_valid (abfd
));
571 sdata
= abfd
->tdata
.sym_data
;
576 switch (sdata
->version
)
578 case BFD_SYM_VERSION_3_5
:
579 case BFD_SYM_VERSION_3_4
:
582 case BFD_SYM_VERSION_3_3
:
583 case BFD_SYM_VERSION_3_2
:
585 parser
= bfd_sym_parse_resources_table_entry_v32
;
588 case BFD_SYM_VERSION_3_1
:
595 offset
= compute_offset (sdata
->header
.dshb_rte
.dti_first_page
,
596 sdata
->header
.dshb_page_size
,
599 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
601 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
604 (*parser
) (buf
, entry_size
, entry
);
610 bfd_sym_fetch_modules_table_entry (abfd
, entry
, index
)
612 bfd_sym_modules_table_entry
*entry
;
615 void (*parser
) PARAMS ((unsigned char *, size_t,
616 bfd_sym_modules_table_entry
*));
617 unsigned long offset
;
618 unsigned long entry_size
;
619 unsigned char buf
[46];
620 bfd_sym_data_struct
*sdata
= NULL
;
623 BFD_ASSERT (bfd_sym_valid (abfd
));
624 sdata
= abfd
->tdata
.sym_data
;
629 switch (sdata
->version
)
631 case BFD_SYM_VERSION_3_5
:
632 case BFD_SYM_VERSION_3_4
:
635 case BFD_SYM_VERSION_3_3
:
637 parser
= bfd_sym_parse_modules_table_entry_v33
;
640 case BFD_SYM_VERSION_3_2
:
641 case BFD_SYM_VERSION_3_1
:
648 offset
= compute_offset (sdata
->header
.dshb_mte
.dti_first_page
,
649 sdata
->header
.dshb_page_size
,
652 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
654 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
657 (*parser
) (buf
, entry_size
, entry
);
663 bfd_sym_fetch_file_references_table_entry (abfd
, entry
, index
)
665 bfd_sym_file_references_table_entry
*entry
;
668 void (*parser
) PARAMS ((unsigned char *, size_t,
669 bfd_sym_file_references_table_entry
*));
670 unsigned long offset
;
671 unsigned long entry_size
= 0;
672 unsigned char buf
[8];
673 bfd_sym_data_struct
*sdata
= NULL
;
676 BFD_ASSERT (bfd_sym_valid (abfd
));
677 sdata
= abfd
->tdata
.sym_data
;
682 switch (sdata
->version
)
684 case BFD_SYM_VERSION_3_3
:
685 case BFD_SYM_VERSION_3_2
:
687 parser
= bfd_sym_parse_file_references_table_entry_v32
;
690 case BFD_SYM_VERSION_3_5
:
691 case BFD_SYM_VERSION_3_4
:
692 case BFD_SYM_VERSION_3_1
:
700 offset
= compute_offset (sdata
->header
.dshb_frte
.dti_first_page
,
701 sdata
->header
.dshb_page_size
,
704 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
706 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
709 (*parser
) (buf
, entry_size
, entry
);
715 bfd_sym_fetch_contained_modules_table_entry (abfd
, entry
, index
)
717 bfd_sym_contained_modules_table_entry
*entry
;
720 void (*parser
) PARAMS ((unsigned char *, size_t,
721 bfd_sym_contained_modules_table_entry
*));
722 unsigned long offset
;
723 unsigned long entry_size
= 0;
724 unsigned char buf
[6];
725 bfd_sym_data_struct
*sdata
= NULL
;
728 BFD_ASSERT (bfd_sym_valid (abfd
));
729 sdata
= abfd
->tdata
.sym_data
;
734 switch (sdata
->version
)
736 case BFD_SYM_VERSION_3_3
:
737 case BFD_SYM_VERSION_3_2
:
739 parser
= bfd_sym_parse_contained_modules_table_entry_v32
;
742 case BFD_SYM_VERSION_3_5
:
743 case BFD_SYM_VERSION_3_4
:
744 case BFD_SYM_VERSION_3_1
:
752 offset
= compute_offset (sdata
->header
.dshb_cmte
.dti_first_page
,
753 sdata
->header
.dshb_page_size
,
756 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
758 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
761 (*parser
) (buf
, entry_size
, entry
);
767 bfd_sym_fetch_contained_variables_table_entry (abfd
, entry
, index
)
769 bfd_sym_contained_variables_table_entry
*entry
;
772 void (*parser
) PARAMS ((unsigned char *, size_t,
773 bfd_sym_contained_variables_table_entry
*));
774 unsigned long offset
;
775 unsigned long entry_size
= 0;
776 unsigned char buf
[26];
777 bfd_sym_data_struct
*sdata
= NULL
;
780 BFD_ASSERT (bfd_sym_valid (abfd
));
781 sdata
= abfd
->tdata
.sym_data
;
786 switch (sdata
->version
)
788 case BFD_SYM_VERSION_3_3
:
789 case BFD_SYM_VERSION_3_2
:
791 parser
= bfd_sym_parse_contained_variables_table_entry_v32
;
794 case BFD_SYM_VERSION_3_5
:
795 case BFD_SYM_VERSION_3_4
:
796 case BFD_SYM_VERSION_3_1
:
804 offset
= compute_offset (sdata
->header
.dshb_cvte
.dti_first_page
,
805 sdata
->header
.dshb_page_size
,
808 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
810 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
813 (*parser
) (buf
, entry_size
, entry
);
819 bfd_sym_fetch_contained_statements_table_entry (abfd
, entry
, index
)
821 bfd_sym_contained_statements_table_entry
*entry
;
824 void (*parser
) PARAMS ((unsigned char *, size_t,
825 bfd_sym_contained_statements_table_entry
*));
826 unsigned long offset
;
827 unsigned long entry_size
= 0;
828 unsigned char buf
[8];
829 bfd_sym_data_struct
*sdata
= NULL
;
832 BFD_ASSERT (bfd_sym_valid (abfd
));
833 sdata
= abfd
->tdata
.sym_data
;
838 switch (sdata
->version
)
840 case BFD_SYM_VERSION_3_3
:
841 case BFD_SYM_VERSION_3_2
:
843 parser
= bfd_sym_parse_contained_statements_table_entry_v32
;
846 case BFD_SYM_VERSION_3_5
:
847 case BFD_SYM_VERSION_3_4
:
848 case BFD_SYM_VERSION_3_1
:
856 offset
= compute_offset (sdata
->header
.dshb_csnte
.dti_first_page
,
857 sdata
->header
.dshb_page_size
,
860 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
862 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
865 (*parser
) (buf
, entry_size
, entry
);
871 bfd_sym_fetch_contained_labels_table_entry (abfd
, entry
, index
)
873 bfd_sym_contained_labels_table_entry
*entry
;
876 void (*parser
) PARAMS ((unsigned char *, size_t,
877 bfd_sym_contained_labels_table_entry
*));
878 unsigned long offset
;
879 unsigned long entry_size
= 0;
880 unsigned char buf
[12];
881 bfd_sym_data_struct
*sdata
= NULL
;
884 BFD_ASSERT (bfd_sym_valid (abfd
));
885 sdata
= abfd
->tdata
.sym_data
;
890 switch (sdata
->version
)
892 case BFD_SYM_VERSION_3_3
:
893 case BFD_SYM_VERSION_3_2
:
895 parser
= bfd_sym_parse_contained_labels_table_entry_v32
;
898 case BFD_SYM_VERSION_3_5
:
899 case BFD_SYM_VERSION_3_4
:
900 case BFD_SYM_VERSION_3_1
:
908 offset
= compute_offset (sdata
->header
.dshb_clte
.dti_first_page
,
909 sdata
->header
.dshb_page_size
,
912 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
914 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
917 (*parser
) (buf
, entry_size
, entry
);
923 bfd_sym_fetch_contained_types_table_entry (abfd
, entry
, index
)
925 bfd_sym_contained_types_table_entry
*entry
;
928 void (*parser
) PARAMS ((unsigned char *, size_t,
929 bfd_sym_contained_types_table_entry
*));
930 unsigned long offset
;
931 unsigned long entry_size
= 0;
932 unsigned char buf
[0];
933 bfd_sym_data_struct
*sdata
= NULL
;
936 BFD_ASSERT (bfd_sym_valid (abfd
));
937 sdata
= abfd
->tdata
.sym_data
;
942 switch (sdata
->version
)
944 case BFD_SYM_VERSION_3_3
:
945 case BFD_SYM_VERSION_3_2
:
950 case BFD_SYM_VERSION_3_5
:
951 case BFD_SYM_VERSION_3_4
:
952 case BFD_SYM_VERSION_3_1
:
960 offset
= compute_offset (sdata
->header
.dshb_ctte
.dti_first_page
,
961 sdata
->header
.dshb_page_size
,
964 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
966 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
969 (*parser
) (buf
, entry_size
, entry
);
975 bfd_sym_fetch_file_references_index_table_entry (abfd
, entry
, index
)
977 bfd_sym_file_references_index_table_entry
*entry
;
980 void (*parser
) PARAMS ((unsigned char *, size_t,
981 bfd_sym_file_references_index_table_entry
*));
982 unsigned long offset
;
983 unsigned long entry_size
= 0;
984 unsigned char buf
[0];
985 bfd_sym_data_struct
*sdata
= NULL
;
988 BFD_ASSERT (bfd_sym_valid (abfd
));
989 sdata
= abfd
->tdata
.sym_data
;
994 switch (sdata
->version
)
996 case BFD_SYM_VERSION_3_3
:
997 case BFD_SYM_VERSION_3_2
:
1002 case BFD_SYM_VERSION_3_5
:
1003 case BFD_SYM_VERSION_3_4
:
1004 case BFD_SYM_VERSION_3_1
:
1012 offset
= compute_offset (sdata
->header
.dshb_fite
.dti_first_page
,
1013 sdata
->header
.dshb_page_size
,
1016 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1018 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1021 (*parser
) (buf
, entry_size
, entry
);
1027 bfd_sym_fetch_constant_pool_entry (abfd
, entry
, index
)
1029 bfd_sym_constant_pool_entry
*entry
;
1030 unsigned long index
;
1032 void (*parser
) PARAMS ((unsigned char *, size_t,
1033 bfd_sym_constant_pool_entry
*));
1034 unsigned long offset
;
1035 unsigned long entry_size
= 0;
1036 unsigned char buf
[0];
1037 bfd_sym_data_struct
*sdata
= NULL
;
1040 BFD_ASSERT (bfd_sym_valid (abfd
));
1041 sdata
= abfd
->tdata
.sym_data
;
1046 switch (sdata
->version
)
1048 case BFD_SYM_VERSION_3_3
:
1049 case BFD_SYM_VERSION_3_2
:
1054 case BFD_SYM_VERSION_3_5
:
1055 case BFD_SYM_VERSION_3_4
:
1056 case BFD_SYM_VERSION_3_1
:
1064 offset
= compute_offset (sdata
->header
.dshb_fite
.dti_first_page
,
1065 sdata
->header
.dshb_page_size
,
1068 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1070 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1073 (*parser
) (buf
, entry_size
, entry
);
1079 bfd_sym_fetch_type_table_entry (abfd
, entry
, index
)
1081 bfd_sym_type_table_entry
*entry
;
1082 unsigned long index
;
1084 void (*parser
) PARAMS ((unsigned char *, size_t,
1085 bfd_sym_type_table_entry
*));
1086 unsigned long offset
;
1087 unsigned long entry_size
= 0;
1088 unsigned char buf
[4];
1089 bfd_sym_data_struct
*sdata
= NULL
;
1092 BFD_ASSERT (bfd_sym_valid (abfd
));
1093 sdata
= abfd
->tdata
.sym_data
;
1095 switch (sdata
->version
)
1097 case BFD_SYM_VERSION_3_3
:
1098 case BFD_SYM_VERSION_3_2
:
1100 parser
= bfd_sym_parse_type_table_entry_v32
;
1103 case BFD_SYM_VERSION_3_5
:
1104 case BFD_SYM_VERSION_3_4
:
1105 case BFD_SYM_VERSION_3_1
:
1113 offset
= compute_offset (sdata
->header
.dshb_tte
.dti_first_page
,
1114 sdata
->header
.dshb_page_size
,
1117 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1119 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1122 (*parser
) (buf
, entry_size
, entry
);
1128 bfd_sym_fetch_type_information_table_entry (abfd
, entry
, offset
)
1130 bfd_sym_type_information_table_entry
*entry
;
1131 unsigned long offset
;
1133 unsigned char buf
[4];
1134 bfd_sym_data_struct
*sdata
= NULL
;
1136 BFD_ASSERT (bfd_sym_valid (abfd
));
1137 sdata
= abfd
->tdata
.sym_data
;
1142 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1145 if (bfd_bread (buf
, 4, abfd
) != 4)
1147 entry
->nte_index
= bfd_getb32 (buf
);
1149 if (bfd_bread (buf
, 2, abfd
) != 2)
1151 entry
->physical_size
= bfd_getb16 (buf
);
1153 if (entry
->physical_size
& 0x8000)
1155 if (bfd_bread (buf
, 4, abfd
) != 4)
1157 entry
->physical_size
&= 0x7fff;
1158 entry
->logical_size
= bfd_getb32 (buf
);
1159 entry
->offset
= offset
+ 10;
1163 if (bfd_bread (buf
, 2, abfd
) != 2)
1165 entry
->physical_size
&= 0x7fff;
1166 entry
->logical_size
= bfd_getb16 (buf
);
1167 entry
->offset
= offset
+ 8;
1174 bfd_sym_fetch_type_table_information (abfd
, entry
, index
)
1176 bfd_sym_type_information_table_entry
*entry
;
1177 unsigned long index
;
1179 bfd_sym_type_table_entry tindex
;
1180 bfd_sym_data_struct
*sdata
= NULL
;
1182 BFD_ASSERT (bfd_sym_valid (abfd
));
1183 sdata
= abfd
->tdata
.sym_data
;
1185 if (sdata
->header
.dshb_tte
.dti_object_count
<= 99)
1190 if (bfd_sym_fetch_type_table_entry (abfd
, &tindex
, index
- 100) < 0)
1192 if (bfd_sym_fetch_type_information_table_entry (abfd
, entry
, tindex
) < 0)
1198 const unsigned char *
1199 bfd_sym_symbol_name (abfd
, index
)
1201 unsigned long index
;
1203 bfd_sym_data_struct
*sdata
= NULL
;
1205 BFD_ASSERT (bfd_sym_valid (abfd
));
1206 sdata
= abfd
->tdata
.sym_data
;
1209 return (const unsigned char *) "";
1212 if ((index
/ sdata
->header
.dshb_page_size
)
1213 > sdata
->header
.dshb_nte
.dti_page_count
)
1214 return (const unsigned char *) "\09[INVALID]";
1216 return (const unsigned char *) sdata
->name_table
+ index
;
1219 const unsigned char *
1220 bfd_sym_module_name (abfd
, index
)
1222 unsigned long index
;
1224 bfd_sym_modules_table_entry entry
;
1226 if (bfd_sym_fetch_modules_table_entry (abfd
, &entry
, index
) < 0)
1227 return (const unsigned char *) "\09[INVALID]";
1229 return bfd_sym_symbol_name (abfd
, entry
.mte_nte_index
);
1233 bfd_sym_unparse_storage_kind (kind
)
1234 enum bfd_sym_storage_kind kind
;
1238 case BFD_SYM_STORAGE_KIND_LOCAL
: return "LOCAL";
1239 case BFD_SYM_STORAGE_KIND_VALUE
: return "VALUE";
1240 case BFD_SYM_STORAGE_KIND_REFERENCE
: return "REFERENCE";
1241 case BFD_SYM_STORAGE_KIND_WITH
: return "WITH";
1242 default: return "[UNKNOWN]";
1247 bfd_sym_unparse_storage_class (kind
)
1248 enum bfd_sym_storage_class kind
;
1252 case BFD_SYM_STORAGE_CLASS_REGISTER
: return "REGISTER";
1253 case BFD_SYM_STORAGE_CLASS_GLOBAL
: return "GLOBAL";
1254 case BFD_SYM_STORAGE_CLASS_FRAME_RELATIVE
: return "FRAME_RELATIVE";
1255 case BFD_SYM_STORAGE_CLASS_STACK_RELATIVE
: return "STACK_RELATIVE";
1256 case BFD_SYM_STORAGE_CLASS_ABSOLUTE
: return "ABSOLUTE";
1257 case BFD_SYM_STORAGE_CLASS_CONSTANT
: return "CONSTANT";
1258 case BFD_SYM_STORAGE_CLASS_RESOURCE
: return "RESOURCE";
1259 case BFD_SYM_STORAGE_CLASS_BIGCONSTANT
: return "BIGCONSTANT";
1260 default: return "[UNKNOWN]";
1265 bfd_sym_unparse_module_kind (kind
)
1266 enum bfd_sym_module_kind kind
;
1270 case BFD_SYM_MODULE_KIND_NONE
: return "NONE";
1271 case BFD_SYM_MODULE_KIND_PROGRAM
: return "PROGRAM";
1272 case BFD_SYM_MODULE_KIND_UNIT
: return "UNIT";
1273 case BFD_SYM_MODULE_KIND_PROCEDURE
: return "PROCEDURE";
1274 case BFD_SYM_MODULE_KIND_FUNCTION
: return "FUNCTION";
1275 case BFD_SYM_MODULE_KIND_DATA
: return "DATA";
1276 case BFD_SYM_MODULE_KIND_BLOCK
: return "BLOCK";
1277 default: return "[UNKNOWN]";
1282 bfd_sym_unparse_symbol_scope (scope
)
1283 enum bfd_sym_symbol_scope scope
;
1287 case BFD_SYM_SYMBOL_SCOPE_LOCAL
: return "LOCAL";
1288 case BFD_SYM_SYMBOL_SCOPE_GLOBAL
: return "GLOBAL";
1295 bfd_sym_print_file_reference (abfd
, f
, entry
)
1298 bfd_sym_file_reference
*entry
;
1300 bfd_sym_file_references_table_entry frtentry
;
1303 ret
= bfd_sym_fetch_file_references_table_entry (abfd
, &frtentry
,
1304 entry
->fref_frte_index
);
1305 fprintf (f
, "FILE ");
1307 if ((ret
< 0) || (frtentry
.generic
.type
!= BFD_SYM_FILE_NAME_INDEX
))
1308 fprintf (f
, "[INVALID]");
1310 fprintf (f
, "\"%.*s\"",
1311 bfd_sym_symbol_name (abfd
, frtentry
.filename
.nte_index
)[0],
1312 &bfd_sym_symbol_name (abfd
, frtentry
.filename
.nte_index
)[1]);
1314 fprintf (f
, " (FRTE %lu)", entry
->fref_frte_index
);
1318 bfd_sym_print_resources_table_entry (abfd
, f
, entry
)
1321 bfd_sym_resources_table_entry
*entry
;
1323 fprintf (f
, " \"%.*s\" (NTE %lu), type \"%.4s\", num %u, size %lu, MTE %lu -- %lu",
1324 bfd_sym_symbol_name (abfd
, entry
->rte_nte_index
)[0],
1325 &bfd_sym_symbol_name (abfd
, entry
->rte_nte_index
)[1],
1326 entry
->rte_nte_index
, entry
->rte_res_type
, entry
->rte_res_number
,
1327 entry
->rte_res_size
, entry
->rte_mte_first
, entry
->rte_mte_last
);
1331 bfd_sym_print_modules_table_entry (abfd
, f
, entry
)
1334 bfd_sym_modules_table_entry
*entry
;
1336 fprintf (f
, "\"%.*s\" (NTE %lu)",
1337 bfd_sym_symbol_name (abfd
, entry
->mte_nte_index
)[0],
1338 &bfd_sym_symbol_name (abfd
, entry
->mte_nte_index
)[1],
1339 entry
->mte_nte_index
);
1343 bfd_sym_print_file_reference (abfd
, f
, &entry
->mte_imp_fref
);
1344 fprintf (f
, " range %lu -- %lu",
1345 entry
->mte_imp_fref
.fref_offset
, entry
->mte_imp_end
);
1349 fprintf (f
, "kind %s", bfd_sym_unparse_module_kind (entry
->mte_kind
));
1350 fprintf (f
, ", scope %s", bfd_sym_unparse_symbol_scope (entry
->mte_scope
));
1352 fprintf (f
, ", RTE %lu, offset %lu, size %lu",
1353 entry
->mte_rte_index
, entry
->mte_res_offset
, entry
->mte_size
);
1357 fprintf (f
, "CMTE %lu, CVTE %lu, CLTE %lu, CTTE %lu, CSNTE1 %lu, CSNTE2 %lu",
1358 entry
->mte_cmte_index
, entry
->mte_cvte_index
,
1359 entry
->mte_clte_index
, entry
->mte_ctte_index
,
1360 entry
->mte_csnte_idx_1
, entry
->mte_csnte_idx_2
);
1362 if (entry
->mte_parent
!= 0)
1363 fprintf (f
, ", parent %lu", entry
->mte_parent
);
1365 fprintf (f
, ", no parent");
1367 if (entry
->mte_cmte_index
!= 0)
1368 fprintf (f
, ", child %lu", entry
->mte_cmte_index
);
1370 fprintf (f
, ", no child");
1374 bfd_sym_print_file_references_table_entry (abfd
, f
, entry
)
1377 bfd_sym_file_references_table_entry
*entry
;
1379 switch (entry
->generic
.type
)
1381 case BFD_SYM_FILE_NAME_INDEX
:
1382 fprintf (f
, "FILE \"%.*s\" (NTE %lu), modtime ",
1383 bfd_sym_symbol_name (abfd
, entry
->filename
.nte_index
)[0],
1384 &bfd_sym_symbol_name (abfd
, entry
->filename
.nte_index
)[1],
1385 entry
->filename
.nte_index
);
1387 fprintf (f
, "[UNIMPLEMENTED]");
1388 /* printModDate (entry->filename.mod_date); */
1389 fprintf (f
, " (0x%lx)", entry
->filename
.mod_date
);
1392 case BFD_SYM_END_OF_LIST
:
1397 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu",
1398 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1399 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1400 entry
->entry
.mte_index
,
1401 entry
->entry
.file_offset
);
1407 bfd_sym_print_contained_modules_table_entry (abfd
, f
, entry
)
1410 bfd_sym_contained_modules_table_entry
*entry
;
1412 switch (entry
->generic
.type
)
1414 case BFD_SYM_END_OF_LIST
:
1419 fprintf (f
, "\"%.*s\" (MTE %lu, NTE %lu)",
1420 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1421 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1422 entry
->entry
.mte_index
,
1423 entry
->entry
.nte_index
);
1429 bfd_sym_print_contained_variables_table_entry (abfd
, f
, entry
)
1432 bfd_sym_contained_variables_table_entry
*entry
;
1434 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1440 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1442 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1443 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1447 fprintf (f
, "\"%.*s\" (NTE %lu)",
1448 bfd_sym_symbol_name (abfd
, entry
->entry
.nte_index
)[0],
1449 &bfd_sym_symbol_name (abfd
, entry
->entry
.nte_index
)[1],
1450 entry
->entry
.nte_index
);
1452 fprintf (f
, ", TTE %lu", entry
->entry
.tte_index
);
1453 fprintf (f
, ", offset %lu", entry
->entry
.file_delta
);
1454 fprintf (f
, ", scope %s", bfd_sym_unparse_symbol_scope (entry
->entry
.scope
));
1456 if (entry
->entry
.la_size
== BFD_SYM_CVTE_SCA
)
1457 fprintf (f
, ", latype %s, laclass %s, laoffset %lu",
1458 bfd_sym_unparse_storage_kind (entry
->entry
.address
.scstruct
.sca_kind
),
1459 bfd_sym_unparse_storage_class (entry
->entry
.address
.scstruct
.sca_class
),
1460 entry
->entry
.address
.scstruct
.sca_offset
);
1461 else if (entry
->entry
.la_size
<= BFD_SYM_CVTE_LA_MAX_SIZE
)
1465 fprintf (f
, ", la [");
1466 for (i
= 0; i
< entry
->entry
.la_size
; i
++)
1467 fprintf (f
, "0x%02x ", entry
->entry
.address
.lastruct
.la
[i
]);
1470 else if (entry
->entry
.la_size
== BFD_SYM_CVTE_BIG_LA
)
1471 fprintf (f
, ", bigla %lu, biglakind %u",
1472 entry
->entry
.address
.biglastruct
.big_la
,
1473 entry
->entry
.address
.biglastruct
.big_la_kind
);
1476 fprintf (f
, ", la [INVALID]");
1480 bfd_sym_print_contained_statements_table_entry (abfd
, f
, entry
)
1483 bfd_sym_contained_statements_table_entry
*entry
;
1485 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1491 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1493 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1494 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1498 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu, delta %lu",
1499 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1500 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1501 entry
->entry
.mte_index
,
1502 entry
->entry
.mte_offset
,
1503 entry
->entry
.file_delta
);
1507 bfd_sym_print_contained_labels_table_entry (abfd
, f
, entry
)
1510 bfd_sym_contained_labels_table_entry
*entry
;
1512 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1518 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1520 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1521 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1525 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu, delta %lu, scope %s",
1526 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1527 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1528 entry
->entry
.mte_index
,
1529 entry
->entry
.mte_offset
,
1530 entry
->entry
.file_delta
,
1531 bfd_sym_unparse_symbol_scope (entry
->entry
.scope
));
1535 bfd_sym_print_contained_types_table_entry (abfd
, f
, entry
)
1536 bfd
*abfd ATTRIBUTE_UNUSED
;
1538 bfd_sym_contained_types_table_entry
*entry ATTRIBUTE_UNUSED
;
1540 fprintf (f
, "[UNIMPLEMENTED]");
1544 bfd_sym_type_operator_name (num
)
1549 case 1: return "TTE";
1550 case 2: return "PointerTo";
1551 case 3: return "ScalarOf";
1552 case 4: return "ConstantOf";
1553 case 5: return "EnumerationOf";
1554 case 6: return "VectorOf";
1555 case 7: return "RecordOf";
1556 case 8: return "UnionOf";
1557 case 9: return "SubRangeOf";
1558 case 10: return "SetOf";
1559 case 11: return "NamedTypeOf";
1560 case 12: return "ProcOf";
1561 case 13: return "ValueOf";
1562 case 14: return "ArrayOf";
1563 default: return "[UNKNOWN OPERATOR]";
1568 bfd_sym_type_basic_name (num
)
1573 case 0: return "void";
1574 case 1: return "pascal string";
1575 case 2: return "unsigned long";
1576 case 3: return "signed long";
1577 case 4: return "extended (10 bytes)";
1578 case 5: return "pascal boolean (1 byte)";
1579 case 6: return "unsigned byte";
1580 case 7: return "signed byte";
1581 case 8: return "character (1 byte)";
1582 case 9: return "wide character (2 bytes)";
1583 case 10: return "unsigned short";
1584 case 11: return "signed short";
1585 case 12: return "singled";
1586 case 13: return "double";
1587 case 14: return "extended (12 bytes)";
1588 case 15: return "computational (8 bytes)";
1589 case 16: return "c string";
1590 case 17: return "as-is string";
1591 default: return "[UNKNOWN BASIC TYPE]";
1596 bfd_sym_fetch_long (buf
, len
, offset
, offsetptr
, value
)
1599 unsigned long offset
;
1600 unsigned long *offsetptr
;
1611 else if (! (buf
[offset
] & 0x80))
1613 *value
= buf
[offset
];
1617 else if (buf
[offset
] == 0xc0)
1619 if ((offset
+ 5) > len
)
1627 *value
= bfd_getb32 (buf
+ offset
+ 1);
1632 else if ((buf
[offset
] & 0xc0) == 0xc0)
1634 *value
= -(buf
[offset
] & 0x3f);
1638 else if ((buf
[offset
] & 0xc0) == 0x80)
1640 if ((offset
+ 2) > len
)
1648 *value
= bfd_getb16 (buf
+ offset
) & 0x3fff;
1656 if (offsetptr
!= NULL
)
1657 *offsetptr
= offset
;
1663 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, offsetptr
)
1668 unsigned long offset
;
1669 unsigned long *offsetptr
;
1675 fprintf (f
, "[NULL]");
1677 if (offsetptr
!= NULL
)
1678 *offsetptr
= offset
;
1685 if (! (type
& 0x80))
1687 fprintf (f
, "[%s] (0x%x)", bfd_sym_type_basic_name (type
& 0x7f), type
);
1689 if (offsetptr
!= NULL
)
1690 *offsetptr
= offset
;
1695 fprintf (f
, "[packed ");
1699 switch (type
& 0x3f)
1704 bfd_sym_type_information_table_entry tinfo
;
1706 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1708 fprintf (f
, "[INVALID]");
1711 if (bfd_sym_fetch_type_table_information (abfd
, &tinfo
, value
) < 0)
1712 fprintf (f
, "[INVALID]");
1714 fprintf (f
, "\"%.*s\"",
1715 bfd_sym_symbol_name (abfd
, tinfo
.nte_index
)[0],
1716 &bfd_sym_symbol_name (abfd
, tinfo
.nte_index
)[1]);
1718 fprintf (f
, " (TTE %lu)", value
);
1723 fprintf (f
, "pointer (0x%x) to ", type
);
1724 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1731 fprintf (f
, "scalar (0x%x) of ", type
);
1732 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1733 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1734 fprintf (f
, " (%lu)", (unsigned long) value
);
1740 long lower
, upper
, nelem
;
1743 fprintf (f
, "enumeration (0x%x) of ", type
);
1744 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1745 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &lower
);
1746 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &upper
);
1747 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &nelem
);
1748 fprintf (f
, " from %lu to %lu with %lu elements: ",
1749 (unsigned long) lower
, (unsigned long) upper
,
1750 (unsigned long) nelem
);
1752 for (i
= 0; i
< nelem
; i
++)
1755 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1761 fprintf (f
, "vector (0x%x)", type
);
1762 fprintf (f
, "\n index ");
1763 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1764 fprintf (f
, "\n target ");
1765 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1771 long nrec
, eloff
, i
;
1773 if ((type
& 0x3f) == 7)
1774 fprintf (f
, "record (0x%x) of ", type
);
1776 fprintf (f
, "union (0x%x) of ", type
);
1778 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &nrec
);
1779 fprintf (f
, "%lu elements: ", nrec
);
1781 for (i
= 0; i
< nrec
; i
++)
1783 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &eloff
);
1785 fprintf (f
, "offset %lu: ", eloff
);
1786 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1792 fprintf (f
, "subrange (0x%x) of ", type
);
1793 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1794 fprintf (f
, " lower ");
1795 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1796 fprintf (f
, " upper ");
1797 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1804 fprintf (f
, "named type (0x%x) ", type
);
1805 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1807 fprintf (f
, "[INVALID]");
1809 fprintf (f
, "\"%.*s\"",
1810 bfd_sym_symbol_name (abfd
, value
)[0],
1811 &bfd_sym_symbol_name (abfd
, value
)[1]);
1813 fprintf (f
, " (NTE %lu) with type ", value
);
1814 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1819 fprintf (f
, "%s (0x%x)", bfd_sym_type_operator_name (type
), type
);
1823 if (type
== (0x40 | 0x6))
1830 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &n
);
1831 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &width
);
1832 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &m
);
1833 /* fprintf (f, "\n "); */
1834 fprintf (f
, " N %ld, width %ld, M %ld, ", n
, width
, m
);
1835 for (i
= 0; i
< m
; i
++)
1837 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &l
);
1840 fprintf (f
, "%ld", l
);
1843 else if (type
& 0x40)
1845 /* Other packed type. */
1848 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &msb
);
1849 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &lsb
);
1850 /* fprintf (f, "\n "); */
1851 fprintf (f
, " msb %ld, lsb %ld", msb
, lsb
);
1856 if (offsetptr
!= NULL
)
1857 *offsetptr
= offset
;
1861 bfd_sym_print_type_information_table_entry (abfd
, f
, entry
)
1864 bfd_sym_type_information_table_entry
*entry
;
1867 unsigned long offset
;
1870 fprintf (f
, "\"%.*s\" (NTE %lu), %lu bytes at %lu, logical size %lu",
1871 bfd_sym_symbol_name (abfd
, entry
->nte_index
)[0],
1872 &bfd_sym_symbol_name (abfd
, entry
->nte_index
)[1],
1874 entry
->physical_size
, entry
->offset
, entry
->logical_size
);
1878 buf
= alloca (entry
->physical_size
);
1881 fprintf (f
, "[ERROR]\n");
1884 if (bfd_seek (abfd
, entry
->offset
, SEEK_SET
) < 0)
1886 fprintf (f
, "[ERROR]\n");
1889 if (bfd_bread (buf
, entry
->physical_size
, abfd
) != entry
->physical_size
)
1891 fprintf (f
, "[ERROR]\n");
1896 for (i
= 0; i
< entry
->physical_size
; i
++)
1899 fprintf (f
, "0x%02x", buf
[i
]);
1901 fprintf (f
, " 0x%02x", buf
[i
]);
1907 bfd_sym_print_type_information (abfd
, f
, buf
, entry
->physical_size
, 0, &offset
);
1909 if (offset
!= entry
->physical_size
)
1910 fprintf (f
, "\n [parser used %lu bytes instead of %lu]", offset
, entry
->physical_size
); }
1913 bfd_sym_print_file_references_index_table_entry (abfd
, f
, entry
)
1914 bfd
*abfd ATTRIBUTE_UNUSED
;
1916 bfd_sym_file_references_index_table_entry
*entry ATTRIBUTE_UNUSED
;
1918 fprintf (f
, "[UNIMPLEMENTED]");
1922 bfd_sym_print_constant_pool_entry (abfd
, f
, entry
)
1923 bfd
*abfd ATTRIBUTE_UNUSED
;
1925 bfd_sym_constant_pool_entry
*entry ATTRIBUTE_UNUSED
;
1927 fprintf (f
, "[UNIMPLEMENTED]");
1931 bfd_sym_display_name_table_entry (abfd
, f
, entry
)
1934 unsigned char *entry
;
1936 unsigned long index
;
1937 unsigned long offset
;
1938 bfd_sym_data_struct
*sdata
= NULL
;
1940 BFD_ASSERT (bfd_sym_valid (abfd
));
1941 sdata
= abfd
->tdata
.sym_data
;
1942 index
= (entry
- sdata
->name_table
) / 2;
1944 if (sdata
->version
>= BFD_SYM_VERSION_3_4
&& entry
[0] == 255 && entry
[1] == 0)
1946 unsigned short length
= bfd_getb16 (entry
+ 2);
1947 fprintf (f
, "[%8lu] \"%.*s\"\n", index
, length
, entry
+ 4);
1948 offset
= 2 + length
+ 1;
1952 if (! (entry
[0] == 0 || (entry
[0] == 1 && entry
[1] == '\0')))
1953 fprintf (f
, "[%8lu] \"%.*s\"\n", index
, entry
[0], entry
+ 1);
1955 if (sdata
->version
>= BFD_SYM_VERSION_3_4
)
1956 offset
= entry
[0] + 2;
1958 offset
= entry
[0] + 1;
1961 return (entry
+ offset
+ (offset
% 2));
1965 bfd_sym_display_name_table (abfd
, f
)
1969 unsigned long name_table_len
;
1970 unsigned char *name_table
, *name_table_end
, *cur
;
1971 bfd_sym_data_struct
*sdata
= NULL
;
1973 BFD_ASSERT (bfd_sym_valid (abfd
));
1974 sdata
= abfd
->tdata
.sym_data
;
1976 name_table_len
= sdata
->header
.dshb_nte
.dti_page_count
* sdata
->header
.dshb_page_size
;
1977 name_table
= sdata
->name_table
;
1978 name_table_end
= name_table
+ name_table_len
;
1980 fprintf (f
, "name table (NTE) contains %lu bytes:\n\n", name_table_len
);
1985 cur
= bfd_sym_display_name_table_entry (abfd
, f
, cur
);
1986 if (cur
>= name_table_end
)
1992 bfd_sym_display_resources_table (abfd
, f
)
1997 bfd_sym_resources_table_entry entry
;
1998 bfd_sym_data_struct
*sdata
= NULL
;
2000 BFD_ASSERT (bfd_sym_valid (abfd
));
2001 sdata
= abfd
->tdata
.sym_data
;
2003 fprintf (f
, "resource table (RTE) contains %lu objects:\n\n",
2004 sdata
->header
.dshb_rte
.dti_object_count
);
2006 for (i
= 1; i
<= sdata
->header
.dshb_rte
.dti_object_count
; i
++)
2008 if (bfd_sym_fetch_resources_table_entry (abfd
, &entry
, i
) < 0)
2009 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2012 fprintf (f
, " [%8lu] ", i
);
2013 bfd_sym_print_resources_table_entry (abfd
, f
, &entry
);
2020 bfd_sym_display_modules_table (abfd
, f
)
2025 bfd_sym_modules_table_entry entry
;
2026 bfd_sym_data_struct
*sdata
= NULL
;
2028 BFD_ASSERT (bfd_sym_valid (abfd
));
2029 sdata
= abfd
->tdata
.sym_data
;
2031 fprintf (f
, "module table (MTE) contains %lu objects:\n\n",
2032 sdata
->header
.dshb_mte
.dti_object_count
);
2034 for (i
= 1; i
<= sdata
->header
.dshb_mte
.dti_object_count
; i
++)
2036 if (bfd_sym_fetch_modules_table_entry (abfd
, &entry
, i
) < 0)
2037 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2040 fprintf (f
, " [%8lu] ", i
);
2041 bfd_sym_print_modules_table_entry (abfd
, f
, &entry
);
2048 bfd_sym_display_file_references_table (abfd
, f
)
2053 bfd_sym_file_references_table_entry entry
;
2054 bfd_sym_data_struct
*sdata
= NULL
;
2056 BFD_ASSERT (bfd_sym_valid (abfd
));
2057 sdata
= abfd
->tdata
.sym_data
;
2059 fprintf (f
, "file reference table (FRTE) contains %lu objects:\n\n",
2060 sdata
->header
.dshb_frte
.dti_object_count
);
2062 for (i
= 1; i
<= sdata
->header
.dshb_frte
.dti_object_count
; i
++)
2064 if (bfd_sym_fetch_file_references_table_entry (abfd
, &entry
, i
) < 0)
2065 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2068 fprintf (f
, " [%8lu] ", i
);
2069 bfd_sym_print_file_references_table_entry (abfd
, f
, &entry
);
2076 bfd_sym_display_contained_modules_table (abfd
, f
)
2081 bfd_sym_contained_modules_table_entry entry
;
2082 bfd_sym_data_struct
*sdata
= NULL
;
2084 BFD_ASSERT (bfd_sym_valid (abfd
));
2085 sdata
= abfd
->tdata
.sym_data
;
2087 fprintf (f
, "contained modules table (CMTE) contains %lu objects:\n\n",
2088 sdata
->header
.dshb_cmte
.dti_object_count
);
2090 for (i
= 1; i
<= sdata
->header
.dshb_cmte
.dti_object_count
; i
++)
2092 if (bfd_sym_fetch_contained_modules_table_entry (abfd
, &entry
, i
) < 0)
2093 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2096 fprintf (f
, " [%8lu] ", i
);
2097 bfd_sym_print_contained_modules_table_entry (abfd
, f
, &entry
);
2104 bfd_sym_display_contained_variables_table (abfd
, f
)
2109 bfd_sym_contained_variables_table_entry entry
;
2110 bfd_sym_data_struct
*sdata
= NULL
;
2112 BFD_ASSERT (bfd_sym_valid (abfd
));
2113 sdata
= abfd
->tdata
.sym_data
;
2115 fprintf (f
, "contained variables table (CVTE) contains %lu objects:\n\n",
2116 sdata
->header
.dshb_cvte
.dti_object_count
);
2118 for (i
= 1; i
<= sdata
->header
.dshb_cvte
.dti_object_count
; i
++)
2120 if (bfd_sym_fetch_contained_variables_table_entry (abfd
, &entry
, i
) < 0)
2121 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2124 fprintf (f
, " [%8lu] ", i
);
2125 bfd_sym_print_contained_variables_table_entry (abfd
, f
, &entry
);
2134 bfd_sym_display_contained_statements_table (abfd
, f
)
2139 bfd_sym_contained_statements_table_entry entry
;
2140 bfd_sym_data_struct
*sdata
= NULL
;
2142 BFD_ASSERT (bfd_sym_valid (abfd
));
2143 sdata
= abfd
->tdata
.sym_data
;
2145 fprintf (f
, "contained statements table (CSNTE) contains %lu objects:\n\n",
2146 sdata
->header
.dshb_csnte
.dti_object_count
);
2148 for (i
= 1; i
<= sdata
->header
.dshb_csnte
.dti_object_count
; i
++)
2150 if (bfd_sym_fetch_contained_statements_table_entry (abfd
, &entry
, i
) < 0)
2151 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2154 fprintf (f
, " [%8lu] ", i
);
2155 bfd_sym_print_contained_statements_table_entry (abfd
, f
, &entry
);
2162 bfd_sym_display_contained_labels_table (abfd
, f
)
2167 bfd_sym_contained_labels_table_entry entry
;
2168 bfd_sym_data_struct
*sdata
= NULL
;
2170 BFD_ASSERT (bfd_sym_valid (abfd
));
2171 sdata
= abfd
->tdata
.sym_data
;
2173 fprintf (f
, "contained labels table (CLTE) contains %lu objects:\n\n",
2174 sdata
->header
.dshb_clte
.dti_object_count
);
2176 for (i
= 1; i
<= sdata
->header
.dshb_clte
.dti_object_count
; i
++)
2178 if (bfd_sym_fetch_contained_labels_table_entry (abfd
, &entry
, i
) < 0)
2179 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2182 fprintf (f
, " [%8lu] ", i
);
2183 bfd_sym_print_contained_labels_table_entry (abfd
, f
, &entry
);
2190 bfd_sym_display_contained_types_table (abfd
, f
)
2195 bfd_sym_contained_types_table_entry entry
;
2196 bfd_sym_data_struct
*sdata
= NULL
;
2198 BFD_ASSERT (bfd_sym_valid (abfd
));
2199 sdata
= abfd
->tdata
.sym_data
;
2201 fprintf (f
, "contained types table (CTTE) contains %lu objects:\n\n",
2202 sdata
->header
.dshb_ctte
.dti_object_count
);
2204 for (i
= 1; i
<= sdata
->header
.dshb_ctte
.dti_object_count
; i
++)
2206 if (bfd_sym_fetch_contained_types_table_entry (abfd
, &entry
, i
) < 0)
2207 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2210 fprintf (f
, " [%8lu] ", i
);
2211 bfd_sym_print_contained_types_table_entry (abfd
, f
, &entry
);
2218 bfd_sym_display_file_references_index_table (abfd
, f
)
2223 bfd_sym_file_references_index_table_entry entry
;
2224 bfd_sym_data_struct
*sdata
= NULL
;
2226 BFD_ASSERT (bfd_sym_valid (abfd
));
2227 sdata
= abfd
->tdata
.sym_data
;
2229 fprintf (f
, "file references index table (FITE) contains %lu objects:\n\n",
2230 sdata
->header
.dshb_fite
.dti_object_count
);
2232 for (i
= 1; i
<= sdata
->header
.dshb_fite
.dti_object_count
; i
++)
2234 if (bfd_sym_fetch_file_references_index_table_entry (abfd
, &entry
, i
) < 0)
2235 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2238 fprintf (f
, " [%8lu] ", i
);
2239 bfd_sym_print_file_references_index_table_entry (abfd
, f
, &entry
);
2246 bfd_sym_display_constant_pool (abfd
, f
)
2251 bfd_sym_constant_pool_entry entry
;
2252 bfd_sym_data_struct
*sdata
= NULL
;
2254 BFD_ASSERT (bfd_sym_valid (abfd
));
2255 sdata
= abfd
->tdata
.sym_data
;
2257 fprintf (f
, "constant pool (CONST) contains %lu objects:\n\n",
2258 sdata
->header
.dshb_const
.dti_object_count
);
2260 for (i
= 1; i
<= sdata
->header
.dshb_const
.dti_object_count
; i
++)
2262 if (bfd_sym_fetch_constant_pool_entry (abfd
, &entry
, i
) < 0)
2263 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2266 fprintf (f
, " [%8lu] ", i
);
2267 bfd_sym_print_constant_pool_entry (abfd
, f
, &entry
);
2274 bfd_sym_display_type_information_table (abfd
, f
)
2279 bfd_sym_type_table_entry index
;
2280 bfd_sym_type_information_table_entry entry
;
2281 bfd_sym_data_struct
*sdata
= NULL
;
2283 BFD_ASSERT (bfd_sym_valid (abfd
));
2284 sdata
= abfd
->tdata
.sym_data
;
2286 if (sdata
->header
.dshb_tte
.dti_object_count
> 99)
2287 fprintf (f
, "type table (TINFO) contains %lu objects:\n\n",
2288 sdata
->header
.dshb_tte
.dti_object_count
- 99);
2291 fprintf (f
, "type table (TINFO) contains [INVALID] objects:\n\n");
2295 for (i
= 100; i
<= sdata
->header
.dshb_tte
.dti_object_count
; i
++)
2297 if (bfd_sym_fetch_type_table_entry (abfd
, &index
, i
- 100) < 0)
2298 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2301 fprintf (f
, " [%8lu] (TINFO %lu) ", i
, index
);
2303 if (bfd_sym_fetch_type_information_table_entry (abfd
, &entry
, index
) < 0)
2304 fprintf (f
, "[INVALID]");
2306 bfd_sym_print_type_information_table_entry (abfd
, f
, &entry
);
2314 bfd_sym_scan (abfd
, version
, mdata
)
2316 bfd_sym_version version
;
2317 bfd_sym_data_struct
*mdata
;
2320 const char *name
= "symbols";
2322 mdata
->name_table
= 0;
2324 mdata
->version
= version
;
2326 bfd_seek (abfd
, 0, SEEK_SET
);
2327 if (bfd_sym_read_header (abfd
, &mdata
->header
, mdata
->version
) != 0)
2330 mdata
->name_table
= bfd_sym_read_name_table (abfd
, &mdata
->header
);
2331 if (mdata
->name_table
== NULL
)
2334 bfdsec
= bfd_make_section_anyway (abfd
, name
);
2341 bfdsec
->filepos
= 0;
2342 bfdsec
->alignment_power
= 0;
2344 bfdsec
->flags
= SEC_HAS_CONTENTS
;
2346 abfd
->tdata
.sym_data
= mdata
;
2352 bfd_sym_object_p (abfd
)
2355 struct bfd_preserve preserve
;
2356 bfd_sym_version version
= -1;
2358 preserve
.marker
= NULL
;
2359 bfd_seek (abfd
, 0, SEEK_SET
);
2360 if (bfd_sym_read_version (abfd
, &version
) != 0)
2363 preserve
.marker
= bfd_alloc (abfd
, sizeof (bfd_sym_data_struct
));
2364 if (preserve
.marker
== NULL
2365 || ! bfd_preserve_save (abfd
, &preserve
))
2368 if (bfd_sym_scan (abfd
, version
,
2369 (bfd_sym_data_struct
*) preserve
.marker
) != 0)
2372 bfd_preserve_finish (abfd
, &preserve
);
2376 bfd_set_error (bfd_error_wrong_format
);
2379 if (preserve
.marker
!= NULL
)
2380 bfd_preserve_restore (abfd
, &preserve
);
2385 bfd_sym_make_empty_symbol (abfd
)
2388 return (asymbol
*) bfd_alloc (abfd
, sizeof (asymbol
));
2392 bfd_sym_get_symbol_info (abfd
, symbol
, ret
)
2393 bfd
*abfd ATTRIBUTE_UNUSED
;
2397 bfd_symbol_info (symbol
, ret
);
2401 bfd_sym_get_symtab_upper_bound (abfd
)
2402 bfd
*abfd ATTRIBUTE_UNUSED
;
2408 bfd_sym_canonicalize_symtab (abfd
, sym
)
2409 bfd
*abfd ATTRIBUTE_UNUSED
;
2410 asymbol
**sym ATTRIBUTE_UNUSED
;
2416 bfd_sym_sizeof_headers (abfd
, exec
)
2417 bfd
*abfd ATTRIBUTE_UNUSED
;
2418 bfd_boolean exec ATTRIBUTE_UNUSED
;
2423 const bfd_target sym_vec
=
2426 bfd_target_sym_flavour
, /* flavour */
2427 BFD_ENDIAN_BIG
, /* byteorder */
2428 BFD_ENDIAN_BIG
, /* header_byteorder */
2429 (HAS_RELOC
| EXEC_P
| /* object flags */
2430 HAS_LINENO
| HAS_DEBUG
|
2431 HAS_SYMS
| HAS_LOCALS
| DYNAMIC
| WP_TEXT
| D_PAGED
),
2432 (SEC_ALLOC
| SEC_LOAD
| SEC_READONLY
| SEC_CODE
| SEC_DATA
2433 | SEC_ROM
| SEC_HAS_CONTENTS
), /* section_flags */
2434 0, /* symbol_leading_char */
2435 ' ', /* ar_pad_char */
2436 16, /* ar_max_namelen */
2437 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2438 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2439 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* data */
2440 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2441 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2442 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* hdrs */
2443 { /* bfd_check_format */
2445 bfd_sym_object_p
, /* bfd_check_format */
2449 { /* bfd_set_format */
2455 { /* bfd_write_contents */
2462 BFD_JUMP_TABLE_GENERIC (bfd_sym
),
2463 BFD_JUMP_TABLE_COPY (_bfd_generic
),
2464 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
2465 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive
),
2466 BFD_JUMP_TABLE_SYMBOLS (bfd_sym
),
2467 BFD_JUMP_TABLE_RELOCS (bfd_sym
),
2468 BFD_JUMP_TABLE_WRITE (bfd_sym
),
2469 BFD_JUMP_TABLE_LINK (bfd_sym
),
2470 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),