1 /* xSYM symbol-file support for BFD.
2 Copyright (C) 1999-2024 Free Software Foundation, Inc.
4 This file is part of BFD, the Binary File Descriptor library.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19 MA 02110-1301, USA. */
21 /* xSYM is the debugging format used by CodeWarrior on Mac OS classic. */
28 #define bfd_sym_close_and_cleanup _bfd_generic_close_and_cleanup
29 #define bfd_sym_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
30 #define bfd_sym_new_section_hook _bfd_generic_new_section_hook
31 #define bfd_sym_bfd_is_local_label_name bfd_generic_is_local_label_name
32 #define bfd_sym_bfd_is_target_special_symbol _bfd_bool_bfd_asymbol_false
33 #define bfd_sym_get_lineno _bfd_nosymbols_get_lineno
34 #define bfd_sym_find_nearest_line _bfd_nosymbols_find_nearest_line
35 #define bfd_sym_find_nearest_line_with_alt _bfd_nosymbols_find_nearest_line_with_alt
36 #define bfd_sym_find_line _bfd_nosymbols_find_line
37 #define bfd_sym_find_inliner_info _bfd_nosymbols_find_inliner_info
38 #define bfd_sym_get_symbol_version_string _bfd_nosymbols_get_symbol_version_string
39 #define bfd_sym_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
40 #define bfd_sym_read_minisymbols _bfd_generic_read_minisymbols
41 #define bfd_sym_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
42 #define bfd_sym_set_arch_mach _bfd_generic_set_arch_mach
43 #define bfd_sym_get_section_contents _bfd_generic_get_section_contents
44 #define bfd_sym_set_section_contents _bfd_generic_set_section_contents
45 #define bfd_sym_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
46 #define bfd_sym_bfd_relax_section bfd_generic_relax_section
47 #define bfd_sym_bfd_gc_sections bfd_generic_gc_sections
48 #define bfd_sym_bfd_lookup_section_flags bfd_generic_lookup_section_flags
49 #define bfd_sym_bfd_merge_sections bfd_generic_merge_sections
50 #define bfd_sym_bfd_is_group_section bfd_generic_is_group_section
51 #define bfd_sym_bfd_group_name bfd_generic_group_name
52 #define bfd_sym_bfd_discard_group bfd_generic_discard_group
53 #define bfd_sym_section_already_linked _bfd_generic_section_already_linked
54 #define bfd_sym_bfd_define_common_symbol bfd_generic_define_common_symbol
55 #define bfd_sym_bfd_link_hide_symbol _bfd_generic_link_hide_symbol
56 #define bfd_sym_bfd_define_start_stop bfd_generic_define_start_stop
57 #define bfd_sym_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
58 #define bfd_sym_bfd_link_add_symbols _bfd_generic_link_add_symbols
59 #define bfd_sym_bfd_link_just_syms _bfd_generic_link_just_syms
60 #define bfd_sym_bfd_copy_link_hash_symbol_type \
61 _bfd_generic_copy_link_hash_symbol_type
62 #define bfd_sym_bfd_final_link _bfd_generic_final_link
63 #define bfd_sym_bfd_link_split_section _bfd_generic_link_split_section
64 #define bfd_sym_bfd_link_check_relocs _bfd_generic_link_check_relocs
66 extern const bfd_target sym_vec
;
69 pstrcmp (const char *as
, const char *bs
)
71 const unsigned char *a
= (const unsigned char *) as
;
72 const unsigned char *b
= (const unsigned char *) bs
;
76 clen
= (a
[0] > b
[0]) ? b
[0] : a
[0];
77 ret
= memcmp (a
+ 1, b
+ 1, clen
);
90 compute_offset (unsigned long first_page
,
91 unsigned long page_size
,
92 unsigned long entry_size
,
93 unsigned long sym_index
)
95 unsigned long entries_per_page
= page_size
/ entry_size
;
96 unsigned long page_number
= first_page
+ (sym_index
/ entries_per_page
);
97 unsigned long page_offset
= (sym_index
% entries_per_page
) * entry_size
;
99 return (page_number
* page_size
) + page_offset
;
103 bfd_sym_mkobject (bfd
*abfd ATTRIBUTE_UNUSED
)
109 bfd_sym_print_symbol (bfd
*abfd ATTRIBUTE_UNUSED
,
110 void * afile ATTRIBUTE_UNUSED
,
111 asymbol
*symbol ATTRIBUTE_UNUSED
,
112 bfd_print_symbol_type how ATTRIBUTE_UNUSED
)
118 bfd_sym_valid (bfd
*abfd
)
120 if (abfd
== NULL
|| abfd
->xvec
== NULL
)
123 return abfd
->xvec
== &sym_vec
;
127 bfd_sym_read_name_table (bfd
*abfd
, bfd_sym_header_block
*dshb
)
129 size_t table_size
= dshb
->dshb_nte
.dti_page_count
* dshb
->dshb_page_size
;
130 size_t table_offset
= dshb
->dshb_nte
.dti_first_page
* dshb
->dshb_page_size
;
132 if (bfd_seek (abfd
, table_offset
, SEEK_SET
) != 0)
134 return _bfd_alloc_and_read (abfd
, table_size
, table_size
);
138 bfd_sym_parse_file_reference_v32 (unsigned char *buf
,
140 bfd_sym_file_reference
*entry
)
142 BFD_ASSERT (len
== 6);
144 entry
->fref_frte_index
= bfd_getb16 (buf
);
145 entry
->fref_offset
= bfd_getb32 (buf
+ 2);
149 bfd_sym_parse_disk_table_v32 (unsigned char *buf
,
151 bfd_sym_table_info
*table
)
153 BFD_ASSERT (len
== 8);
155 table
->dti_first_page
= bfd_getb16 (buf
);
156 table
->dti_page_count
= bfd_getb16 (buf
+ 2);
157 table
->dti_object_count
= bfd_getb32 (buf
+ 4);
161 bfd_sym_parse_header_v32 (unsigned char *buf
,
163 bfd_sym_header_block
*header
)
165 BFD_ASSERT (len
== 154);
167 memcpy (header
->dshb_id
, buf
, 32);
168 header
->dshb_page_size
= bfd_getb16 (buf
+ 32);
169 header
->dshb_hash_page
= bfd_getb16 (buf
+ 34);
170 header
->dshb_root_mte
= bfd_getb16 (buf
+ 36);
171 header
->dshb_mod_date
= bfd_getb32 (buf
+ 38);
173 bfd_sym_parse_disk_table_v32 (buf
+ 42, 8, &header
->dshb_frte
);
174 bfd_sym_parse_disk_table_v32 (buf
+ 50, 8, &header
->dshb_rte
);
175 bfd_sym_parse_disk_table_v32 (buf
+ 58, 8, &header
->dshb_mte
);
176 bfd_sym_parse_disk_table_v32 (buf
+ 66, 8, &header
->dshb_cmte
);
177 bfd_sym_parse_disk_table_v32 (buf
+ 74, 8, &header
->dshb_cvte
);
178 bfd_sym_parse_disk_table_v32 (buf
+ 82, 8, &header
->dshb_csnte
);
179 bfd_sym_parse_disk_table_v32 (buf
+ 90, 8, &header
->dshb_clte
);
180 bfd_sym_parse_disk_table_v32 (buf
+ 98, 8, &header
->dshb_ctte
);
181 bfd_sym_parse_disk_table_v32 (buf
+ 106, 8, &header
->dshb_tte
);
182 bfd_sym_parse_disk_table_v32 (buf
+ 114, 8, &header
->dshb_nte
);
183 bfd_sym_parse_disk_table_v32 (buf
+ 122, 8, &header
->dshb_tinfo
);
184 bfd_sym_parse_disk_table_v32 (buf
+ 130, 8, &header
->dshb_fite
);
185 bfd_sym_parse_disk_table_v32 (buf
+ 138, 8, &header
->dshb_const
);
187 memcpy (&header
->dshb_file_creator
, buf
+ 146, 4);
188 memcpy (&header
->dshb_file_type
, buf
+ 150, 4);
192 bfd_sym_read_header_v32 (bfd
*abfd
, bfd_sym_header_block
*header
)
194 unsigned char buf
[154];
197 ret
= bfd_read (buf
, 154, abfd
);
201 bfd_sym_parse_header_v32 (buf
, 154, header
);
207 bfd_sym_read_header_v34 (bfd
*abfd ATTRIBUTE_UNUSED
,
208 bfd_sym_header_block
*header ATTRIBUTE_UNUSED
)
214 bfd_sym_read_header (bfd
*abfd
,
215 bfd_sym_header_block
*header
,
216 bfd_sym_version version
)
220 case BFD_SYM_VERSION_3_5
:
221 case BFD_SYM_VERSION_3_4
:
222 return bfd_sym_read_header_v34 (abfd
, header
);
223 case BFD_SYM_VERSION_3_3
:
224 case BFD_SYM_VERSION_3_2
:
225 return bfd_sym_read_header_v32 (abfd
, header
);
226 case BFD_SYM_VERSION_3_1
:
233 bfd_sym_read_version (bfd
*abfd
, bfd_sym_version
*version
)
235 char version_string
[32];
238 ret
= bfd_read (version_string
, sizeof (version_string
), abfd
);
239 if (ret
!= sizeof (version_string
))
242 if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_1
) == 0)
243 *version
= BFD_SYM_VERSION_3_1
;
244 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_2
) == 0)
245 *version
= BFD_SYM_VERSION_3_2
;
246 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_3
) == 0)
247 *version
= BFD_SYM_VERSION_3_3
;
248 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_4
) == 0)
249 *version
= BFD_SYM_VERSION_3_4
;
250 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_5
) == 0)
251 *version
= BFD_SYM_VERSION_3_5
;
259 bfd_sym_display_table_summary (FILE *f
,
260 bfd_sym_table_info
*dti
,
263 fprintf (f
, "%-6s %13ld %13ld %13ld\n",
267 dti
->dti_object_count
);
271 bfd_sym_display_header (FILE *f
, bfd_sym_header_block
*dshb
)
273 fprintf (f
, " Version: %.*s\n", dshb
->dshb_id
[0], dshb
->dshb_id
+ 1);
274 fprintf (f
, " Page Size: 0x%x\n", dshb
->dshb_page_size
);
275 fprintf (f
, " Hash Page: %lu\n", dshb
->dshb_hash_page
);
276 fprintf (f
, " Root MTE: %lu\n", dshb
->dshb_root_mte
);
277 fprintf (f
, " Modification Date: ");
278 fprintf (f
, "[unimplemented]");
279 fprintf (f
, " (0x%lx)\n", dshb
->dshb_mod_date
);
281 fprintf (f
, " File Creator: %.4s Type: %.4s\n\n",
282 dshb
->dshb_file_creator
, dshb
->dshb_file_type
);
284 fprintf (f
, "Table Name First Page Page Count Object Count\n");
285 fprintf (f
, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
287 bfd_sym_display_table_summary (f
, &dshb
->dshb_nte
, "NTE");
288 bfd_sym_display_table_summary (f
, &dshb
->dshb_rte
, "RTE");
289 bfd_sym_display_table_summary (f
, &dshb
->dshb_mte
, "MTE");
290 bfd_sym_display_table_summary (f
, &dshb
->dshb_frte
, "FRTE");
291 bfd_sym_display_table_summary (f
, &dshb
->dshb_cmte
, "CMTE");
292 bfd_sym_display_table_summary (f
, &dshb
->dshb_cvte
, "CVTE");
293 bfd_sym_display_table_summary (f
, &dshb
->dshb_csnte
, "CSNTE");
294 bfd_sym_display_table_summary (f
, &dshb
->dshb_clte
, "CLTE");
295 bfd_sym_display_table_summary (f
, &dshb
->dshb_ctte
, "CTTE");
296 bfd_sym_display_table_summary (f
, &dshb
->dshb_tte
, "TTE");
297 bfd_sym_display_table_summary (f
, &dshb
->dshb_tinfo
, "TINFO");
298 bfd_sym_display_table_summary (f
, &dshb
->dshb_fite
, "FITE");
299 bfd_sym_display_table_summary (f
, &dshb
->dshb_const
, "CONST");
305 bfd_sym_parse_resources_table_entry_v32 (unsigned char *buf
,
307 bfd_sym_resources_table_entry
*entry
)
309 BFD_ASSERT (len
== 18);
311 memcpy (&entry
->rte_res_type
, buf
, 4);
312 entry
->rte_res_number
= bfd_getb16 (buf
+ 4);
313 entry
->rte_nte_index
= bfd_getb32 (buf
+ 6);
314 entry
->rte_mte_first
= bfd_getb16 (buf
+ 10);
315 entry
->rte_mte_last
= bfd_getb16 (buf
+ 12);
316 entry
->rte_res_size
= bfd_getb32 (buf
+ 14);
320 bfd_sym_parse_modules_table_entry_v33 (unsigned char *buf
,
322 bfd_sym_modules_table_entry
*entry
)
324 BFD_ASSERT (len
== 46);
326 entry
->mte_rte_index
= bfd_getb16 (buf
);
327 entry
->mte_res_offset
= bfd_getb32 (buf
+ 2);
328 entry
->mte_size
= bfd_getb32 (buf
+ 6);
329 entry
->mte_kind
= buf
[10];
330 entry
->mte_scope
= buf
[11];
331 entry
->mte_parent
= bfd_getb16 (buf
+ 12);
332 bfd_sym_parse_file_reference_v32 (buf
+ 14, 6, &entry
->mte_imp_fref
);
333 entry
->mte_imp_end
= bfd_getb32 (buf
+ 20);
334 entry
->mte_nte_index
= bfd_getb32 (buf
+ 24);
335 entry
->mte_cmte_index
= bfd_getb16 (buf
+ 28);
336 entry
->mte_cvte_index
= bfd_getb32 (buf
+ 30);
337 entry
->mte_clte_index
= bfd_getb16 (buf
+ 34);
338 entry
->mte_ctte_index
= bfd_getb16 (buf
+ 36);
339 entry
->mte_csnte_idx_1
= bfd_getb32 (buf
+ 38);
340 entry
->mte_csnte_idx_2
= bfd_getb32 (buf
+ 42);
344 bfd_sym_parse_file_references_table_entry_v32 (unsigned char *buf
,
346 bfd_sym_file_references_table_entry
*entry
)
350 BFD_ASSERT (len
== 10);
352 memset (entry
, 0, sizeof (bfd_sym_file_references_table_entry
));
353 type
= bfd_getb16 (buf
);
357 case BFD_SYM_END_OF_LIST_3_2
:
358 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
361 case BFD_SYM_FILE_NAME_INDEX_3_2
:
362 entry
->filename
.type
= BFD_SYM_FILE_NAME_INDEX
;
363 entry
->filename
.nte_index
= bfd_getb32 (buf
+ 2);
364 entry
->filename
.mod_date
= bfd_getb32 (buf
+ 6);
368 entry
->entry
.mte_index
= type
;
369 entry
->entry
.file_offset
= bfd_getb32 (buf
+ 2);
374 bfd_sym_parse_contained_modules_table_entry_v32 (unsigned char *buf
,
376 bfd_sym_contained_modules_table_entry
*entry
)
380 BFD_ASSERT (len
== 6);
382 memset (entry
, 0, sizeof (bfd_sym_contained_modules_table_entry
));
383 type
= bfd_getb16 (buf
);
387 case BFD_SYM_END_OF_LIST_3_2
:
388 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
392 entry
->entry
.mte_index
= type
;
393 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 2);
399 bfd_sym_parse_contained_variables_table_entry_v32 (unsigned char *buf
,
401 bfd_sym_contained_variables_table_entry
*entry
)
405 BFD_ASSERT (len
== 26);
407 memset (entry
, 0, sizeof (bfd_sym_contained_variables_table_entry
));
408 type
= bfd_getb16 (buf
);
412 case BFD_SYM_END_OF_LIST_3_2
:
413 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
416 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
417 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
418 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
422 entry
->entry
.tte_index
= type
;
423 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 2);
424 entry
->entry
.file_delta
= bfd_getb16 (buf
+ 6);
425 entry
->entry
.scope
= buf
[8];
426 entry
->entry
.la_size
= buf
[9];
428 if (entry
->entry
.la_size
== BFD_SYM_CVTE_SCA
)
430 entry
->entry
.address
.scstruct
.sca_kind
= buf
[10];
431 entry
->entry
.address
.scstruct
.sca_class
= buf
[11];
432 entry
->entry
.address
.scstruct
.sca_offset
= bfd_getb32 (buf
+ 12);
434 else if (entry
->entry
.la_size
<= BFD_SYM_CVTE_SCA
)
436 #if BFD_SYM_CVTE_SCA > 0
437 memcpy (&entry
->entry
.address
.lastruct
.la
, buf
+ 10,
440 entry
->entry
.address
.lastruct
.la_kind
= buf
[23];
442 else if (entry
->entry
.la_size
== BFD_SYM_CVTE_BIG_LA
)
444 entry
->entry
.address
.biglastruct
.big_la
= bfd_getb32 (buf
+ 10);
445 entry
->entry
.address
.biglastruct
.big_la_kind
= buf
[12];
451 bfd_sym_parse_contained_statements_table_entry_v32 (unsigned char *buf
,
453 bfd_sym_contained_statements_table_entry
*entry
)
457 BFD_ASSERT (len
== 8);
459 memset (entry
, 0, sizeof (bfd_sym_contained_statements_table_entry
));
460 type
= bfd_getb16 (buf
);
464 case BFD_SYM_END_OF_LIST_3_2
:
465 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
468 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
469 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
470 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
474 entry
->entry
.mte_index
= type
;
475 entry
->entry
.mte_offset
= bfd_getb16 (buf
+ 2);
476 entry
->entry
.file_delta
= bfd_getb32 (buf
+ 4);
482 bfd_sym_parse_contained_labels_table_entry_v32 (unsigned char *buf
,
484 bfd_sym_contained_labels_table_entry
*entry
)
488 BFD_ASSERT (len
== 12);
490 memset (entry
, 0, sizeof (bfd_sym_contained_labels_table_entry
));
491 type
= bfd_getb16 (buf
);
495 case BFD_SYM_END_OF_LIST_3_2
:
496 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
499 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
500 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
501 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
505 entry
->entry
.mte_index
= type
;
506 entry
->entry
.mte_offset
= bfd_getb16 (buf
+ 2);
507 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 4);
508 entry
->entry
.file_delta
= bfd_getb16 (buf
+ 8);
509 entry
->entry
.scope
= bfd_getb16 (buf
+ 10);
515 bfd_sym_parse_type_table_entry_v32 (unsigned char *buf
,
517 bfd_sym_type_table_entry
*entry
)
519 BFD_ASSERT (len
== 4);
521 *entry
= bfd_getb32 (buf
);
525 bfd_sym_fetch_resources_table_entry (bfd
*abfd
,
526 bfd_sym_resources_table_entry
*entry
,
527 unsigned long sym_index
)
529 void (*parser
) (unsigned char *, size_t, bfd_sym_resources_table_entry
*);
530 unsigned long offset
;
531 unsigned long entry_size
;
532 unsigned char buf
[18];
533 bfd_sym_data_struct
*sdata
= NULL
;
536 BFD_ASSERT (bfd_sym_valid (abfd
));
537 sdata
= abfd
->tdata
.sym_data
;
542 switch (sdata
->version
)
544 case BFD_SYM_VERSION_3_5
:
545 case BFD_SYM_VERSION_3_4
:
548 case BFD_SYM_VERSION_3_3
:
549 case BFD_SYM_VERSION_3_2
:
551 parser
= bfd_sym_parse_resources_table_entry_v32
;
554 case BFD_SYM_VERSION_3_1
:
561 offset
= compute_offset (sdata
->header
.dshb_rte
.dti_first_page
,
562 sdata
->header
.dshb_page_size
,
563 entry_size
, sym_index
);
565 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
567 if (bfd_read (buf
, entry_size
, abfd
) != entry_size
)
570 (*parser
) (buf
, entry_size
, entry
);
576 bfd_sym_fetch_modules_table_entry (bfd
*abfd
,
577 bfd_sym_modules_table_entry
*entry
,
578 unsigned long sym_index
)
580 void (*parser
) (unsigned char *, size_t, bfd_sym_modules_table_entry
*);
581 unsigned long offset
;
582 unsigned long entry_size
;
583 unsigned char buf
[46];
584 bfd_sym_data_struct
*sdata
= NULL
;
587 BFD_ASSERT (bfd_sym_valid (abfd
));
588 sdata
= abfd
->tdata
.sym_data
;
593 switch (sdata
->version
)
595 case BFD_SYM_VERSION_3_5
:
596 case BFD_SYM_VERSION_3_4
:
599 case BFD_SYM_VERSION_3_3
:
601 parser
= bfd_sym_parse_modules_table_entry_v33
;
604 case BFD_SYM_VERSION_3_2
:
605 case BFD_SYM_VERSION_3_1
:
612 offset
= compute_offset (sdata
->header
.dshb_mte
.dti_first_page
,
613 sdata
->header
.dshb_page_size
,
614 entry_size
, sym_index
);
616 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
618 if (bfd_read (buf
, entry_size
, abfd
) != entry_size
)
621 (*parser
) (buf
, entry_size
, entry
);
627 bfd_sym_fetch_file_references_table_entry (bfd
*abfd
,
628 bfd_sym_file_references_table_entry
*entry
,
629 unsigned long sym_index
)
631 void (*parser
) (unsigned char *, size_t, bfd_sym_file_references_table_entry
*);
632 unsigned long offset
;
633 unsigned long entry_size
= 0;
634 unsigned char buf
[8];
635 bfd_sym_data_struct
*sdata
= NULL
;
638 BFD_ASSERT (bfd_sym_valid (abfd
));
639 sdata
= abfd
->tdata
.sym_data
;
644 switch (sdata
->version
)
646 case BFD_SYM_VERSION_3_3
:
647 case BFD_SYM_VERSION_3_2
:
649 parser
= bfd_sym_parse_file_references_table_entry_v32
;
652 case BFD_SYM_VERSION_3_5
:
653 case BFD_SYM_VERSION_3_4
:
654 case BFD_SYM_VERSION_3_1
:
662 offset
= compute_offset (sdata
->header
.dshb_frte
.dti_first_page
,
663 sdata
->header
.dshb_page_size
,
664 entry_size
, sym_index
);
666 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
668 if (bfd_read (buf
, entry_size
, abfd
) != entry_size
)
671 (*parser
) (buf
, entry_size
, entry
);
677 bfd_sym_fetch_contained_modules_table_entry (bfd
*abfd
,
678 bfd_sym_contained_modules_table_entry
*entry
,
679 unsigned long sym_index
)
681 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_modules_table_entry
*);
682 unsigned long offset
;
683 unsigned long entry_size
= 0;
684 unsigned char buf
[6];
685 bfd_sym_data_struct
*sdata
= NULL
;
688 BFD_ASSERT (bfd_sym_valid (abfd
));
689 sdata
= abfd
->tdata
.sym_data
;
694 switch (sdata
->version
)
696 case BFD_SYM_VERSION_3_3
:
697 case BFD_SYM_VERSION_3_2
:
699 parser
= bfd_sym_parse_contained_modules_table_entry_v32
;
702 case BFD_SYM_VERSION_3_5
:
703 case BFD_SYM_VERSION_3_4
:
704 case BFD_SYM_VERSION_3_1
:
712 offset
= compute_offset (sdata
->header
.dshb_cmte
.dti_first_page
,
713 sdata
->header
.dshb_page_size
,
714 entry_size
, sym_index
);
716 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
718 if (bfd_read (buf
, entry_size
, abfd
) != entry_size
)
721 (*parser
) (buf
, entry_size
, entry
);
727 bfd_sym_fetch_contained_variables_table_entry (bfd
*abfd
,
728 bfd_sym_contained_variables_table_entry
*entry
,
729 unsigned long sym_index
)
731 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_variables_table_entry
*);
732 unsigned long offset
;
733 unsigned long entry_size
= 0;
734 unsigned char buf
[26];
735 bfd_sym_data_struct
*sdata
= NULL
;
738 BFD_ASSERT (bfd_sym_valid (abfd
));
739 sdata
= abfd
->tdata
.sym_data
;
744 switch (sdata
->version
)
746 case BFD_SYM_VERSION_3_3
:
747 case BFD_SYM_VERSION_3_2
:
749 parser
= bfd_sym_parse_contained_variables_table_entry_v32
;
752 case BFD_SYM_VERSION_3_5
:
753 case BFD_SYM_VERSION_3_4
:
754 case BFD_SYM_VERSION_3_1
:
762 offset
= compute_offset (sdata
->header
.dshb_cvte
.dti_first_page
,
763 sdata
->header
.dshb_page_size
,
764 entry_size
, sym_index
);
766 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
768 if (bfd_read (buf
, entry_size
, abfd
) != entry_size
)
771 (*parser
) (buf
, entry_size
, entry
);
777 bfd_sym_fetch_contained_statements_table_entry (bfd
*abfd
,
778 bfd_sym_contained_statements_table_entry
*entry
,
779 unsigned long sym_index
)
781 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_statements_table_entry
*);
782 unsigned long offset
;
783 unsigned long entry_size
= 0;
784 unsigned char buf
[8];
785 bfd_sym_data_struct
*sdata
= NULL
;
788 BFD_ASSERT (bfd_sym_valid (abfd
));
789 sdata
= abfd
->tdata
.sym_data
;
794 switch (sdata
->version
)
796 case BFD_SYM_VERSION_3_3
:
797 case BFD_SYM_VERSION_3_2
:
799 parser
= bfd_sym_parse_contained_statements_table_entry_v32
;
802 case BFD_SYM_VERSION_3_5
:
803 case BFD_SYM_VERSION_3_4
:
804 case BFD_SYM_VERSION_3_1
:
812 offset
= compute_offset (sdata
->header
.dshb_csnte
.dti_first_page
,
813 sdata
->header
.dshb_page_size
,
814 entry_size
, sym_index
);
816 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
818 if (bfd_read (buf
, entry_size
, abfd
) != entry_size
)
821 (*parser
) (buf
, entry_size
, entry
);
827 bfd_sym_fetch_contained_labels_table_entry (bfd
*abfd
,
828 bfd_sym_contained_labels_table_entry
*entry
,
829 unsigned long sym_index
)
831 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_labels_table_entry
*);
832 unsigned long offset
;
833 unsigned long entry_size
= 0;
834 unsigned char buf
[12];
835 bfd_sym_data_struct
*sdata
= NULL
;
838 BFD_ASSERT (bfd_sym_valid (abfd
));
839 sdata
= abfd
->tdata
.sym_data
;
844 switch (sdata
->version
)
846 case BFD_SYM_VERSION_3_3
:
847 case BFD_SYM_VERSION_3_2
:
849 parser
= bfd_sym_parse_contained_labels_table_entry_v32
;
852 case BFD_SYM_VERSION_3_5
:
853 case BFD_SYM_VERSION_3_4
:
854 case BFD_SYM_VERSION_3_1
:
862 offset
= compute_offset (sdata
->header
.dshb_clte
.dti_first_page
,
863 sdata
->header
.dshb_page_size
,
864 entry_size
, sym_index
);
866 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
868 if (bfd_read (buf
, entry_size
, abfd
) != entry_size
)
871 (*parser
) (buf
, entry_size
, entry
);
877 bfd_sym_fetch_contained_types_table_entry (bfd
*abfd
,
878 bfd_sym_contained_types_table_entry
*entry
,
879 unsigned long sym_index
)
881 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_types_table_entry
*);
882 unsigned long offset
;
883 unsigned long entry_size
= 0;
884 unsigned char buf
[0];
885 bfd_sym_data_struct
*sdata
= NULL
;
888 BFD_ASSERT (bfd_sym_valid (abfd
));
889 sdata
= abfd
->tdata
.sym_data
;
894 switch (sdata
->version
)
896 case BFD_SYM_VERSION_3_3
:
897 case BFD_SYM_VERSION_3_2
:
902 case BFD_SYM_VERSION_3_5
:
903 case BFD_SYM_VERSION_3_4
:
904 case BFD_SYM_VERSION_3_1
:
912 offset
= compute_offset (sdata
->header
.dshb_ctte
.dti_first_page
,
913 sdata
->header
.dshb_page_size
,
914 entry_size
, sym_index
);
916 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
918 if (bfd_read (buf
, entry_size
, abfd
) != entry_size
)
921 (*parser
) (buf
, entry_size
, entry
);
927 bfd_sym_fetch_file_references_index_table_entry (bfd
*abfd
,
928 bfd_sym_file_references_index_table_entry
*entry
,
929 unsigned long sym_index
)
931 void (*parser
) (unsigned char *, size_t, bfd_sym_file_references_index_table_entry
*);
932 unsigned long offset
;
933 unsigned long entry_size
= 0;
934 unsigned char buf
[0];
935 bfd_sym_data_struct
*sdata
= NULL
;
938 BFD_ASSERT (bfd_sym_valid (abfd
));
939 sdata
= abfd
->tdata
.sym_data
;
944 switch (sdata
->version
)
946 case BFD_SYM_VERSION_3_3
:
947 case BFD_SYM_VERSION_3_2
:
952 case BFD_SYM_VERSION_3_5
:
953 case BFD_SYM_VERSION_3_4
:
954 case BFD_SYM_VERSION_3_1
:
962 offset
= compute_offset (sdata
->header
.dshb_fite
.dti_first_page
,
963 sdata
->header
.dshb_page_size
,
964 entry_size
, sym_index
);
966 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
968 if (bfd_read (buf
, entry_size
, abfd
) != entry_size
)
971 (*parser
) (buf
, entry_size
, entry
);
977 bfd_sym_fetch_constant_pool_entry (bfd
*abfd
,
978 bfd_sym_constant_pool_entry
*entry
,
979 unsigned long sym_index
)
981 void (*parser
) (unsigned char *, size_t, bfd_sym_constant_pool_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
,
1014 entry_size
, sym_index
);
1016 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1018 if (bfd_read (buf
, entry_size
, abfd
) != entry_size
)
1021 (*parser
) (buf
, entry_size
, entry
);
1027 bfd_sym_fetch_type_table_entry (bfd
*abfd
,
1028 bfd_sym_type_table_entry
*entry
,
1029 unsigned long sym_index
)
1031 void (*parser
) (unsigned char *, size_t, bfd_sym_type_table_entry
*);
1032 unsigned long offset
;
1033 unsigned long entry_size
= 0;
1034 unsigned char buf
[4];
1035 bfd_sym_data_struct
*sdata
= NULL
;
1038 BFD_ASSERT (bfd_sym_valid (abfd
));
1039 sdata
= abfd
->tdata
.sym_data
;
1041 switch (sdata
->version
)
1043 case BFD_SYM_VERSION_3_3
:
1044 case BFD_SYM_VERSION_3_2
:
1046 parser
= bfd_sym_parse_type_table_entry_v32
;
1049 case BFD_SYM_VERSION_3_5
:
1050 case BFD_SYM_VERSION_3_4
:
1051 case BFD_SYM_VERSION_3_1
:
1059 offset
= compute_offset (sdata
->header
.dshb_tte
.dti_first_page
,
1060 sdata
->header
.dshb_page_size
,
1061 entry_size
, sym_index
);
1063 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1065 if (bfd_read (buf
, entry_size
, abfd
) != entry_size
)
1068 (*parser
) (buf
, entry_size
, entry
);
1074 bfd_sym_fetch_type_information_table_entry (bfd
*abfd
,
1075 bfd_sym_type_information_table_entry
*entry
,
1076 unsigned long offset
)
1078 unsigned char buf
[4];
1080 BFD_ASSERT (bfd_sym_valid (abfd
));
1085 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1088 if (bfd_read (buf
, 4, abfd
) != 4)
1090 entry
->nte_index
= bfd_getb32 (buf
);
1092 if (bfd_read (buf
, 2, abfd
) != 2)
1094 entry
->physical_size
= bfd_getb16 (buf
);
1096 if (entry
->physical_size
& 0x8000)
1098 if (bfd_read (buf
, 4, abfd
) != 4)
1100 entry
->physical_size
&= 0x7fff;
1101 entry
->logical_size
= bfd_getb32 (buf
);
1102 entry
->offset
= offset
+ 10;
1106 if (bfd_read (buf
, 2, abfd
) != 2)
1108 entry
->physical_size
&= 0x7fff;
1109 entry
->logical_size
= bfd_getb16 (buf
);
1110 entry
->offset
= offset
+ 8;
1117 bfd_sym_fetch_type_table_information (bfd
*abfd
,
1118 bfd_sym_type_information_table_entry
*entry
,
1119 unsigned long sym_index
)
1121 bfd_sym_type_table_entry tindex
;
1122 bfd_sym_data_struct
*sdata
= NULL
;
1124 BFD_ASSERT (bfd_sym_valid (abfd
));
1125 sdata
= abfd
->tdata
.sym_data
;
1127 if (sdata
->header
.dshb_tte
.dti_object_count
<= 99)
1129 if (sym_index
< 100)
1132 if (bfd_sym_fetch_type_table_entry (abfd
, &tindex
, sym_index
- 100) < 0)
1134 if (bfd_sym_fetch_type_information_table_entry (abfd
, entry
, tindex
) < 0)
1140 const unsigned char *
1141 bfd_sym_symbol_name (bfd
*abfd
, unsigned long sym_index
)
1143 bfd_sym_data_struct
*sdata
= NULL
;
1145 BFD_ASSERT (bfd_sym_valid (abfd
));
1146 sdata
= abfd
->tdata
.sym_data
;
1149 return (const unsigned char *) "";
1152 if ((sym_index
/ sdata
->header
.dshb_page_size
)
1153 > sdata
->header
.dshb_nte
.dti_page_count
)
1154 return (const unsigned char *) "\09[INVALID]";
1156 return (const unsigned char *) sdata
->name_table
+ sym_index
;
1159 const unsigned char *
1160 bfd_sym_module_name (bfd
*abfd
, unsigned long sym_index
)
1162 bfd_sym_modules_table_entry entry
;
1164 if (bfd_sym_fetch_modules_table_entry (abfd
, &entry
, sym_index
) < 0)
1165 return (const unsigned char *) "\09[INVALID]";
1167 return bfd_sym_symbol_name (abfd
, entry
.mte_nte_index
);
1171 bfd_sym_unparse_storage_kind (enum bfd_sym_storage_kind kind
)
1175 case BFD_SYM_STORAGE_KIND_LOCAL
: return "LOCAL";
1176 case BFD_SYM_STORAGE_KIND_VALUE
: return "VALUE";
1177 case BFD_SYM_STORAGE_KIND_REFERENCE
: return "REFERENCE";
1178 case BFD_SYM_STORAGE_KIND_WITH
: return "WITH";
1179 default: return "[UNKNOWN]";
1184 bfd_sym_unparse_storage_class (enum bfd_sym_storage_class kind
)
1188 case BFD_SYM_STORAGE_CLASS_REGISTER
: return "REGISTER";
1189 case BFD_SYM_STORAGE_CLASS_GLOBAL
: return "GLOBAL";
1190 case BFD_SYM_STORAGE_CLASS_FRAME_RELATIVE
: return "FRAME_RELATIVE";
1191 case BFD_SYM_STORAGE_CLASS_STACK_RELATIVE
: return "STACK_RELATIVE";
1192 case BFD_SYM_STORAGE_CLASS_ABSOLUTE
: return "ABSOLUTE";
1193 case BFD_SYM_STORAGE_CLASS_CONSTANT
: return "CONSTANT";
1194 case BFD_SYM_STORAGE_CLASS_RESOURCE
: return "RESOURCE";
1195 case BFD_SYM_STORAGE_CLASS_BIGCONSTANT
: return "BIGCONSTANT";
1196 default: return "[UNKNOWN]";
1201 bfd_sym_unparse_module_kind (enum bfd_sym_module_kind kind
)
1205 case BFD_SYM_MODULE_KIND_NONE
: return "NONE";
1206 case BFD_SYM_MODULE_KIND_PROGRAM
: return "PROGRAM";
1207 case BFD_SYM_MODULE_KIND_UNIT
: return "UNIT";
1208 case BFD_SYM_MODULE_KIND_PROCEDURE
: return "PROCEDURE";
1209 case BFD_SYM_MODULE_KIND_FUNCTION
: return "FUNCTION";
1210 case BFD_SYM_MODULE_KIND_DATA
: return "DATA";
1211 case BFD_SYM_MODULE_KIND_BLOCK
: return "BLOCK";
1212 default: return "[UNKNOWN]";
1217 bfd_sym_unparse_symbol_scope (enum bfd_sym_symbol_scope scope
)
1221 case BFD_SYM_SYMBOL_SCOPE_LOCAL
: return "LOCAL";
1222 case BFD_SYM_SYMBOL_SCOPE_GLOBAL
: return "GLOBAL";
1229 bfd_sym_print_file_reference (bfd
*abfd
,
1231 bfd_sym_file_reference
*entry
)
1233 bfd_sym_file_references_table_entry frtentry
;
1236 ret
= bfd_sym_fetch_file_references_table_entry (abfd
, &frtentry
,
1237 entry
->fref_frte_index
);
1238 fprintf (f
, "FILE ");
1240 if ((ret
< 0) || (frtentry
.generic
.type
!= BFD_SYM_FILE_NAME_INDEX
))
1241 fprintf (f
, "[INVALID]");
1243 fprintf (f
, "\"%.*s\"",
1244 bfd_sym_symbol_name (abfd
, frtentry
.filename
.nte_index
)[0],
1245 &bfd_sym_symbol_name (abfd
, frtentry
.filename
.nte_index
)[1]);
1247 fprintf (f
, " (FRTE %lu)", entry
->fref_frte_index
);
1251 bfd_sym_print_resources_table_entry (bfd
*abfd
,
1253 bfd_sym_resources_table_entry
*entry
)
1255 fprintf (f
, " \"%.*s\" (NTE %lu), type \"%.4s\", num %u, size %lu, MTE %lu -- %lu",
1256 bfd_sym_symbol_name (abfd
, entry
->rte_nte_index
)[0],
1257 &bfd_sym_symbol_name (abfd
, entry
->rte_nte_index
)[1],
1258 entry
->rte_nte_index
, entry
->rte_res_type
, entry
->rte_res_number
,
1259 entry
->rte_res_size
, entry
->rte_mte_first
, entry
->rte_mte_last
);
1263 bfd_sym_print_modules_table_entry (bfd
*abfd
,
1265 bfd_sym_modules_table_entry
*entry
)
1267 fprintf (f
, "\"%.*s\" (NTE %lu)",
1268 bfd_sym_symbol_name (abfd
, entry
->mte_nte_index
)[0],
1269 &bfd_sym_symbol_name (abfd
, entry
->mte_nte_index
)[1],
1270 entry
->mte_nte_index
);
1274 bfd_sym_print_file_reference (abfd
, f
, &entry
->mte_imp_fref
);
1275 fprintf (f
, " range %lu -- %lu",
1276 entry
->mte_imp_fref
.fref_offset
, entry
->mte_imp_end
);
1280 fprintf (f
, "kind %s", bfd_sym_unparse_module_kind (entry
->mte_kind
));
1281 fprintf (f
, ", scope %s", bfd_sym_unparse_symbol_scope (entry
->mte_scope
));
1283 fprintf (f
, ", RTE %lu, offset %lu, size %lu",
1284 entry
->mte_rte_index
, entry
->mte_res_offset
, entry
->mte_size
);
1288 fprintf (f
, "CMTE %lu, CVTE %lu, CLTE %lu, CTTE %lu, CSNTE1 %lu, CSNTE2 %lu",
1289 entry
->mte_cmte_index
, entry
->mte_cvte_index
,
1290 entry
->mte_clte_index
, entry
->mte_ctte_index
,
1291 entry
->mte_csnte_idx_1
, entry
->mte_csnte_idx_2
);
1293 if (entry
->mte_parent
!= 0)
1294 fprintf (f
, ", parent %lu", entry
->mte_parent
);
1296 fprintf (f
, ", no parent");
1298 if (entry
->mte_cmte_index
!= 0)
1299 fprintf (f
, ", child %lu", entry
->mte_cmte_index
);
1301 fprintf (f
, ", no child");
1305 bfd_sym_print_file_references_table_entry (bfd
*abfd
,
1307 bfd_sym_file_references_table_entry
*entry
)
1309 switch (entry
->generic
.type
)
1311 case BFD_SYM_FILE_NAME_INDEX
:
1312 fprintf (f
, "FILE \"%.*s\" (NTE %lu), modtime ",
1313 bfd_sym_symbol_name (abfd
, entry
->filename
.nte_index
)[0],
1314 &bfd_sym_symbol_name (abfd
, entry
->filename
.nte_index
)[1],
1315 entry
->filename
.nte_index
);
1317 fprintf (f
, "[UNIMPLEMENTED]");
1318 /* printModDate (entry->filename.mod_date); */
1319 fprintf (f
, " (0x%lx)", entry
->filename
.mod_date
);
1322 case BFD_SYM_END_OF_LIST
:
1327 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu",
1328 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1329 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1330 entry
->entry
.mte_index
,
1331 entry
->entry
.file_offset
);
1337 bfd_sym_print_contained_modules_table_entry (bfd
*abfd
,
1339 bfd_sym_contained_modules_table_entry
*entry
)
1341 switch (entry
->generic
.type
)
1343 case BFD_SYM_END_OF_LIST
:
1348 fprintf (f
, "\"%.*s\" (MTE %lu, NTE %lu)",
1349 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1350 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1351 entry
->entry
.mte_index
,
1352 entry
->entry
.nte_index
);
1358 bfd_sym_print_contained_variables_table_entry (bfd
*abfd
,
1360 bfd_sym_contained_variables_table_entry
*entry
)
1362 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1368 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1370 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1371 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1375 fprintf (f
, "\"%.*s\" (NTE %lu)",
1376 bfd_sym_symbol_name (abfd
, entry
->entry
.nte_index
)[0],
1377 &bfd_sym_symbol_name (abfd
, entry
->entry
.nte_index
)[1],
1378 entry
->entry
.nte_index
);
1380 fprintf (f
, ", TTE %lu", entry
->entry
.tte_index
);
1381 fprintf (f
, ", offset %lu", entry
->entry
.file_delta
);
1382 fprintf (f
, ", scope %s", bfd_sym_unparse_symbol_scope (entry
->entry
.scope
));
1384 if (entry
->entry
.la_size
== BFD_SYM_CVTE_SCA
)
1385 fprintf (f
, ", latype %s, laclass %s, laoffset %lu",
1386 bfd_sym_unparse_storage_kind (entry
->entry
.address
.scstruct
.sca_kind
),
1387 bfd_sym_unparse_storage_class (entry
->entry
.address
.scstruct
.sca_class
),
1388 entry
->entry
.address
.scstruct
.sca_offset
);
1389 else if (entry
->entry
.la_size
<= BFD_SYM_CVTE_LA_MAX_SIZE
)
1393 fprintf (f
, ", la [");
1394 for (i
= 0; i
< entry
->entry
.la_size
; i
++)
1395 fprintf (f
, "0x%02x ", entry
->entry
.address
.lastruct
.la
[i
]);
1398 else if (entry
->entry
.la_size
== BFD_SYM_CVTE_BIG_LA
)
1399 fprintf (f
, ", bigla %lu, biglakind %u",
1400 entry
->entry
.address
.biglastruct
.big_la
,
1401 entry
->entry
.address
.biglastruct
.big_la_kind
);
1404 fprintf (f
, ", la [INVALID]");
1408 bfd_sym_print_contained_statements_table_entry (bfd
*abfd
,
1410 bfd_sym_contained_statements_table_entry
*entry
)
1412 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1418 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1420 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1421 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1425 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu, delta %lu",
1426 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1427 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1428 entry
->entry
.mte_index
,
1429 entry
->entry
.mte_offset
,
1430 entry
->entry
.file_delta
);
1434 bfd_sym_print_contained_labels_table_entry (bfd
*abfd
,
1436 bfd_sym_contained_labels_table_entry
*entry
)
1438 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1444 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1446 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1447 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1451 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu, delta %lu, scope %s",
1452 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1453 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1454 entry
->entry
.mte_index
,
1455 entry
->entry
.mte_offset
,
1456 entry
->entry
.file_delta
,
1457 bfd_sym_unparse_symbol_scope (entry
->entry
.scope
));
1461 bfd_sym_print_contained_types_table_entry (bfd
*abfd ATTRIBUTE_UNUSED
,
1463 bfd_sym_contained_types_table_entry
*entry ATTRIBUTE_UNUSED
)
1465 fprintf (f
, "[UNIMPLEMENTED]");
1469 bfd_sym_type_operator_name (unsigned char num
)
1473 case 1: return "TTE";
1474 case 2: return "PointerTo";
1475 case 3: return "ScalarOf";
1476 case 4: return "ConstantOf";
1477 case 5: return "EnumerationOf";
1478 case 6: return "VectorOf";
1479 case 7: return "RecordOf";
1480 case 8: return "UnionOf";
1481 case 9: return "SubRangeOf";
1482 case 10: return "SetOf";
1483 case 11: return "NamedTypeOf";
1484 case 12: return "ProcOf";
1485 case 13: return "ValueOf";
1486 case 14: return "ArrayOf";
1487 default: return "[UNKNOWN OPERATOR]";
1492 bfd_sym_type_basic_name (unsigned char num
)
1496 case 0: return "void";
1497 case 1: return "pascal string";
1498 case 2: return "unsigned long";
1499 case 3: return "signed long";
1500 case 4: return "extended (10 bytes)";
1501 case 5: return "pascal boolean (1 byte)";
1502 case 6: return "unsigned byte";
1503 case 7: return "signed byte";
1504 case 8: return "character (1 byte)";
1505 case 9: return "wide character (2 bytes)";
1506 case 10: return "unsigned short";
1507 case 11: return "signed short";
1508 case 12: return "singled";
1509 case 13: return "double";
1510 case 14: return "extended (12 bytes)";
1511 case 15: return "computational (8 bytes)";
1512 case 16: return "c string";
1513 case 17: return "as-is string";
1514 default: return "[UNKNOWN BASIC TYPE]";
1519 bfd_sym_fetch_long (unsigned char *buf
,
1521 unsigned long offset
,
1522 unsigned long *offsetptr
,
1533 else if (! (buf
[offset
] & 0x80))
1535 *value
= buf
[offset
];
1539 else if (buf
[offset
] == 0xc0)
1541 if ((offset
+ 5) > len
)
1549 *value
= bfd_getb32 (buf
+ offset
+ 1);
1554 else if ((buf
[offset
] & 0xc0) == 0xc0)
1556 *value
= -(buf
[offset
] & 0x3f);
1560 else if ((buf
[offset
] & 0xc0) == 0x80)
1562 if ((offset
+ 2) > len
)
1570 *value
= bfd_getb16 (buf
+ offset
) & 0x3fff;
1578 if (offsetptr
!= NULL
)
1579 *offsetptr
= offset
;
1585 bfd_sym_print_type_information (bfd
*abfd
,
1589 unsigned long offset
,
1590 unsigned long *offsetptr
)
1596 fprintf (f
, "[NULL]");
1598 if (offsetptr
!= NULL
)
1599 *offsetptr
= offset
;
1606 if (! (type
& 0x80))
1608 fprintf (f
, "[%s] (0x%x)", bfd_sym_type_basic_name (type
& 0x7f), type
);
1610 if (offsetptr
!= NULL
)
1611 *offsetptr
= offset
;
1616 fprintf (f
, "[packed ");
1620 switch (type
& 0x3f)
1625 bfd_sym_type_information_table_entry tinfo
;
1627 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1629 fprintf (f
, "[INVALID]");
1632 if (bfd_sym_fetch_type_table_information (abfd
, &tinfo
, value
) < 0)
1633 fprintf (f
, "[INVALID]");
1635 fprintf (f
, "\"%.*s\"",
1636 bfd_sym_symbol_name (abfd
, tinfo
.nte_index
)[0],
1637 &bfd_sym_symbol_name (abfd
, tinfo
.nte_index
)[1]);
1639 fprintf (f
, " (TTE %lu)", (unsigned long) value
);
1644 fprintf (f
, "pointer (0x%x) to ", type
);
1645 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1652 fprintf (f
, "scalar (0x%x) of ", type
);
1653 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1654 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1655 fprintf (f
, " (%lu)", (unsigned long) value
);
1661 long lower
, upper
, nelem
;
1664 fprintf (f
, "enumeration (0x%x) of ", type
);
1665 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1666 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &lower
);
1667 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &upper
);
1668 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &nelem
);
1669 fprintf (f
, " from %lu to %lu with %lu elements: ",
1670 (unsigned long) lower
, (unsigned long) upper
,
1671 (unsigned long) nelem
);
1673 for (i
= 0; i
< nelem
; i
++)
1676 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1682 fprintf (f
, "vector (0x%x)", type
);
1683 fprintf (f
, "\n index ");
1684 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1685 fprintf (f
, "\n target ");
1686 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1692 long nrec
, eloff
, i
;
1694 if ((type
& 0x3f) == 7)
1695 fprintf (f
, "record (0x%x) of ", type
);
1697 fprintf (f
, "union (0x%x) of ", type
);
1699 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &nrec
);
1700 fprintf (f
, "%lu elements: ", (unsigned long) nrec
);
1702 for (i
= 0; i
< nrec
; i
++)
1704 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &eloff
);
1706 fprintf (f
, "offset %lu: ", (unsigned long) eloff
);
1707 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1713 fprintf (f
, "subrange (0x%x) of ", type
);
1714 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1715 fprintf (f
, " lower ");
1716 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1717 fprintf (f
, " upper ");
1718 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1725 fprintf (f
, "named type (0x%x) ", type
);
1726 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1728 fprintf (f
, "[INVALID]");
1730 fprintf (f
, "\"%.*s\"",
1731 bfd_sym_symbol_name (abfd
, value
)[0],
1732 &bfd_sym_symbol_name (abfd
, value
)[1]);
1734 fprintf (f
, " (NTE %lu) with type ", (unsigned long) value
);
1735 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1740 fprintf (f
, "%s (0x%x)", bfd_sym_type_operator_name (type
), type
);
1744 if (type
== (0x40 | 0x6))
1751 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &n
);
1752 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &width
);
1753 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &m
);
1754 /* fprintf (f, "\n "); */
1755 fprintf (f
, " N %ld, width %ld, M %ld, ", n
, width
, m
);
1756 for (i
= 0; i
< m
; i
++)
1758 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &l
);
1761 fprintf (f
, "%ld", l
);
1764 else if (type
& 0x40)
1766 /* Other packed type. */
1769 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &msb
);
1770 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &lsb
);
1771 /* fprintf (f, "\n "); */
1772 fprintf (f
, " msb %ld, lsb %ld", msb
, lsb
);
1777 if (offsetptr
!= NULL
)
1778 *offsetptr
= offset
;
1782 bfd_sym_print_type_information_table_entry (bfd
*abfd
,
1784 bfd_sym_type_information_table_entry
*entry
)
1787 unsigned long offset
;
1790 fprintf (f
, "\"%.*s\" (NTE %lu), %lu bytes at %lu, logical size %lu",
1791 bfd_sym_symbol_name (abfd
, entry
->nte_index
)[0],
1792 &bfd_sym_symbol_name (abfd
, entry
->nte_index
)[1],
1794 entry
->physical_size
, entry
->offset
, entry
->logical_size
);
1798 if (bfd_seek (abfd
, entry
->offset
, SEEK_SET
) != 0
1799 || (buf
= _bfd_malloc_and_read (abfd
, entry
->physical_size
,
1800 entry
->physical_size
)) == NULL
)
1802 fprintf (f
, "[ERROR]\n");
1807 for (i
= 0; i
< entry
->physical_size
; i
++)
1810 fprintf (f
, "0x%02x", buf
[i
]);
1812 fprintf (f
, " 0x%02x", buf
[i
]);
1818 bfd_sym_print_type_information (abfd
, f
, buf
, entry
->physical_size
, 0, &offset
);
1820 if (offset
!= entry
->physical_size
)
1821 fprintf (f
, "\n [parser used %lu bytes instead of %lu]", offset
, entry
->physical_size
);
1826 bfd_sym_print_file_references_index_table_entry (bfd
*abfd ATTRIBUTE_UNUSED
,
1828 bfd_sym_file_references_index_table_entry
*entry ATTRIBUTE_UNUSED
)
1830 fprintf (f
, "[UNIMPLEMENTED]");
1834 bfd_sym_print_constant_pool_entry (bfd
*abfd ATTRIBUTE_UNUSED
,
1836 bfd_sym_constant_pool_entry
*entry ATTRIBUTE_UNUSED
)
1838 fprintf (f
, "[UNIMPLEMENTED]");
1842 bfd_sym_display_name_table_entry (bfd
*abfd
,
1844 unsigned char *entry
)
1846 unsigned long sym_index
;
1847 unsigned long offset
;
1848 bfd_sym_data_struct
*sdata
= NULL
;
1850 BFD_ASSERT (bfd_sym_valid (abfd
));
1851 sdata
= abfd
->tdata
.sym_data
;
1852 sym_index
= (entry
- sdata
->name_table
) / 2;
1854 if (sdata
->version
>= BFD_SYM_VERSION_3_4
&& entry
[0] == 255 && entry
[1] == 0)
1856 unsigned short length
= bfd_getb16 (entry
+ 2);
1857 fprintf (f
, "[%8lu] \"%.*s\"\n", sym_index
, length
, entry
+ 4);
1858 offset
= 2 + length
+ 1;
1862 if (! (entry
[0] == 0 || (entry
[0] == 1 && entry
[1] == '\0')))
1863 fprintf (f
, "[%8lu] \"%.*s\"\n", sym_index
, entry
[0], entry
+ 1);
1865 if (sdata
->version
>= BFD_SYM_VERSION_3_4
)
1866 offset
= entry
[0] + 2;
1868 offset
= entry
[0] + 1;
1871 return (entry
+ offset
+ (offset
% 2));
1875 bfd_sym_display_name_table (bfd
*abfd
, FILE *f
)
1877 unsigned long name_table_len
;
1878 unsigned char *name_table
, *name_table_end
, *cur
;
1879 bfd_sym_data_struct
*sdata
= NULL
;
1881 BFD_ASSERT (bfd_sym_valid (abfd
));
1882 sdata
= abfd
->tdata
.sym_data
;
1884 name_table_len
= sdata
->header
.dshb_nte
.dti_page_count
* sdata
->header
.dshb_page_size
;
1885 name_table
= sdata
->name_table
;
1886 name_table_end
= name_table
+ name_table_len
;
1888 fprintf (f
, "name table (NTE) contains %lu bytes:\n\n", name_table_len
);
1893 cur
= bfd_sym_display_name_table_entry (abfd
, f
, cur
);
1894 if (cur
>= name_table_end
)
1900 bfd_sym_display_resources_table (bfd
*abfd
, FILE *f
)
1903 bfd_sym_resources_table_entry entry
;
1904 bfd_sym_data_struct
*sdata
= NULL
;
1906 BFD_ASSERT (bfd_sym_valid (abfd
));
1907 sdata
= abfd
->tdata
.sym_data
;
1909 fprintf (f
, "resource table (RTE) contains %lu objects:\n\n",
1910 sdata
->header
.dshb_rte
.dti_object_count
);
1912 for (i
= 1; i
<= sdata
->header
.dshb_rte
.dti_object_count
; i
++)
1914 if (bfd_sym_fetch_resources_table_entry (abfd
, &entry
, i
) < 0)
1915 fprintf (f
, " [%8lu] [INVALID]\n", i
);
1918 fprintf (f
, " [%8lu] ", i
);
1919 bfd_sym_print_resources_table_entry (abfd
, f
, &entry
);
1926 bfd_sym_display_modules_table (bfd
*abfd
, FILE *f
)
1929 bfd_sym_modules_table_entry entry
;
1930 bfd_sym_data_struct
*sdata
= NULL
;
1932 BFD_ASSERT (bfd_sym_valid (abfd
));
1933 sdata
= abfd
->tdata
.sym_data
;
1935 fprintf (f
, "module table (MTE) contains %lu objects:\n\n",
1936 sdata
->header
.dshb_mte
.dti_object_count
);
1938 for (i
= 1; i
<= sdata
->header
.dshb_mte
.dti_object_count
; i
++)
1940 if (bfd_sym_fetch_modules_table_entry (abfd
, &entry
, i
) < 0)
1941 fprintf (f
, " [%8lu] [INVALID]\n", i
);
1944 fprintf (f
, " [%8lu] ", i
);
1945 bfd_sym_print_modules_table_entry (abfd
, f
, &entry
);
1952 bfd_sym_display_file_references_table (bfd
*abfd
, FILE *f
)
1955 bfd_sym_file_references_table_entry entry
;
1956 bfd_sym_data_struct
*sdata
= NULL
;
1958 BFD_ASSERT (bfd_sym_valid (abfd
));
1959 sdata
= abfd
->tdata
.sym_data
;
1961 fprintf (f
, "file reference table (FRTE) contains %lu objects:\n\n",
1962 sdata
->header
.dshb_frte
.dti_object_count
);
1964 for (i
= 1; i
<= sdata
->header
.dshb_frte
.dti_object_count
; i
++)
1966 if (bfd_sym_fetch_file_references_table_entry (abfd
, &entry
, i
) < 0)
1967 fprintf (f
, " [%8lu] [INVALID]\n", i
);
1970 fprintf (f
, " [%8lu] ", i
);
1971 bfd_sym_print_file_references_table_entry (abfd
, f
, &entry
);
1978 bfd_sym_display_contained_modules_table (bfd
*abfd
, FILE *f
)
1981 bfd_sym_contained_modules_table_entry entry
;
1982 bfd_sym_data_struct
*sdata
= NULL
;
1984 BFD_ASSERT (bfd_sym_valid (abfd
));
1985 sdata
= abfd
->tdata
.sym_data
;
1987 fprintf (f
, "contained modules table (CMTE) contains %lu objects:\n\n",
1988 sdata
->header
.dshb_cmte
.dti_object_count
);
1990 for (i
= 1; i
<= sdata
->header
.dshb_cmte
.dti_object_count
; i
++)
1992 if (bfd_sym_fetch_contained_modules_table_entry (abfd
, &entry
, i
) < 0)
1993 fprintf (f
, " [%8lu] [INVALID]\n", i
);
1996 fprintf (f
, " [%8lu] ", i
);
1997 bfd_sym_print_contained_modules_table_entry (abfd
, f
, &entry
);
2004 bfd_sym_display_contained_variables_table (bfd
*abfd
, FILE *f
)
2007 bfd_sym_contained_variables_table_entry entry
;
2008 bfd_sym_data_struct
*sdata
= NULL
;
2010 BFD_ASSERT (bfd_sym_valid (abfd
));
2011 sdata
= abfd
->tdata
.sym_data
;
2013 fprintf (f
, "contained variables table (CVTE) contains %lu objects:\n\n",
2014 sdata
->header
.dshb_cvte
.dti_object_count
);
2016 for (i
= 1; i
<= sdata
->header
.dshb_cvte
.dti_object_count
; i
++)
2018 if (bfd_sym_fetch_contained_variables_table_entry (abfd
, &entry
, i
) < 0)
2019 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2022 fprintf (f
, " [%8lu] ", i
);
2023 bfd_sym_print_contained_variables_table_entry (abfd
, f
, &entry
);
2032 bfd_sym_display_contained_statements_table (bfd
*abfd
, FILE *f
)
2035 bfd_sym_contained_statements_table_entry entry
;
2036 bfd_sym_data_struct
*sdata
= NULL
;
2038 BFD_ASSERT (bfd_sym_valid (abfd
));
2039 sdata
= abfd
->tdata
.sym_data
;
2041 fprintf (f
, "contained statements table (CSNTE) contains %lu objects:\n\n",
2042 sdata
->header
.dshb_csnte
.dti_object_count
);
2044 for (i
= 1; i
<= sdata
->header
.dshb_csnte
.dti_object_count
; i
++)
2046 if (bfd_sym_fetch_contained_statements_table_entry (abfd
, &entry
, i
) < 0)
2047 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2050 fprintf (f
, " [%8lu] ", i
);
2051 bfd_sym_print_contained_statements_table_entry (abfd
, f
, &entry
);
2058 bfd_sym_display_contained_labels_table (bfd
*abfd
, FILE *f
)
2061 bfd_sym_contained_labels_table_entry entry
;
2062 bfd_sym_data_struct
*sdata
= NULL
;
2064 BFD_ASSERT (bfd_sym_valid (abfd
));
2065 sdata
= abfd
->tdata
.sym_data
;
2067 fprintf (f
, "contained labels table (CLTE) contains %lu objects:\n\n",
2068 sdata
->header
.dshb_clte
.dti_object_count
);
2070 for (i
= 1; i
<= sdata
->header
.dshb_clte
.dti_object_count
; i
++)
2072 if (bfd_sym_fetch_contained_labels_table_entry (abfd
, &entry
, i
) < 0)
2073 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2076 fprintf (f
, " [%8lu] ", i
);
2077 bfd_sym_print_contained_labels_table_entry (abfd
, f
, &entry
);
2084 bfd_sym_display_contained_types_table (bfd
*abfd
, FILE *f
)
2087 bfd_sym_contained_types_table_entry entry
;
2088 bfd_sym_data_struct
*sdata
= NULL
;
2090 BFD_ASSERT (bfd_sym_valid (abfd
));
2091 sdata
= abfd
->tdata
.sym_data
;
2093 fprintf (f
, "contained types table (CTTE) contains %lu objects:\n\n",
2094 sdata
->header
.dshb_ctte
.dti_object_count
);
2096 for (i
= 1; i
<= sdata
->header
.dshb_ctte
.dti_object_count
; i
++)
2098 if (bfd_sym_fetch_contained_types_table_entry (abfd
, &entry
, i
) < 0)
2099 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2102 fprintf (f
, " [%8lu] ", i
);
2103 bfd_sym_print_contained_types_table_entry (abfd
, f
, &entry
);
2110 bfd_sym_display_file_references_index_table (bfd
*abfd
, FILE *f
)
2113 bfd_sym_file_references_index_table_entry entry
;
2114 bfd_sym_data_struct
*sdata
= NULL
;
2116 BFD_ASSERT (bfd_sym_valid (abfd
));
2117 sdata
= abfd
->tdata
.sym_data
;
2119 fprintf (f
, "file references index table (FITE) contains %lu objects:\n\n",
2120 sdata
->header
.dshb_fite
.dti_object_count
);
2122 for (i
= 1; i
<= sdata
->header
.dshb_fite
.dti_object_count
; i
++)
2124 if (bfd_sym_fetch_file_references_index_table_entry (abfd
, &entry
, i
) < 0)
2125 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2128 fprintf (f
, " [%8lu] ", i
);
2129 bfd_sym_print_file_references_index_table_entry (abfd
, f
, &entry
);
2136 bfd_sym_display_constant_pool (bfd
*abfd
, FILE *f
)
2139 bfd_sym_constant_pool_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
, "constant pool (CONST) contains %lu objects:\n\n",
2146 sdata
->header
.dshb_const
.dti_object_count
);
2148 for (i
= 1; i
<= sdata
->header
.dshb_const
.dti_object_count
; i
++)
2150 if (bfd_sym_fetch_constant_pool_entry (abfd
, &entry
, i
) < 0)
2151 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2154 fprintf (f
, " [%8lu] ", i
);
2155 bfd_sym_print_constant_pool_entry (abfd
, f
, &entry
);
2162 bfd_sym_display_type_information_table (bfd
*abfd
, FILE *f
)
2165 bfd_sym_type_table_entry sym_index
;
2166 bfd_sym_type_information_table_entry entry
;
2167 bfd_sym_data_struct
*sdata
= NULL
;
2169 BFD_ASSERT (bfd_sym_valid (abfd
));
2170 sdata
= abfd
->tdata
.sym_data
;
2172 if (sdata
->header
.dshb_tte
.dti_object_count
> 99)
2173 fprintf (f
, "type table (TINFO) contains %lu objects:\n\n",
2174 sdata
->header
.dshb_tte
.dti_object_count
- 99);
2177 fprintf (f
, "type table (TINFO) contains [INVALID] objects:\n\n");
2181 for (i
= 100; i
<= sdata
->header
.dshb_tte
.dti_object_count
; i
++)
2183 if (bfd_sym_fetch_type_table_entry (abfd
, &sym_index
, i
- 100) < 0)
2184 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2187 fprintf (f
, " [%8lu] (TINFO %lu) ", i
, sym_index
);
2189 if (bfd_sym_fetch_type_information_table_entry (abfd
, &entry
, sym_index
) < 0)
2190 fprintf (f
, "[INVALID]");
2192 bfd_sym_print_type_information_table_entry (abfd
, f
, &entry
);
2200 bfd_sym_scan (bfd
*abfd
, bfd_sym_version version
, bfd_sym_data_struct
*mdata
)
2203 const char *name
= "symbols";
2205 mdata
->name_table
= 0;
2207 mdata
->version
= version
;
2209 if (bfd_seek (abfd
, 0, SEEK_SET
) != 0
2210 || bfd_sym_read_header (abfd
, &mdata
->header
, mdata
->version
) != 0)
2213 mdata
->name_table
= bfd_sym_read_name_table (abfd
, &mdata
->header
);
2214 if (mdata
->name_table
== NULL
)
2217 bfdsec
= bfd_make_section_anyway_with_flags (abfd
, name
, SEC_HAS_CONTENTS
);
2224 bfdsec
->filepos
= 0;
2225 bfdsec
->alignment_power
= 0;
2227 abfd
->tdata
.sym_data
= mdata
;
2233 bfd_sym_object_p (bfd
*abfd
)
2235 bfd_sym_version version
= -1;
2236 bfd_sym_data_struct
*mdata
;
2238 if (bfd_seek (abfd
, 0, SEEK_SET
) != 0
2239 || bfd_sym_read_version (abfd
, &version
) != 0)
2242 mdata
= (bfd_sym_data_struct
*) bfd_alloc (abfd
, sizeof (*mdata
));
2246 if (bfd_sym_scan (abfd
, version
, mdata
) != 0)
2249 return _bfd_no_cleanup
;
2252 bfd_set_error (bfd_error_wrong_format
);
2258 #define bfd_sym_make_empty_symbol _bfd_generic_make_empty_symbol
2261 bfd_sym_get_symbol_info (bfd
*abfd ATTRIBUTE_UNUSED
, asymbol
*symbol
, symbol_info
*ret
)
2263 bfd_symbol_info (symbol
, ret
);
2267 bfd_sym_get_symtab_upper_bound (bfd
*abfd ATTRIBUTE_UNUSED
)
2273 bfd_sym_canonicalize_symtab (bfd
*abfd ATTRIBUTE_UNUSED
, asymbol
**sym ATTRIBUTE_UNUSED
)
2279 bfd_sym_sizeof_headers (bfd
*abfd ATTRIBUTE_UNUSED
,
2280 struct bfd_link_info
*info ATTRIBUTE_UNUSED
)
2285 const bfd_target sym_vec
=
2288 bfd_target_sym_flavour
, /* Flavour. */
2289 BFD_ENDIAN_BIG
, /* Byteorder. */
2290 BFD_ENDIAN_BIG
, /* Header byteorder. */
2291 (HAS_RELOC
| EXEC_P
| /* Object flags. */
2292 HAS_LINENO
| HAS_DEBUG
|
2293 HAS_SYMS
| HAS_LOCALS
| DYNAMIC
| WP_TEXT
| D_PAGED
),
2294 (SEC_ALLOC
| SEC_LOAD
| SEC_READONLY
| SEC_CODE
| SEC_DATA
2295 | SEC_ROM
| SEC_HAS_CONTENTS
), /* Section_flags. */
2296 0, /* Symbol_leading_char. */
2297 ' ', /* AR_pad_char. */
2298 16, /* AR_max_namelen. */
2299 0, /* match priority. */
2300 TARGET_KEEP_UNUSED_SECTION_SYMBOLS
, /* keep unused section symbols. */
2301 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2302 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2303 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* Data. */
2304 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2305 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2306 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* Hdrs. */
2307 { /* bfd_check_format. */
2309 bfd_sym_object_p
, /* bfd_check_format. */
2313 { /* bfd_set_format. */
2314 _bfd_bool_bfd_false_error
,
2316 _bfd_bool_bfd_false_error
,
2317 _bfd_bool_bfd_false_error
,
2319 { /* bfd_write_contents. */
2320 _bfd_bool_bfd_false_error
,
2322 _bfd_bool_bfd_false_error
,
2323 _bfd_bool_bfd_false_error
,
2326 BFD_JUMP_TABLE_GENERIC (bfd_sym
),
2327 BFD_JUMP_TABLE_COPY (_bfd_generic
),
2328 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
2329 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive
),
2330 BFD_JUMP_TABLE_SYMBOLS (bfd_sym
),
2331 BFD_JUMP_TABLE_RELOCS (_bfd_norelocs
),
2332 BFD_JUMP_TABLE_WRITE (bfd_sym
),
2333 BFD_JUMP_TABLE_LINK (bfd_sym
),
2334 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),