1 /* xSYM symbol-file support for BFD.
2 Copyright 1999, 2000, 2001, 2002, 2003, 2004
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 int pstrcmp
PARAMS ((unsigned char *, unsigned char *));
59 static unsigned long compute_offset
60 PARAMS ((unsigned long, unsigned long, unsigned long, unsigned long));
62 extern const bfd_target sym_vec
;
72 clen
= (a
[0] > b
[0]) ? a
[0] : b
[0];
73 ret
= memcmp (a
+ 1, b
+ 1, clen
);
86 compute_offset (first_page
, page_size
, entry_size
, index
)
87 unsigned long first_page
;
88 unsigned long page_size
;
89 unsigned long entry_size
;
92 unsigned long entries_per_page
= page_size
/ entry_size
;
93 unsigned long page_number
= first_page
+ (index
/ entries_per_page
);
94 unsigned long page_offset
= (index
% entries_per_page
) * entry_size
;
96 return (page_number
* page_size
) + page_offset
;
100 bfd_sym_mkobject (abfd
)
101 bfd
*abfd ATTRIBUTE_UNUSED
;
107 bfd_sym_print_symbol (abfd
, afile
, symbol
, how
)
108 bfd
*abfd ATTRIBUTE_UNUSED
;
109 PTR afile ATTRIBUTE_UNUSED
;
110 asymbol
*symbol ATTRIBUTE_UNUSED
;
111 bfd_print_symbol_type how ATTRIBUTE_UNUSED
;
120 if (abfd
== NULL
|| abfd
->xvec
== NULL
)
123 return abfd
->xvec
== &sym_vec
;
127 bfd_sym_read_name_table (abfd
, dshb
)
129 bfd_sym_header_block
*dshb
;
133 size_t table_size
= dshb
->dshb_nte
.dti_page_count
* dshb
->dshb_page_size
;
134 size_t table_offset
= dshb
->dshb_nte
.dti_first_page
* dshb
->dshb_page_size
;
136 rstr
= (unsigned char *) bfd_alloc (abfd
, table_size
);
140 bfd_seek (abfd
, table_offset
, SEEK_SET
);
141 ret
= bfd_bread (rstr
, table_size
, abfd
);
142 if (ret
< 0 || (unsigned long) ret
!= table_size
)
144 bfd_release (abfd
, rstr
);
152 bfd_sym_parse_file_reference_v32 (buf
, len
, entry
)
155 bfd_sym_file_reference
*entry
;
157 BFD_ASSERT (len
== 6);
159 entry
->fref_frte_index
= bfd_getb16 (buf
);
160 entry
->fref_offset
= bfd_getb32 (buf
+ 2);
164 bfd_sym_parse_disk_table_v32 (buf
, len
, table
)
167 bfd_sym_table_info
*table
;
169 BFD_ASSERT (len
== 8);
171 table
->dti_first_page
= bfd_getb16 (buf
);
172 table
->dti_page_count
= bfd_getb16 (buf
+ 2);
173 table
->dti_object_count
= bfd_getb32 (buf
+ 4);
177 bfd_sym_parse_header_v32 (buf
, len
, header
)
180 bfd_sym_header_block
*header
;
182 BFD_ASSERT (len
== 154);
184 memcpy (header
->dshb_id
, buf
, 32);
185 header
->dshb_page_size
= bfd_getb16 (buf
+ 32);
186 header
->dshb_hash_page
= bfd_getb16 (buf
+ 34);
187 header
->dshb_root_mte
= bfd_getb16 (buf
+ 36);
188 header
->dshb_mod_date
= bfd_getb32 (buf
+ 38);
190 bfd_sym_parse_disk_table_v32 (buf
+ 42, 8, &header
->dshb_frte
);
191 bfd_sym_parse_disk_table_v32 (buf
+ 50, 8, &header
->dshb_rte
);
192 bfd_sym_parse_disk_table_v32 (buf
+ 58, 8, &header
->dshb_mte
);
193 bfd_sym_parse_disk_table_v32 (buf
+ 66, 8, &header
->dshb_cmte
);
194 bfd_sym_parse_disk_table_v32 (buf
+ 74, 8, &header
->dshb_cvte
);
195 bfd_sym_parse_disk_table_v32 (buf
+ 82, 8, &header
->dshb_csnte
);
196 bfd_sym_parse_disk_table_v32 (buf
+ 90, 8, &header
->dshb_clte
);
197 bfd_sym_parse_disk_table_v32 (buf
+ 98, 8, &header
->dshb_ctte
);
198 bfd_sym_parse_disk_table_v32 (buf
+ 106, 8, &header
->dshb_tte
);
199 bfd_sym_parse_disk_table_v32 (buf
+ 114, 8, &header
->dshb_nte
);
200 bfd_sym_parse_disk_table_v32 (buf
+ 122, 8, &header
->dshb_tinfo
);
201 bfd_sym_parse_disk_table_v32 (buf
+ 130, 8, &header
->dshb_fite
);
202 bfd_sym_parse_disk_table_v32 (buf
+ 138, 8, &header
->dshb_const
);
204 memcpy (&header
->dshb_file_creator
, buf
+ 146, 4);
205 memcpy (&header
->dshb_file_type
, buf
+ 150, 4);
209 bfd_sym_read_header_v32 (abfd
, header
)
211 bfd_sym_header_block
*header
;
213 unsigned char buf
[154];
216 ret
= bfd_bread (buf
, 154, abfd
);
220 bfd_sym_parse_header_v32 (buf
, 154, header
);
226 bfd_sym_read_header_v34 (abfd
, header
)
227 bfd
*abfd ATTRIBUTE_UNUSED
;
228 bfd_sym_header_block
*header ATTRIBUTE_UNUSED
;
234 bfd_sym_read_header (abfd
, header
, version
)
236 bfd_sym_header_block
*header
;
237 bfd_sym_version version
;
241 case BFD_SYM_VERSION_3_5
:
242 case BFD_SYM_VERSION_3_4
:
243 return bfd_sym_read_header_v34 (abfd
, header
);
244 case BFD_SYM_VERSION_3_3
:
245 case BFD_SYM_VERSION_3_2
:
246 return bfd_sym_read_header_v32 (abfd
, header
);
247 case BFD_SYM_VERSION_3_1
:
254 bfd_sym_read_version (abfd
, version
)
256 bfd_sym_version
*version
;
258 unsigned char version_string
[32];
261 ret
= bfd_bread (version_string
, sizeof (version_string
), abfd
);
262 if (ret
!= sizeof (version_string
))
265 if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_1
) == 0)
266 *version
= BFD_SYM_VERSION_3_1
;
267 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_2
) == 0)
268 *version
= BFD_SYM_VERSION_3_2
;
269 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_3
) == 0)
270 *version
= BFD_SYM_VERSION_3_3
;
271 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_4
) == 0)
272 *version
= BFD_SYM_VERSION_3_4
;
273 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_5
) == 0)
274 *version
= BFD_SYM_VERSION_3_5
;
282 bfd_sym_display_table_summary (f
, dti
, name
)
284 bfd_sym_table_info
*dti
;
287 fprintf (f
, "%-6s %13ld %13ld %13ld\n",
291 dti
->dti_object_count
);
295 bfd_sym_display_header (f
, dshb
)
297 bfd_sym_header_block
*dshb
;
299 fprintf (f
, " Version: %.*s\n", dshb
->dshb_id
[0], dshb
->dshb_id
+ 1);
300 fprintf (f
, " Page Size: 0x%x\n", dshb
->dshb_page_size
);
301 fprintf (f
, " Hash Page: %lu\n", dshb
->dshb_hash_page
);
302 fprintf (f
, " Root MTE: %lu\n", dshb
->dshb_root_mte
);
303 fprintf (f
, " Modification Date: ");
304 fprintf (f
, "[unimplemented]");
305 fprintf (f
, " (0x%lx)\n", dshb
->dshb_mod_date
);
307 fprintf (f
, " File Creator: %.4s Type: %.4s\n\n",
308 dshb
->dshb_file_creator
, dshb
->dshb_file_type
);
310 fprintf (f
, "Table Name First Page Page Count Object Count\n");
311 fprintf (f
, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
313 bfd_sym_display_table_summary (f
, &dshb
->dshb_nte
, "NTE");
314 bfd_sym_display_table_summary (f
, &dshb
->dshb_rte
, "RTE");
315 bfd_sym_display_table_summary (f
, &dshb
->dshb_mte
, "MTE");
316 bfd_sym_display_table_summary (f
, &dshb
->dshb_frte
, "FRTE");
317 bfd_sym_display_table_summary (f
, &dshb
->dshb_cmte
, "CMTE");
318 bfd_sym_display_table_summary (f
, &dshb
->dshb_cvte
, "CVTE");
319 bfd_sym_display_table_summary (f
, &dshb
->dshb_csnte
, "CSNTE");
320 bfd_sym_display_table_summary (f
, &dshb
->dshb_clte
, "CLTE");
321 bfd_sym_display_table_summary (f
, &dshb
->dshb_ctte
, "CTTE");
322 bfd_sym_display_table_summary (f
, &dshb
->dshb_tte
, "TTE");
323 bfd_sym_display_table_summary (f
, &dshb
->dshb_tinfo
, "TINFO");
324 bfd_sym_display_table_summary (f
, &dshb
->dshb_fite
, "FITE");
325 bfd_sym_display_table_summary (f
, &dshb
->dshb_const
, "CONST");
331 bfd_sym_parse_resources_table_entry_v32 (buf
, len
, entry
)
334 bfd_sym_resources_table_entry
*entry
;
336 BFD_ASSERT (len
== 18);
338 memcpy (&entry
->rte_res_type
, buf
, 4);
339 entry
->rte_res_number
= bfd_getb16 (buf
+ 4);
340 entry
->rte_nte_index
= bfd_getb32 (buf
+ 6);
341 entry
->rte_mte_first
= bfd_getb16 (buf
+ 10);
342 entry
->rte_mte_last
= bfd_getb16 (buf
+ 12);
343 entry
->rte_res_size
= bfd_getb32 (buf
+ 14);
347 bfd_sym_parse_modules_table_entry_v33 (buf
, len
, entry
)
350 bfd_sym_modules_table_entry
*entry
;
352 BFD_ASSERT (len
== 46);
354 entry
->mte_rte_index
= bfd_getb16 (buf
);
355 entry
->mte_res_offset
= bfd_getb32 (buf
+ 2);
356 entry
->mte_size
= bfd_getb32 (buf
+ 6);
357 entry
->mte_kind
= buf
[10];
358 entry
->mte_scope
= buf
[11];
359 entry
->mte_parent
= bfd_getb16 (buf
+ 12);
360 bfd_sym_parse_file_reference_v32 (buf
+ 14, 6, &entry
->mte_imp_fref
);
361 entry
->mte_imp_end
= bfd_getb32 (buf
+ 20);
362 entry
->mte_nte_index
= bfd_getb32 (buf
+ 24);
363 entry
->mte_cmte_index
= bfd_getb16 (buf
+ 28);
364 entry
->mte_cvte_index
= bfd_getb32 (buf
+ 30);
365 entry
->mte_clte_index
= bfd_getb16 (buf
+ 34);
366 entry
->mte_ctte_index
= bfd_getb16 (buf
+ 36);
367 entry
->mte_csnte_idx_1
= bfd_getb32 (buf
+ 38);
368 entry
->mte_csnte_idx_2
= bfd_getb32 (buf
+ 42);
372 bfd_sym_parse_file_references_table_entry_v32 (buf
, len
, entry
)
375 bfd_sym_file_references_table_entry
*entry
;
379 BFD_ASSERT (len
== 10);
381 memset (entry
, 0, sizeof (bfd_sym_file_references_table_entry
));
382 type
= bfd_getb16 (buf
);
386 case BFD_SYM_END_OF_LIST_3_2
:
387 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
390 case BFD_SYM_FILE_NAME_INDEX_3_2
:
391 entry
->filename
.type
= BFD_SYM_FILE_NAME_INDEX
;
392 entry
->filename
.nte_index
= bfd_getb32 (buf
+ 2);
393 entry
->filename
.mod_date
= bfd_getb32 (buf
+ 6);
397 entry
->entry
.mte_index
= type
;
398 entry
->entry
.file_offset
= bfd_getb32 (buf
+ 2);
403 bfd_sym_parse_contained_modules_table_entry_v32 (buf
, len
, entry
)
406 bfd_sym_contained_modules_table_entry
*entry
;
410 BFD_ASSERT (len
== 6);
412 memset (entry
, 0, sizeof (bfd_sym_contained_modules_table_entry
));
413 type
= bfd_getb16 (buf
);
417 case BFD_SYM_END_OF_LIST_3_2
:
418 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
422 entry
->entry
.mte_index
= type
;
423 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 2);
429 bfd_sym_parse_contained_variables_table_entry_v32 (buf
, len
, entry
)
432 bfd_sym_contained_variables_table_entry
*entry
;
436 BFD_ASSERT (len
== 26);
438 memset (entry
, 0, sizeof (bfd_sym_contained_variables_table_entry
));
439 type
= bfd_getb16 (buf
);
443 case BFD_SYM_END_OF_LIST_3_2
:
444 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
447 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
448 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
449 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
453 entry
->entry
.tte_index
= type
;
454 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 2);
455 entry
->entry
.file_delta
= bfd_getb16 (buf
+ 6);
456 entry
->entry
.scope
= buf
[8];
457 entry
->entry
.la_size
= buf
[9];
459 if (entry
->entry
.la_size
== BFD_SYM_CVTE_SCA
)
461 entry
->entry
.address
.scstruct
.sca_kind
= buf
[10];
462 entry
->entry
.address
.scstruct
.sca_class
= buf
[11];
463 entry
->entry
.address
.scstruct
.sca_offset
= bfd_getb32 (buf
+ 12);
465 else if (entry
->entry
.la_size
<= BFD_SYM_CVTE_SCA
)
467 memcpy (&entry
->entry
.address
.lastruct
.la
, buf
+ 10, BFD_SYM_CVTE_SCA
);
468 entry
->entry
.address
.lastruct
.la_kind
= buf
[23];
470 else if (entry
->entry
.la_size
== BFD_SYM_CVTE_BIG_LA
)
472 entry
->entry
.address
.biglastruct
.big_la
= bfd_getb32 (buf
+ 10);
473 entry
->entry
.address
.biglastruct
.big_la_kind
= buf
[12];
479 bfd_sym_parse_contained_statements_table_entry_v32 (buf
, len
, entry
)
482 bfd_sym_contained_statements_table_entry
*entry
;
486 BFD_ASSERT (len
== 8);
488 memset (entry
, 0, sizeof (bfd_sym_contained_statements_table_entry
));
489 type
= bfd_getb16 (buf
);
493 case BFD_SYM_END_OF_LIST_3_2
:
494 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
497 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
498 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
499 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
503 entry
->entry
.mte_index
= type
;
504 entry
->entry
.mte_offset
= bfd_getb16 (buf
+ 2);
505 entry
->entry
.file_delta
= bfd_getb32 (buf
+ 4);
511 bfd_sym_parse_contained_labels_table_entry_v32 (buf
, len
, entry
)
514 bfd_sym_contained_labels_table_entry
*entry
;
518 BFD_ASSERT (len
== 12);
520 memset (entry
, 0, sizeof (bfd_sym_contained_labels_table_entry
));
521 type
= bfd_getb16 (buf
);
525 case BFD_SYM_END_OF_LIST_3_2
:
526 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
529 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
530 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
531 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
535 entry
->entry
.mte_index
= type
;
536 entry
->entry
.mte_offset
= bfd_getb16 (buf
+ 2);
537 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 4);
538 entry
->entry
.file_delta
= bfd_getb16 (buf
+ 8);
539 entry
->entry
.scope
= bfd_getb16 (buf
+ 10);
545 bfd_sym_parse_type_table_entry_v32 (buf
, len
, entry
)
548 bfd_sym_type_table_entry
*entry
;
550 BFD_ASSERT (len
== 4);
552 *entry
= bfd_getb32 (buf
);
556 bfd_sym_fetch_resources_table_entry (abfd
, entry
, index
)
558 bfd_sym_resources_table_entry
*entry
;
561 void (*parser
) PARAMS ((unsigned char *, size_t,
562 bfd_sym_resources_table_entry
*));
563 unsigned long offset
;
564 unsigned long entry_size
;
565 unsigned char buf
[18];
566 bfd_sym_data_struct
*sdata
= NULL
;
569 BFD_ASSERT (bfd_sym_valid (abfd
));
570 sdata
= abfd
->tdata
.sym_data
;
575 switch (sdata
->version
)
577 case BFD_SYM_VERSION_3_5
:
578 case BFD_SYM_VERSION_3_4
:
581 case BFD_SYM_VERSION_3_3
:
582 case BFD_SYM_VERSION_3_2
:
584 parser
= bfd_sym_parse_resources_table_entry_v32
;
587 case BFD_SYM_VERSION_3_1
:
594 offset
= compute_offset (sdata
->header
.dshb_rte
.dti_first_page
,
595 sdata
->header
.dshb_page_size
,
598 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
600 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
603 (*parser
) (buf
, entry_size
, entry
);
609 bfd_sym_fetch_modules_table_entry (abfd
, entry
, index
)
611 bfd_sym_modules_table_entry
*entry
;
614 void (*parser
) PARAMS ((unsigned char *, size_t,
615 bfd_sym_modules_table_entry
*));
616 unsigned long offset
;
617 unsigned long entry_size
;
618 unsigned char buf
[46];
619 bfd_sym_data_struct
*sdata
= NULL
;
622 BFD_ASSERT (bfd_sym_valid (abfd
));
623 sdata
= abfd
->tdata
.sym_data
;
628 switch (sdata
->version
)
630 case BFD_SYM_VERSION_3_5
:
631 case BFD_SYM_VERSION_3_4
:
634 case BFD_SYM_VERSION_3_3
:
636 parser
= bfd_sym_parse_modules_table_entry_v33
;
639 case BFD_SYM_VERSION_3_2
:
640 case BFD_SYM_VERSION_3_1
:
647 offset
= compute_offset (sdata
->header
.dshb_mte
.dti_first_page
,
648 sdata
->header
.dshb_page_size
,
651 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
653 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
656 (*parser
) (buf
, entry_size
, entry
);
662 bfd_sym_fetch_file_references_table_entry (abfd
, entry
, index
)
664 bfd_sym_file_references_table_entry
*entry
;
667 void (*parser
) PARAMS ((unsigned char *, size_t,
668 bfd_sym_file_references_table_entry
*));
669 unsigned long offset
;
670 unsigned long entry_size
= 0;
671 unsigned char buf
[8];
672 bfd_sym_data_struct
*sdata
= NULL
;
675 BFD_ASSERT (bfd_sym_valid (abfd
));
676 sdata
= abfd
->tdata
.sym_data
;
681 switch (sdata
->version
)
683 case BFD_SYM_VERSION_3_3
:
684 case BFD_SYM_VERSION_3_2
:
686 parser
= bfd_sym_parse_file_references_table_entry_v32
;
689 case BFD_SYM_VERSION_3_5
:
690 case BFD_SYM_VERSION_3_4
:
691 case BFD_SYM_VERSION_3_1
:
699 offset
= compute_offset (sdata
->header
.dshb_frte
.dti_first_page
,
700 sdata
->header
.dshb_page_size
,
703 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
705 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
708 (*parser
) (buf
, entry_size
, entry
);
714 bfd_sym_fetch_contained_modules_table_entry (abfd
, entry
, index
)
716 bfd_sym_contained_modules_table_entry
*entry
;
719 void (*parser
) PARAMS ((unsigned char *, size_t,
720 bfd_sym_contained_modules_table_entry
*));
721 unsigned long offset
;
722 unsigned long entry_size
= 0;
723 unsigned char buf
[6];
724 bfd_sym_data_struct
*sdata
= NULL
;
727 BFD_ASSERT (bfd_sym_valid (abfd
));
728 sdata
= abfd
->tdata
.sym_data
;
733 switch (sdata
->version
)
735 case BFD_SYM_VERSION_3_3
:
736 case BFD_SYM_VERSION_3_2
:
738 parser
= bfd_sym_parse_contained_modules_table_entry_v32
;
741 case BFD_SYM_VERSION_3_5
:
742 case BFD_SYM_VERSION_3_4
:
743 case BFD_SYM_VERSION_3_1
:
751 offset
= compute_offset (sdata
->header
.dshb_cmte
.dti_first_page
,
752 sdata
->header
.dshb_page_size
,
755 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
757 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
760 (*parser
) (buf
, entry_size
, entry
);
766 bfd_sym_fetch_contained_variables_table_entry (abfd
, entry
, index
)
768 bfd_sym_contained_variables_table_entry
*entry
;
771 void (*parser
) PARAMS ((unsigned char *, size_t,
772 bfd_sym_contained_variables_table_entry
*));
773 unsigned long offset
;
774 unsigned long entry_size
= 0;
775 unsigned char buf
[26];
776 bfd_sym_data_struct
*sdata
= NULL
;
779 BFD_ASSERT (bfd_sym_valid (abfd
));
780 sdata
= abfd
->tdata
.sym_data
;
785 switch (sdata
->version
)
787 case BFD_SYM_VERSION_3_3
:
788 case BFD_SYM_VERSION_3_2
:
790 parser
= bfd_sym_parse_contained_variables_table_entry_v32
;
793 case BFD_SYM_VERSION_3_5
:
794 case BFD_SYM_VERSION_3_4
:
795 case BFD_SYM_VERSION_3_1
:
803 offset
= compute_offset (sdata
->header
.dshb_cvte
.dti_first_page
,
804 sdata
->header
.dshb_page_size
,
807 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
809 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
812 (*parser
) (buf
, entry_size
, entry
);
818 bfd_sym_fetch_contained_statements_table_entry (abfd
, entry
, index
)
820 bfd_sym_contained_statements_table_entry
*entry
;
823 void (*parser
) PARAMS ((unsigned char *, size_t,
824 bfd_sym_contained_statements_table_entry
*));
825 unsigned long offset
;
826 unsigned long entry_size
= 0;
827 unsigned char buf
[8];
828 bfd_sym_data_struct
*sdata
= NULL
;
831 BFD_ASSERT (bfd_sym_valid (abfd
));
832 sdata
= abfd
->tdata
.sym_data
;
837 switch (sdata
->version
)
839 case BFD_SYM_VERSION_3_3
:
840 case BFD_SYM_VERSION_3_2
:
842 parser
= bfd_sym_parse_contained_statements_table_entry_v32
;
845 case BFD_SYM_VERSION_3_5
:
846 case BFD_SYM_VERSION_3_4
:
847 case BFD_SYM_VERSION_3_1
:
855 offset
= compute_offset (sdata
->header
.dshb_csnte
.dti_first_page
,
856 sdata
->header
.dshb_page_size
,
859 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
861 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
864 (*parser
) (buf
, entry_size
, entry
);
870 bfd_sym_fetch_contained_labels_table_entry (abfd
, entry
, index
)
872 bfd_sym_contained_labels_table_entry
*entry
;
875 void (*parser
) PARAMS ((unsigned char *, size_t,
876 bfd_sym_contained_labels_table_entry
*));
877 unsigned long offset
;
878 unsigned long entry_size
= 0;
879 unsigned char buf
[12];
880 bfd_sym_data_struct
*sdata
= NULL
;
883 BFD_ASSERT (bfd_sym_valid (abfd
));
884 sdata
= abfd
->tdata
.sym_data
;
889 switch (sdata
->version
)
891 case BFD_SYM_VERSION_3_3
:
892 case BFD_SYM_VERSION_3_2
:
894 parser
= bfd_sym_parse_contained_labels_table_entry_v32
;
897 case BFD_SYM_VERSION_3_5
:
898 case BFD_SYM_VERSION_3_4
:
899 case BFD_SYM_VERSION_3_1
:
907 offset
= compute_offset (sdata
->header
.dshb_clte
.dti_first_page
,
908 sdata
->header
.dshb_page_size
,
911 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
913 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
916 (*parser
) (buf
, entry_size
, entry
);
922 bfd_sym_fetch_contained_types_table_entry (abfd
, entry
, index
)
924 bfd_sym_contained_types_table_entry
*entry
;
927 void (*parser
) PARAMS ((unsigned char *, size_t,
928 bfd_sym_contained_types_table_entry
*));
929 unsigned long offset
;
930 unsigned long entry_size
= 0;
931 unsigned char buf
[0];
932 bfd_sym_data_struct
*sdata
= NULL
;
935 BFD_ASSERT (bfd_sym_valid (abfd
));
936 sdata
= abfd
->tdata
.sym_data
;
941 switch (sdata
->version
)
943 case BFD_SYM_VERSION_3_3
:
944 case BFD_SYM_VERSION_3_2
:
949 case BFD_SYM_VERSION_3_5
:
950 case BFD_SYM_VERSION_3_4
:
951 case BFD_SYM_VERSION_3_1
:
959 offset
= compute_offset (sdata
->header
.dshb_ctte
.dti_first_page
,
960 sdata
->header
.dshb_page_size
,
963 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
965 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
968 (*parser
) (buf
, entry_size
, entry
);
974 bfd_sym_fetch_file_references_index_table_entry (abfd
, entry
, index
)
976 bfd_sym_file_references_index_table_entry
*entry
;
979 void (*parser
) PARAMS ((unsigned char *, size_t,
980 bfd_sym_file_references_index_table_entry
*));
981 unsigned long offset
;
982 unsigned long entry_size
= 0;
983 unsigned char buf
[0];
984 bfd_sym_data_struct
*sdata
= NULL
;
987 BFD_ASSERT (bfd_sym_valid (abfd
));
988 sdata
= abfd
->tdata
.sym_data
;
993 switch (sdata
->version
)
995 case BFD_SYM_VERSION_3_3
:
996 case BFD_SYM_VERSION_3_2
:
1001 case BFD_SYM_VERSION_3_5
:
1002 case BFD_SYM_VERSION_3_4
:
1003 case BFD_SYM_VERSION_3_1
:
1011 offset
= compute_offset (sdata
->header
.dshb_fite
.dti_first_page
,
1012 sdata
->header
.dshb_page_size
,
1015 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1017 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1020 (*parser
) (buf
, entry_size
, entry
);
1026 bfd_sym_fetch_constant_pool_entry (abfd
, entry
, index
)
1028 bfd_sym_constant_pool_entry
*entry
;
1029 unsigned long index
;
1031 void (*parser
) PARAMS ((unsigned char *, size_t,
1032 bfd_sym_constant_pool_entry
*));
1033 unsigned long offset
;
1034 unsigned long entry_size
= 0;
1035 unsigned char buf
[0];
1036 bfd_sym_data_struct
*sdata
= NULL
;
1039 BFD_ASSERT (bfd_sym_valid (abfd
));
1040 sdata
= abfd
->tdata
.sym_data
;
1045 switch (sdata
->version
)
1047 case BFD_SYM_VERSION_3_3
:
1048 case BFD_SYM_VERSION_3_2
:
1053 case BFD_SYM_VERSION_3_5
:
1054 case BFD_SYM_VERSION_3_4
:
1055 case BFD_SYM_VERSION_3_1
:
1063 offset
= compute_offset (sdata
->header
.dshb_fite
.dti_first_page
,
1064 sdata
->header
.dshb_page_size
,
1067 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1069 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1072 (*parser
) (buf
, entry_size
, entry
);
1078 bfd_sym_fetch_type_table_entry (abfd
, entry
, index
)
1080 bfd_sym_type_table_entry
*entry
;
1081 unsigned long index
;
1083 void (*parser
) PARAMS ((unsigned char *, size_t,
1084 bfd_sym_type_table_entry
*));
1085 unsigned long offset
;
1086 unsigned long entry_size
= 0;
1087 unsigned char buf
[4];
1088 bfd_sym_data_struct
*sdata
= NULL
;
1091 BFD_ASSERT (bfd_sym_valid (abfd
));
1092 sdata
= abfd
->tdata
.sym_data
;
1094 switch (sdata
->version
)
1096 case BFD_SYM_VERSION_3_3
:
1097 case BFD_SYM_VERSION_3_2
:
1099 parser
= bfd_sym_parse_type_table_entry_v32
;
1102 case BFD_SYM_VERSION_3_5
:
1103 case BFD_SYM_VERSION_3_4
:
1104 case BFD_SYM_VERSION_3_1
:
1112 offset
= compute_offset (sdata
->header
.dshb_tte
.dti_first_page
,
1113 sdata
->header
.dshb_page_size
,
1116 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1118 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1121 (*parser
) (buf
, entry_size
, entry
);
1127 bfd_sym_fetch_type_information_table_entry (abfd
, entry
, offset
)
1129 bfd_sym_type_information_table_entry
*entry
;
1130 unsigned long offset
;
1132 unsigned char buf
[4];
1133 bfd_sym_data_struct
*sdata
= NULL
;
1135 BFD_ASSERT (bfd_sym_valid (abfd
));
1136 sdata
= abfd
->tdata
.sym_data
;
1141 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1144 if (bfd_bread (buf
, 4, abfd
) != 4)
1146 entry
->nte_index
= bfd_getb32 (buf
);
1148 if (bfd_bread (buf
, 2, abfd
) != 2)
1150 entry
->physical_size
= bfd_getb16 (buf
);
1152 if (entry
->physical_size
& 0x8000)
1154 if (bfd_bread (buf
, 4, abfd
) != 4)
1156 entry
->physical_size
&= 0x7fff;
1157 entry
->logical_size
= bfd_getb32 (buf
);
1158 entry
->offset
= offset
+ 10;
1162 if (bfd_bread (buf
, 2, abfd
) != 2)
1164 entry
->physical_size
&= 0x7fff;
1165 entry
->logical_size
= bfd_getb16 (buf
);
1166 entry
->offset
= offset
+ 8;
1173 bfd_sym_fetch_type_table_information (abfd
, entry
, index
)
1175 bfd_sym_type_information_table_entry
*entry
;
1176 unsigned long index
;
1178 bfd_sym_type_table_entry tindex
;
1179 bfd_sym_data_struct
*sdata
= NULL
;
1181 BFD_ASSERT (bfd_sym_valid (abfd
));
1182 sdata
= abfd
->tdata
.sym_data
;
1184 if (sdata
->header
.dshb_tte
.dti_object_count
<= 99)
1189 if (bfd_sym_fetch_type_table_entry (abfd
, &tindex
, index
- 100) < 0)
1191 if (bfd_sym_fetch_type_information_table_entry (abfd
, entry
, tindex
) < 0)
1197 const unsigned char *
1198 bfd_sym_symbol_name (abfd
, index
)
1200 unsigned long index
;
1202 bfd_sym_data_struct
*sdata
= NULL
;
1204 BFD_ASSERT (bfd_sym_valid (abfd
));
1205 sdata
= abfd
->tdata
.sym_data
;
1211 if ((index
/ sdata
->header
.dshb_page_size
)
1212 > sdata
->header
.dshb_nte
.dti_page_count
)
1213 return "\009[INVALID]";
1215 return (const unsigned char *) sdata
->name_table
+ index
;
1218 const unsigned char *
1219 bfd_sym_module_name (abfd
, index
)
1221 unsigned long index
;
1223 bfd_sym_modules_table_entry entry
;
1225 if (bfd_sym_fetch_modules_table_entry (abfd
, &entry
, index
) < 0)
1226 return "\011[INVALID]";
1228 return bfd_sym_symbol_name (abfd
, entry
.mte_nte_index
);
1232 bfd_sym_unparse_storage_kind (kind
)
1233 enum bfd_sym_storage_kind kind
;
1237 case BFD_SYM_STORAGE_KIND_LOCAL
: return "LOCAL";
1238 case BFD_SYM_STORAGE_KIND_VALUE
: return "VALUE";
1239 case BFD_SYM_STORAGE_KIND_REFERENCE
: return "REFERENCE";
1240 case BFD_SYM_STORAGE_KIND_WITH
: return "WITH";
1241 default: return "[UNKNOWN]";
1246 bfd_sym_unparse_storage_class (kind
)
1247 enum bfd_sym_storage_class kind
;
1251 case BFD_SYM_STORAGE_CLASS_REGISTER
: return "REGISTER";
1252 case BFD_SYM_STORAGE_CLASS_GLOBAL
: return "GLOBAL";
1253 case BFD_SYM_STORAGE_CLASS_FRAME_RELATIVE
: return "FRAME_RELATIVE";
1254 case BFD_SYM_STORAGE_CLASS_STACK_RELATIVE
: return "STACK_RELATIVE";
1255 case BFD_SYM_STORAGE_CLASS_ABSOLUTE
: return "ABSOLUTE";
1256 case BFD_SYM_STORAGE_CLASS_CONSTANT
: return "CONSTANT";
1257 case BFD_SYM_STORAGE_CLASS_RESOURCE
: return "RESOURCE";
1258 case BFD_SYM_STORAGE_CLASS_BIGCONSTANT
: return "BIGCONSTANT";
1259 default: return "[UNKNOWN]";
1264 bfd_sym_unparse_module_kind (kind
)
1265 enum bfd_sym_module_kind kind
;
1269 case BFD_SYM_MODULE_KIND_NONE
: return "NONE";
1270 case BFD_SYM_MODULE_KIND_PROGRAM
: return "PROGRAM";
1271 case BFD_SYM_MODULE_KIND_UNIT
: return "UNIT";
1272 case BFD_SYM_MODULE_KIND_PROCEDURE
: return "PROCEDURE";
1273 case BFD_SYM_MODULE_KIND_FUNCTION
: return "FUNCTION";
1274 case BFD_SYM_MODULE_KIND_DATA
: return "DATA";
1275 case BFD_SYM_MODULE_KIND_BLOCK
: return "BLOCK";
1276 default: return "[UNKNOWN]";
1281 bfd_sym_unparse_symbol_scope (scope
)
1282 enum bfd_sym_symbol_scope scope
;
1286 case BFD_SYM_SYMBOL_SCOPE_LOCAL
: return "LOCAL";
1287 case BFD_SYM_SYMBOL_SCOPE_GLOBAL
: return "GLOBAL";
1294 bfd_sym_print_file_reference (abfd
, f
, entry
)
1297 bfd_sym_file_reference
*entry
;
1299 bfd_sym_file_references_table_entry frtentry
;
1302 ret
= bfd_sym_fetch_file_references_table_entry (abfd
, &frtentry
,
1303 entry
->fref_frte_index
);
1304 fprintf (f
, "FILE ");
1306 if ((ret
< 0) || (frtentry
.generic
.type
!= BFD_SYM_FILE_NAME_INDEX
))
1307 fprintf (f
, "[INVALID]");
1309 fprintf (f
, "\"%.*s\"",
1310 bfd_sym_symbol_name (abfd
, frtentry
.filename
.nte_index
)[0],
1311 &bfd_sym_symbol_name (abfd
, frtentry
.filename
.nte_index
)[1]);
1313 fprintf (f
, " (FRTE %lu)", entry
->fref_frte_index
);
1317 bfd_sym_print_resources_table_entry (abfd
, f
, entry
)
1320 bfd_sym_resources_table_entry
*entry
;
1322 fprintf (f
, " \"%.*s\" (NTE %lu), type \"%.4s\", num %u, size %lu, MTE %lu -- %lu",
1323 bfd_sym_symbol_name (abfd
, entry
->rte_nte_index
)[0],
1324 &bfd_sym_symbol_name (abfd
, entry
->rte_nte_index
)[1],
1325 entry
->rte_nte_index
, entry
->rte_res_type
, entry
->rte_res_number
,
1326 entry
->rte_res_size
, entry
->rte_mte_first
, entry
->rte_mte_last
);
1330 bfd_sym_print_modules_table_entry (abfd
, f
, entry
)
1333 bfd_sym_modules_table_entry
*entry
;
1335 fprintf (f
, "\"%.*s\" (NTE %lu)",
1336 bfd_sym_symbol_name (abfd
, entry
->mte_nte_index
)[0],
1337 &bfd_sym_symbol_name (abfd
, entry
->mte_nte_index
)[1],
1338 entry
->mte_nte_index
);
1342 bfd_sym_print_file_reference (abfd
, f
, &entry
->mte_imp_fref
);
1343 fprintf (f
, " range %lu -- %lu",
1344 entry
->mte_imp_fref
.fref_offset
, entry
->mte_imp_end
);
1348 fprintf (f
, "kind %s", bfd_sym_unparse_module_kind (entry
->mte_kind
));
1349 fprintf (f
, ", scope %s", bfd_sym_unparse_symbol_scope (entry
->mte_scope
));
1351 fprintf (f
, ", RTE %lu, offset %lu, size %lu",
1352 entry
->mte_rte_index
, entry
->mte_res_offset
, entry
->mte_size
);
1356 fprintf (f
, "CMTE %lu, CVTE %lu, CLTE %lu, CTTE %lu, CSNTE1 %lu, CSNTE2 %lu",
1357 entry
->mte_cmte_index
, entry
->mte_cvte_index
,
1358 entry
->mte_clte_index
, entry
->mte_ctte_index
,
1359 entry
->mte_csnte_idx_1
, entry
->mte_csnte_idx_2
);
1361 if (entry
->mte_parent
!= 0)
1362 fprintf (f
, ", parent %lu", entry
->mte_parent
);
1364 fprintf (f
, ", no parent");
1366 if (entry
->mte_cmte_index
!= 0)
1367 fprintf (f
, ", child %lu", entry
->mte_cmte_index
);
1369 fprintf (f
, ", no child");
1373 MTE bfd_sym_modules_table_entry pentry
;
1375 ret
= bfd_sym_fetch_modules_table_entry (abfd
, &pentry
, entry
->mte_parent
);
1377 fprintf (f
, " parent MTE %lu [INVALID]\n", entry
->mte_parent
);
1379 fprintf (f
, " parent MTE %lu \"%.*s\"\n",
1381 bfd_sym_symbol_name (abfd
, pentry
.mte_nte_index
)[0],
1382 &bfd_sym_symbol_name (abfd
, pentry
.mte_nte_index
)[1]);
1388 bfd_sym_print_file_references_table_entry (abfd
, f
, entry
)
1391 bfd_sym_file_references_table_entry
*entry
;
1393 switch (entry
->generic
.type
)
1395 case BFD_SYM_FILE_NAME_INDEX
:
1396 fprintf (f
, "FILE \"%.*s\" (NTE %lu), modtime ",
1397 bfd_sym_symbol_name (abfd
, entry
->filename
.nte_index
)[0],
1398 &bfd_sym_symbol_name (abfd
, entry
->filename
.nte_index
)[1],
1399 entry
->filename
.nte_index
);
1401 fprintf (f
, "[UNIMPLEMENTED]");
1402 /* printModDate (entry->filename.mod_date); */
1403 fprintf (f
, " (0x%lx)", entry
->filename
.mod_date
);
1406 case BFD_SYM_END_OF_LIST
:
1411 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu",
1412 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1413 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1414 entry
->entry
.mte_index
,
1415 entry
->entry
.file_offset
);
1421 bfd_sym_print_contained_modules_table_entry (abfd
, f
, entry
)
1424 bfd_sym_contained_modules_table_entry
*entry
;
1426 switch (entry
->generic
.type
)
1428 case BFD_SYM_END_OF_LIST
:
1433 fprintf (f
, "\"%.*s\" (MTE %lu, NTE %lu)",
1434 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1435 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1436 entry
->entry
.mte_index
,
1437 entry
->entry
.nte_index
);
1443 bfd_sym_print_contained_variables_table_entry (abfd
, f
, entry
)
1446 bfd_sym_contained_variables_table_entry
*entry
;
1448 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1454 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1456 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1457 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1461 fprintf (f
, "\"%.*s\" (NTE %lu)",
1462 bfd_sym_symbol_name (abfd
, entry
->entry
.nte_index
)[0],
1463 &bfd_sym_symbol_name (abfd
, entry
->entry
.nte_index
)[1],
1464 entry
->entry
.nte_index
);
1466 fprintf (f
, ", TTE %lu", entry
->entry
.tte_index
);
1467 fprintf (f
, ", offset %lu", entry
->entry
.file_delta
);
1468 fprintf (f
, ", scope %s", bfd_sym_unparse_symbol_scope (entry
->entry
.scope
));
1470 if (entry
->entry
.la_size
== BFD_SYM_CVTE_SCA
)
1471 fprintf (f
, ", latype %s, laclass %s, laoffset %lu",
1472 bfd_sym_unparse_storage_kind (entry
->entry
.address
.scstruct
.sca_kind
),
1473 bfd_sym_unparse_storage_class (entry
->entry
.address
.scstruct
.sca_class
),
1474 entry
->entry
.address
.scstruct
.sca_offset
);
1475 else if (entry
->entry
.la_size
<= BFD_SYM_CVTE_LA_MAX_SIZE
)
1479 fprintf (f
, ", la [");
1480 for (i
= 0; i
< entry
->entry
.la_size
; i
++)
1481 fprintf (f
, "0x%02x ", entry
->entry
.address
.lastruct
.la
[i
]);
1484 else if (entry
->entry
.la_size
== BFD_SYM_CVTE_BIG_LA
)
1485 fprintf (f
, ", bigla %lu, biglakind %u",
1486 entry
->entry
.address
.biglastruct
.big_la
,
1487 entry
->entry
.address
.biglastruct
.big_la_kind
);
1490 fprintf (f
, ", la [INVALID]");
1494 bfd_sym_print_contained_statements_table_entry (abfd
, f
, entry
)
1497 bfd_sym_contained_statements_table_entry
*entry
;
1499 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1505 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1507 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1508 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1512 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu, delta %lu",
1513 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1514 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1515 entry
->entry
.mte_index
,
1516 entry
->entry
.mte_offset
,
1517 entry
->entry
.file_delta
);
1521 bfd_sym_print_contained_labels_table_entry (abfd
, f
, entry
)
1524 bfd_sym_contained_labels_table_entry
*entry
;
1526 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1532 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1534 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1535 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1539 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu, delta %lu, scope %s",
1540 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1541 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1542 entry
->entry
.mte_index
,
1543 entry
->entry
.mte_offset
,
1544 entry
->entry
.file_delta
,
1545 bfd_sym_unparse_symbol_scope (entry
->entry
.scope
));
1549 bfd_sym_print_contained_types_table_entry (abfd
, f
, entry
)
1550 bfd
*abfd ATTRIBUTE_UNUSED
;
1552 bfd_sym_contained_types_table_entry
*entry ATTRIBUTE_UNUSED
;
1554 fprintf (f
, "[UNIMPLEMENTED]");
1558 bfd_sym_type_operator_name (num
)
1563 case 1: return "TTE";
1564 case 2: return "PointerTo";
1565 case 3: return "ScalarOf";
1566 case 4: return "ConstantOf";
1567 case 5: return "EnumerationOf";
1568 case 6: return "VectorOf";
1569 case 7: return "RecordOf";
1570 case 8: return "UnionOf";
1571 case 9: return "SubRangeOf";
1572 case 10: return "SetOf";
1573 case 11: return "NamedTypeOf";
1574 case 12: return "ProcOf";
1575 case 13: return "ValueOf";
1576 case 14: return "ArrayOf";
1577 default: return "[UNKNOWN OPERATOR]";
1582 bfd_sym_type_basic_name (num
)
1587 case 0: return "void";
1588 case 1: return "pascal string";
1589 case 2: return "unsigned long";
1590 case 3: return "signed long";
1591 case 4: return "extended (10 bytes)";
1592 case 5: return "pascal boolean (1 byte)";
1593 case 6: return "unsigned byte";
1594 case 7: return "signed byte";
1595 case 8: return "character (1 byte)";
1596 case 9: return "wide character (2 bytes)";
1597 case 10: return "unsigned short";
1598 case 11: return "signed short";
1599 case 12: return "singled";
1600 case 13: return "double";
1601 case 14: return "extended (12 bytes)";
1602 case 15: return "computational (8 bytes)";
1603 case 16: return "c string";
1604 case 17: return "as-is string";
1605 default: return "[UNKNOWN BASIC TYPE]";
1610 bfd_sym_fetch_long (buf
, len
, offset
, offsetptr
, value
)
1613 unsigned long offset
;
1614 unsigned long *offsetptr
;
1625 else if (! (buf
[offset
] & 0x80))
1627 *value
= buf
[offset
];
1631 else if (buf
[offset
] == 0xc0)
1633 if ((offset
+ 5) > len
)
1641 *value
= bfd_getb32 (buf
+ offset
+ 1);
1646 else if ((buf
[offset
] & 0xc0) == 0xc0)
1648 *value
= -(buf
[offset
] & 0x3f);
1652 else if ((buf
[offset
] & 0xc0) == 0x80)
1654 if ((offset
+ 2) > len
)
1662 *value
= bfd_getb16 (buf
+ offset
) & 0x3fff;
1670 if (offsetptr
!= NULL
)
1671 *offsetptr
= offset
;
1677 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, offsetptr
)
1682 unsigned long offset
;
1683 unsigned long *offsetptr
;
1689 fprintf (f
, "[NULL]");
1691 if (offsetptr
!= NULL
)
1692 *offsetptr
= offset
;
1699 if (! (type
& 0x80))
1701 fprintf (f
, "[%s] (0x%x)", bfd_sym_type_basic_name (type
& 0x7f), type
);
1703 if (offsetptr
!= NULL
)
1704 *offsetptr
= offset
;
1709 fprintf (f
, "[packed ");
1713 switch (type
& 0x3f)
1718 bfd_sym_type_information_table_entry tinfo
;
1720 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1722 fprintf (f
, "[INVALID]");
1725 if (bfd_sym_fetch_type_table_information (abfd
, &tinfo
, value
) < 0)
1726 fprintf (f
, "[INVALID]");
1728 fprintf (f
, "\"%.*s\"",
1729 bfd_sym_symbol_name (abfd
, tinfo
.nte_index
)[0],
1730 &bfd_sym_symbol_name (abfd
, tinfo
.nte_index
)[1]);
1732 fprintf (f
, " (TTE %lu)", value
);
1737 fprintf (f
, "pointer (0x%x) to ", type
);
1738 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1743 unsigned long value
;
1745 fprintf (f
, "scalar (0x%x) of ", type
);
1746 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1747 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1748 fprintf (f
, " (%lu)", value
);
1754 unsigned long lower
, upper
, nelem
;
1757 fprintf (f
, "enumeration (0x%x) of ", type
);
1758 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1759 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &lower
);
1760 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &upper
);
1761 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &nelem
);
1762 fprintf (f
, " from %lu to %lu with %lu elements: ", lower
, upper
, nelem
);
1764 for (i
= 0; i
< nelem
; i
++)
1767 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1773 fprintf (f
, "vector (0x%x)", type
);
1774 fprintf (f
, "\n index ");
1775 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1776 fprintf (f
, "\n target ");
1777 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1783 long nrec
, eloff
, i
;
1785 if ((type
& 0x3f) == 7)
1786 fprintf (f
, "record (0x%x) of ", type
);
1788 fprintf (f
, "union (0x%x) of ", type
);
1790 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &nrec
);
1791 fprintf (f
, "%lu elements: ", nrec
);
1793 for (i
= 0; i
< nrec
; i
++)
1795 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &eloff
);
1797 fprintf (f
, "offset %lu: ", eloff
);
1798 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1804 fprintf (f
, "subrange (0x%x) of ", type
);
1805 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1806 fprintf (f
, " lower ");
1807 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1808 fprintf (f
, " upper ");
1809 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1816 fprintf (f
, "named type (0x%x) ", type
);
1817 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1819 fprintf (f
, "[INVALID]");
1821 fprintf (f
, "\"%.*s\"",
1822 bfd_sym_symbol_name (abfd
, value
)[0],
1823 &bfd_sym_symbol_name (abfd
, value
)[1]);
1825 fprintf (f
, " (NTE %lu) with type ", value
);
1826 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1831 fprintf (f
, "%s (0x%x)", bfd_sym_type_operator_name (type
), type
);
1835 if (type
== (0x40 | 0x6))
1842 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &n
);
1843 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &width
);
1844 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &m
);
1845 /* fprintf (f, "\n "); */
1846 fprintf (f
, " N %ld, width %ld, M %ld, ", n
, width
, m
);
1847 for (i
= 0; i
< m
; i
++)
1849 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &l
);
1852 fprintf (f
, "%ld", l
);
1855 else if (type
& 0x40)
1857 /* Other packed type. */
1860 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &msb
);
1861 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &lsb
);
1862 /* fprintf (f, "\n "); */
1863 fprintf (f
, " msb %ld, lsb %ld", msb
, lsb
);
1868 if (offsetptr
!= NULL
)
1869 *offsetptr
= offset
;
1873 bfd_sym_print_type_information_table_entry (abfd
, f
, entry
)
1876 bfd_sym_type_information_table_entry
*entry
;
1879 unsigned long offset
;
1882 fprintf (f
, "\"%.*s\" (NTE %lu), %lu bytes at %lu, logical size %lu",
1883 bfd_sym_symbol_name (abfd
, entry
->nte_index
)[0],
1884 &bfd_sym_symbol_name (abfd
, entry
->nte_index
)[1],
1886 entry
->physical_size
, entry
->offset
, entry
->logical_size
);
1890 buf
= alloca (entry
->physical_size
);
1893 fprintf (f
, "[ERROR]\n");
1896 if (bfd_seek (abfd
, entry
->offset
, SEEK_SET
) < 0)
1898 fprintf (f
, "[ERROR]\n");
1901 if (bfd_bread (buf
, entry
->physical_size
, abfd
) != entry
->physical_size
)
1903 fprintf (f
, "[ERROR]\n");
1908 for (i
= 0; i
< entry
->physical_size
; i
++)
1911 fprintf (f
, "0x%02x", buf
[i
]);
1913 fprintf (f
, " 0x%02x", buf
[i
]);
1919 bfd_sym_print_type_information (abfd
, f
, buf
, entry
->physical_size
, 0, &offset
);
1921 if (offset
!= entry
->physical_size
)
1922 fprintf (f
, "\n [parser used %lu bytes instead of %lu]", offset
, entry
->physical_size
); }
1925 bfd_sym_print_file_references_index_table_entry (abfd
, f
, entry
)
1926 bfd
*abfd ATTRIBUTE_UNUSED
;
1928 bfd_sym_file_references_index_table_entry
*entry ATTRIBUTE_UNUSED
;
1930 fprintf (f
, "[UNIMPLEMENTED]");
1934 bfd_sym_print_constant_pool_entry (abfd
, f
, entry
)
1935 bfd
*abfd ATTRIBUTE_UNUSED
;
1937 bfd_sym_constant_pool_entry
*entry ATTRIBUTE_UNUSED
;
1939 fprintf (f
, "[UNIMPLEMENTED]");
1943 bfd_sym_display_name_table_entry (abfd
, f
, entry
)
1946 unsigned char *entry
;
1948 unsigned long index
;
1949 unsigned long offset
;
1950 bfd_sym_data_struct
*sdata
= NULL
;
1952 BFD_ASSERT (bfd_sym_valid (abfd
));
1953 sdata
= abfd
->tdata
.sym_data
;
1954 index
= (entry
- sdata
->name_table
) / 2;
1956 if (sdata
->version
>= BFD_SYM_VERSION_3_4
&& entry
[0] == 255 && entry
[1] == 0)
1958 unsigned short length
= bfd_getb16 (entry
+ 2);
1959 fprintf (f
, "[%8lu] \"%.*s\"\n", index
, length
, entry
+ 4);
1960 offset
= 2 + length
+ 1;
1964 if (! (entry
[0] == 0 || (entry
[0] == 1 && entry
[1] == '\0')))
1965 fprintf (f
, "[%8lu] \"%.*s\"\n", index
, entry
[0], entry
+ 1);
1967 if (sdata
->version
>= BFD_SYM_VERSION_3_4
)
1968 offset
= entry
[0] + 2;
1970 offset
= entry
[0] + 1;
1973 return (entry
+ offset
+ (offset
% 2));
1977 bfd_sym_display_name_table (abfd
, f
)
1981 unsigned long name_table_len
;
1982 unsigned char *name_table
, *name_table_end
, *cur
;
1983 bfd_sym_data_struct
*sdata
= NULL
;
1985 BFD_ASSERT (bfd_sym_valid (abfd
));
1986 sdata
= abfd
->tdata
.sym_data
;
1988 name_table_len
= sdata
->header
.dshb_nte
.dti_page_count
* sdata
->header
.dshb_page_size
;
1989 name_table
= sdata
->name_table
;
1990 name_table_end
= name_table
+ name_table_len
;
1992 fprintf (f
, "name table (NTE) contains %lu bytes:\n\n", name_table_len
);
1997 cur
= bfd_sym_display_name_table_entry (abfd
, f
, cur
);
1998 if (cur
>= name_table_end
)
2004 bfd_sym_display_resources_table (abfd
, f
)
2009 bfd_sym_resources_table_entry entry
;
2010 bfd_sym_data_struct
*sdata
= NULL
;
2012 BFD_ASSERT (bfd_sym_valid (abfd
));
2013 sdata
= abfd
->tdata
.sym_data
;
2015 fprintf (f
, "resource table (RTE) contains %lu objects:\n\n",
2016 sdata
->header
.dshb_rte
.dti_object_count
);
2018 for (i
= 1; i
<= sdata
->header
.dshb_rte
.dti_object_count
; i
++)
2020 if (bfd_sym_fetch_resources_table_entry (abfd
, &entry
, i
) < 0)
2021 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2024 fprintf (f
, " [%8lu] ", i
);
2025 bfd_sym_print_resources_table_entry (abfd
, f
, &entry
);
2032 bfd_sym_display_modules_table (abfd
, f
)
2037 bfd_sym_modules_table_entry entry
;
2038 bfd_sym_data_struct
*sdata
= NULL
;
2040 BFD_ASSERT (bfd_sym_valid (abfd
));
2041 sdata
= abfd
->tdata
.sym_data
;
2043 fprintf (f
, "module table (MTE) contains %lu objects:\n\n",
2044 sdata
->header
.dshb_mte
.dti_object_count
);
2046 for (i
= 1; i
<= sdata
->header
.dshb_mte
.dti_object_count
; i
++)
2048 if (bfd_sym_fetch_modules_table_entry (abfd
, &entry
, i
) < 0)
2049 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2052 fprintf (f
, " [%8lu] ", i
);
2053 bfd_sym_print_modules_table_entry (abfd
, f
, &entry
);
2060 bfd_sym_display_file_references_table (abfd
, f
)
2065 bfd_sym_file_references_table_entry entry
;
2066 bfd_sym_data_struct
*sdata
= NULL
;
2068 BFD_ASSERT (bfd_sym_valid (abfd
));
2069 sdata
= abfd
->tdata
.sym_data
;
2071 fprintf (f
, "file reference table (FRTE) contains %lu objects:\n\n",
2072 sdata
->header
.dshb_frte
.dti_object_count
);
2074 for (i
= 1; i
<= sdata
->header
.dshb_frte
.dti_object_count
; i
++)
2076 if (bfd_sym_fetch_file_references_table_entry (abfd
, &entry
, i
) < 0)
2077 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2080 fprintf (f
, " [%8lu] ", i
);
2081 bfd_sym_print_file_references_table_entry (abfd
, f
, &entry
);
2088 bfd_sym_display_contained_modules_table (abfd
, f
)
2093 bfd_sym_contained_modules_table_entry entry
;
2094 bfd_sym_data_struct
*sdata
= NULL
;
2096 BFD_ASSERT (bfd_sym_valid (abfd
));
2097 sdata
= abfd
->tdata
.sym_data
;
2099 fprintf (f
, "contained modules table (CMTE) contains %lu objects:\n\n",
2100 sdata
->header
.dshb_cmte
.dti_object_count
);
2102 for (i
= 1; i
<= sdata
->header
.dshb_cmte
.dti_object_count
; i
++)
2104 if (bfd_sym_fetch_contained_modules_table_entry (abfd
, &entry
, i
) < 0)
2105 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2108 fprintf (f
, " [%8lu] ", i
);
2109 bfd_sym_print_contained_modules_table_entry (abfd
, f
, &entry
);
2116 bfd_sym_display_contained_variables_table (abfd
, f
)
2121 bfd_sym_contained_variables_table_entry entry
;
2122 bfd_sym_data_struct
*sdata
= NULL
;
2124 BFD_ASSERT (bfd_sym_valid (abfd
));
2125 sdata
= abfd
->tdata
.sym_data
;
2127 fprintf (f
, "contained variables table (CVTE) contains %lu objects:\n\n",
2128 sdata
->header
.dshb_cvte
.dti_object_count
);
2130 for (i
= 1; i
<= sdata
->header
.dshb_cvte
.dti_object_count
; i
++)
2132 if (bfd_sym_fetch_contained_variables_table_entry (abfd
, &entry
, i
) < 0)
2133 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2136 fprintf (f
, " [%8lu] ", i
);
2137 bfd_sym_print_contained_variables_table_entry (abfd
, f
, &entry
);
2146 bfd_sym_display_contained_statements_table (abfd
, f
)
2151 bfd_sym_contained_statements_table_entry entry
;
2152 bfd_sym_data_struct
*sdata
= NULL
;
2154 BFD_ASSERT (bfd_sym_valid (abfd
));
2155 sdata
= abfd
->tdata
.sym_data
;
2157 fprintf (f
, "contained statements table (CSNTE) contains %lu objects:\n\n",
2158 sdata
->header
.dshb_csnte
.dti_object_count
);
2160 for (i
= 1; i
<= sdata
->header
.dshb_csnte
.dti_object_count
; i
++)
2162 if (bfd_sym_fetch_contained_statements_table_entry (abfd
, &entry
, i
) < 0)
2163 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2166 fprintf (f
, " [%8lu] ", i
);
2167 bfd_sym_print_contained_statements_table_entry (abfd
, f
, &entry
);
2174 bfd_sym_display_contained_labels_table (abfd
, f
)
2179 bfd_sym_contained_labels_table_entry entry
;
2180 bfd_sym_data_struct
*sdata
= NULL
;
2182 BFD_ASSERT (bfd_sym_valid (abfd
));
2183 sdata
= abfd
->tdata
.sym_data
;
2185 fprintf (f
, "contained labels table (CLTE) contains %lu objects:\n\n",
2186 sdata
->header
.dshb_clte
.dti_object_count
);
2188 for (i
= 1; i
<= sdata
->header
.dshb_clte
.dti_object_count
; i
++)
2190 if (bfd_sym_fetch_contained_labels_table_entry (abfd
, &entry
, i
) < 0)
2191 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2194 fprintf (f
, " [%8lu] ", i
);
2195 bfd_sym_print_contained_labels_table_entry (abfd
, f
, &entry
);
2202 bfd_sym_display_contained_types_table (abfd
, f
)
2207 bfd_sym_contained_types_table_entry entry
;
2208 bfd_sym_data_struct
*sdata
= NULL
;
2210 BFD_ASSERT (bfd_sym_valid (abfd
));
2211 sdata
= abfd
->tdata
.sym_data
;
2213 fprintf (f
, "contained types table (CTTE) contains %lu objects:\n\n",
2214 sdata
->header
.dshb_ctte
.dti_object_count
);
2216 for (i
= 1; i
<= sdata
->header
.dshb_ctte
.dti_object_count
; i
++)
2218 if (bfd_sym_fetch_contained_types_table_entry (abfd
, &entry
, i
) < 0)
2219 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2222 fprintf (f
, " [%8lu] ", i
);
2223 bfd_sym_print_contained_types_table_entry (abfd
, f
, &entry
);
2230 bfd_sym_display_file_references_index_table (abfd
, f
)
2235 bfd_sym_file_references_index_table_entry entry
;
2236 bfd_sym_data_struct
*sdata
= NULL
;
2238 BFD_ASSERT (bfd_sym_valid (abfd
));
2239 sdata
= abfd
->tdata
.sym_data
;
2241 fprintf (f
, "file references index table (FITE) contains %lu objects:\n\n",
2242 sdata
->header
.dshb_fite
.dti_object_count
);
2244 for (i
= 1; i
<= sdata
->header
.dshb_fite
.dti_object_count
; i
++)
2246 if (bfd_sym_fetch_file_references_index_table_entry (abfd
, &entry
, i
) < 0)
2247 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2250 fprintf (f
, " [%8lu] ", i
);
2251 bfd_sym_print_file_references_index_table_entry (abfd
, f
, &entry
);
2258 bfd_sym_display_constant_pool (abfd
, f
)
2263 bfd_sym_constant_pool_entry entry
;
2264 bfd_sym_data_struct
*sdata
= NULL
;
2266 BFD_ASSERT (bfd_sym_valid (abfd
));
2267 sdata
= abfd
->tdata
.sym_data
;
2269 fprintf (f
, "constant pool (CONST) contains %lu objects:\n\n",
2270 sdata
->header
.dshb_const
.dti_object_count
);
2272 for (i
= 1; i
<= sdata
->header
.dshb_const
.dti_object_count
; i
++)
2274 if (bfd_sym_fetch_constant_pool_entry (abfd
, &entry
, i
) < 0)
2275 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2278 fprintf (f
, " [%8lu] ", i
);
2279 bfd_sym_print_constant_pool_entry (abfd
, f
, &entry
);
2286 bfd_sym_display_type_information_table (abfd
, f
)
2291 bfd_sym_type_table_entry index
;
2292 bfd_sym_type_information_table_entry entry
;
2293 bfd_sym_data_struct
*sdata
= NULL
;
2295 BFD_ASSERT (bfd_sym_valid (abfd
));
2296 sdata
= abfd
->tdata
.sym_data
;
2298 if (sdata
->header
.dshb_tte
.dti_object_count
> 99)
2299 fprintf (f
, "type table (TINFO) contains %lu objects:\n\n",
2300 sdata
->header
.dshb_tte
.dti_object_count
- 99);
2303 fprintf (f
, "type table (TINFO) contains [INVALID] objects:\n\n");
2307 for (i
= 100; i
<= sdata
->header
.dshb_tte
.dti_object_count
; i
++)
2309 if (bfd_sym_fetch_type_table_entry (abfd
, &index
, i
- 100) < 0)
2310 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2313 fprintf (f
, " [%8lu] (TINFO %lu) ", i
, index
);
2315 if (bfd_sym_fetch_type_information_table_entry (abfd
, &entry
, index
) < 0)
2316 fprintf (f
, "[INVALID]");
2318 bfd_sym_print_type_information_table_entry (abfd
, f
, &entry
);
2326 bfd_sym_scan (abfd
, version
, mdata
)
2328 bfd_sym_version version
;
2329 bfd_sym_data_struct
*mdata
;
2332 const char *name
= "symbols";
2334 mdata
->name_table
= 0;
2336 mdata
->version
= version
;
2338 bfd_seek (abfd
, 0, SEEK_SET
);
2339 if (bfd_sym_read_header (abfd
, &mdata
->header
, mdata
->version
) != 0)
2342 mdata
->name_table
= bfd_sym_read_name_table (abfd
, &mdata
->header
);
2343 if (mdata
->name_table
== NULL
)
2346 bfdsec
= bfd_make_section_anyway (abfd
, name
);
2353 bfdsec
->filepos
= 0;
2354 bfdsec
->alignment_power
= 0;
2356 bfdsec
->flags
= SEC_HAS_CONTENTS
;
2358 abfd
->tdata
.sym_data
= mdata
;
2364 bfd_sym_object_p (abfd
)
2367 struct bfd_preserve preserve
;
2368 bfd_sym_version version
= -1;
2370 preserve
.marker
= NULL
;
2371 bfd_seek (abfd
, 0, SEEK_SET
);
2372 if (bfd_sym_read_version (abfd
, &version
) != 0)
2375 preserve
.marker
= bfd_alloc (abfd
, sizeof (bfd_sym_data_struct
));
2376 if (preserve
.marker
== NULL
2377 || ! bfd_preserve_save (abfd
, &preserve
))
2380 if (bfd_sym_scan (abfd
, version
,
2381 (bfd_sym_data_struct
*) preserve
.marker
) != 0)
2384 bfd_preserve_finish (abfd
, &preserve
);
2388 bfd_set_error (bfd_error_wrong_format
);
2391 if (preserve
.marker
!= NULL
)
2392 bfd_preserve_restore (abfd
, &preserve
);
2397 bfd_sym_make_empty_symbol (abfd
)
2400 return (asymbol
*) bfd_alloc (abfd
, sizeof (asymbol
));
2404 bfd_sym_get_symbol_info (abfd
, symbol
, ret
)
2405 bfd
*abfd ATTRIBUTE_UNUSED
;
2409 bfd_symbol_info (symbol
, ret
);
2413 bfd_sym_get_symtab_upper_bound (abfd
)
2414 bfd
*abfd ATTRIBUTE_UNUSED
;
2420 bfd_sym_canonicalize_symtab (abfd
, sym
)
2421 bfd
*abfd ATTRIBUTE_UNUSED
;
2422 asymbol
**sym ATTRIBUTE_UNUSED
;
2428 bfd_sym_sizeof_headers (abfd
, exec
)
2429 bfd
*abfd ATTRIBUTE_UNUSED
;
2430 bfd_boolean exec ATTRIBUTE_UNUSED
;
2435 const bfd_target sym_vec
=
2438 bfd_target_sym_flavour
, /* flavour */
2439 BFD_ENDIAN_BIG
, /* byteorder */
2440 BFD_ENDIAN_BIG
, /* header_byteorder */
2441 (HAS_RELOC
| EXEC_P
| /* object flags */
2442 HAS_LINENO
| HAS_DEBUG
|
2443 HAS_SYMS
| HAS_LOCALS
| DYNAMIC
| WP_TEXT
| D_PAGED
),
2444 (SEC_ALLOC
| SEC_LOAD
| SEC_READONLY
| SEC_CODE
| SEC_DATA
2445 | SEC_ROM
| SEC_HAS_CONTENTS
), /* section_flags */
2446 0, /* symbol_leading_char */
2447 ' ', /* ar_pad_char */
2448 16, /* ar_max_namelen */
2449 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2450 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2451 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* data */
2452 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2453 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2454 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* hdrs */
2455 { /* bfd_check_format */
2457 bfd_sym_object_p
, /* bfd_check_format */
2461 { /* bfd_set_format */
2467 { /* bfd_write_contents */
2474 BFD_JUMP_TABLE_GENERIC (bfd_sym
),
2475 BFD_JUMP_TABLE_COPY (_bfd_generic
),
2476 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
2477 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive
),
2478 BFD_JUMP_TABLE_SYMBOLS (bfd_sym
),
2479 BFD_JUMP_TABLE_RELOCS (bfd_sym
),
2480 BFD_JUMP_TABLE_WRITE (bfd_sym
),
2481 BFD_JUMP_TABLE_LINK (bfd_sym
),
2482 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),