1 /* xSYM symbol-file support for BFD.
2 Copyright (C) 1999-2019 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. */
24 #include "alloca-conf.h"
29 #define bfd_sym_close_and_cleanup _bfd_generic_close_and_cleanup
30 #define bfd_sym_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
31 #define bfd_sym_new_section_hook _bfd_generic_new_section_hook
32 #define bfd_sym_bfd_is_local_label_name bfd_generic_is_local_label_name
33 #define bfd_sym_bfd_is_target_special_symbol _bfd_bool_bfd_asymbol_false
34 #define bfd_sym_get_lineno _bfd_nosymbols_get_lineno
35 #define bfd_sym_find_nearest_line _bfd_nosymbols_find_nearest_line
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_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
65 #define bfd_sym_bfd_link_check_relocs _bfd_generic_link_check_relocs
67 extern const bfd_target sym_vec
;
70 pstrcmp (const char *as
, const char *bs
)
72 const unsigned char *a
= (const unsigned char *) as
;
73 const unsigned char *b
= (const unsigned char *) bs
;
77 clen
= (a
[0] > b
[0]) ? b
[0] : a
[0];
78 ret
= memcmp (a
+ 1, b
+ 1, clen
);
91 compute_offset (unsigned long first_page
,
92 unsigned long page_size
,
93 unsigned long entry_size
,
94 unsigned long sym_index
)
96 unsigned long entries_per_page
= page_size
/ entry_size
;
97 unsigned long page_number
= first_page
+ (sym_index
/ entries_per_page
);
98 unsigned long page_offset
= (sym_index
% entries_per_page
) * entry_size
;
100 return (page_number
* page_size
) + page_offset
;
104 bfd_sym_mkobject (bfd
*abfd ATTRIBUTE_UNUSED
)
110 bfd_sym_print_symbol (bfd
*abfd ATTRIBUTE_UNUSED
,
111 void * afile ATTRIBUTE_UNUSED
,
112 asymbol
*symbol ATTRIBUTE_UNUSED
,
113 bfd_print_symbol_type how ATTRIBUTE_UNUSED
)
119 bfd_sym_valid (bfd
*abfd
)
121 if (abfd
== NULL
|| abfd
->xvec
== NULL
)
124 return abfd
->xvec
== &sym_vec
;
128 bfd_sym_read_name_table (bfd
*abfd
, bfd_sym_header_block
*dshb
)
132 size_t table_size
= dshb
->dshb_nte
.dti_page_count
* dshb
->dshb_page_size
;
133 size_t table_offset
= dshb
->dshb_nte
.dti_first_page
* dshb
->dshb_page_size
;
135 rstr
= bfd_alloc (abfd
, table_size
);
139 bfd_seek (abfd
, table_offset
, SEEK_SET
);
140 ret
= bfd_bread (rstr
, table_size
, abfd
);
141 if (ret
< 0 || (unsigned long) ret
!= table_size
)
143 bfd_release (abfd
, rstr
);
151 bfd_sym_parse_file_reference_v32 (unsigned char *buf
,
153 bfd_sym_file_reference
*entry
)
155 BFD_ASSERT (len
== 6);
157 entry
->fref_frte_index
= bfd_getb16 (buf
);
158 entry
->fref_offset
= bfd_getb32 (buf
+ 2);
162 bfd_sym_parse_disk_table_v32 (unsigned char *buf
,
164 bfd_sym_table_info
*table
)
166 BFD_ASSERT (len
== 8);
168 table
->dti_first_page
= bfd_getb16 (buf
);
169 table
->dti_page_count
= bfd_getb16 (buf
+ 2);
170 table
->dti_object_count
= bfd_getb32 (buf
+ 4);
174 bfd_sym_parse_header_v32 (unsigned char *buf
,
176 bfd_sym_header_block
*header
)
178 BFD_ASSERT (len
== 154);
180 memcpy (header
->dshb_id
, buf
, 32);
181 header
->dshb_page_size
= bfd_getb16 (buf
+ 32);
182 header
->dshb_hash_page
= bfd_getb16 (buf
+ 34);
183 header
->dshb_root_mte
= bfd_getb16 (buf
+ 36);
184 header
->dshb_mod_date
= bfd_getb32 (buf
+ 38);
186 bfd_sym_parse_disk_table_v32 (buf
+ 42, 8, &header
->dshb_frte
);
187 bfd_sym_parse_disk_table_v32 (buf
+ 50, 8, &header
->dshb_rte
);
188 bfd_sym_parse_disk_table_v32 (buf
+ 58, 8, &header
->dshb_mte
);
189 bfd_sym_parse_disk_table_v32 (buf
+ 66, 8, &header
->dshb_cmte
);
190 bfd_sym_parse_disk_table_v32 (buf
+ 74, 8, &header
->dshb_cvte
);
191 bfd_sym_parse_disk_table_v32 (buf
+ 82, 8, &header
->dshb_csnte
);
192 bfd_sym_parse_disk_table_v32 (buf
+ 90, 8, &header
->dshb_clte
);
193 bfd_sym_parse_disk_table_v32 (buf
+ 98, 8, &header
->dshb_ctte
);
194 bfd_sym_parse_disk_table_v32 (buf
+ 106, 8, &header
->dshb_tte
);
195 bfd_sym_parse_disk_table_v32 (buf
+ 114, 8, &header
->dshb_nte
);
196 bfd_sym_parse_disk_table_v32 (buf
+ 122, 8, &header
->dshb_tinfo
);
197 bfd_sym_parse_disk_table_v32 (buf
+ 130, 8, &header
->dshb_fite
);
198 bfd_sym_parse_disk_table_v32 (buf
+ 138, 8, &header
->dshb_const
);
200 memcpy (&header
->dshb_file_creator
, buf
+ 146, 4);
201 memcpy (&header
->dshb_file_type
, buf
+ 150, 4);
205 bfd_sym_read_header_v32 (bfd
*abfd
, bfd_sym_header_block
*header
)
207 unsigned char buf
[154];
210 ret
= bfd_bread (buf
, 154, abfd
);
214 bfd_sym_parse_header_v32 (buf
, 154, header
);
220 bfd_sym_read_header_v34 (bfd
*abfd ATTRIBUTE_UNUSED
,
221 bfd_sym_header_block
*header ATTRIBUTE_UNUSED
)
227 bfd_sym_read_header (bfd
*abfd
,
228 bfd_sym_header_block
*header
,
229 bfd_sym_version version
)
233 case BFD_SYM_VERSION_3_5
:
234 case BFD_SYM_VERSION_3_4
:
235 return bfd_sym_read_header_v34 (abfd
, header
);
236 case BFD_SYM_VERSION_3_3
:
237 case BFD_SYM_VERSION_3_2
:
238 return bfd_sym_read_header_v32 (abfd
, header
);
239 case BFD_SYM_VERSION_3_1
:
246 bfd_sym_read_version (bfd
*abfd
, bfd_sym_version
*version
)
248 char version_string
[32];
251 ret
= bfd_bread (version_string
, sizeof (version_string
), abfd
);
252 if (ret
!= sizeof (version_string
))
255 if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_1
) == 0)
256 *version
= BFD_SYM_VERSION_3_1
;
257 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_2
) == 0)
258 *version
= BFD_SYM_VERSION_3_2
;
259 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_3
) == 0)
260 *version
= BFD_SYM_VERSION_3_3
;
261 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_4
) == 0)
262 *version
= BFD_SYM_VERSION_3_4
;
263 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_5
) == 0)
264 *version
= BFD_SYM_VERSION_3_5
;
272 bfd_sym_display_table_summary (FILE *f
,
273 bfd_sym_table_info
*dti
,
276 fprintf (f
, "%-6s %13ld %13ld %13ld\n",
280 dti
->dti_object_count
);
284 bfd_sym_display_header (FILE *f
, bfd_sym_header_block
*dshb
)
286 fprintf (f
, " Version: %.*s\n", dshb
->dshb_id
[0], dshb
->dshb_id
+ 1);
287 fprintf (f
, " Page Size: 0x%x\n", dshb
->dshb_page_size
);
288 fprintf (f
, " Hash Page: %lu\n", dshb
->dshb_hash_page
);
289 fprintf (f
, " Root MTE: %lu\n", dshb
->dshb_root_mte
);
290 fprintf (f
, " Modification Date: ");
291 fprintf (f
, "[unimplemented]");
292 fprintf (f
, " (0x%lx)\n", dshb
->dshb_mod_date
);
294 fprintf (f
, " File Creator: %.4s Type: %.4s\n\n",
295 dshb
->dshb_file_creator
, dshb
->dshb_file_type
);
297 fprintf (f
, "Table Name First Page Page Count Object Count\n");
298 fprintf (f
, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
300 bfd_sym_display_table_summary (f
, &dshb
->dshb_nte
, "NTE");
301 bfd_sym_display_table_summary (f
, &dshb
->dshb_rte
, "RTE");
302 bfd_sym_display_table_summary (f
, &dshb
->dshb_mte
, "MTE");
303 bfd_sym_display_table_summary (f
, &dshb
->dshb_frte
, "FRTE");
304 bfd_sym_display_table_summary (f
, &dshb
->dshb_cmte
, "CMTE");
305 bfd_sym_display_table_summary (f
, &dshb
->dshb_cvte
, "CVTE");
306 bfd_sym_display_table_summary (f
, &dshb
->dshb_csnte
, "CSNTE");
307 bfd_sym_display_table_summary (f
, &dshb
->dshb_clte
, "CLTE");
308 bfd_sym_display_table_summary (f
, &dshb
->dshb_ctte
, "CTTE");
309 bfd_sym_display_table_summary (f
, &dshb
->dshb_tte
, "TTE");
310 bfd_sym_display_table_summary (f
, &dshb
->dshb_tinfo
, "TINFO");
311 bfd_sym_display_table_summary (f
, &dshb
->dshb_fite
, "FITE");
312 bfd_sym_display_table_summary (f
, &dshb
->dshb_const
, "CONST");
318 bfd_sym_parse_resources_table_entry_v32 (unsigned char *buf
,
320 bfd_sym_resources_table_entry
*entry
)
322 BFD_ASSERT (len
== 18);
324 memcpy (&entry
->rte_res_type
, buf
, 4);
325 entry
->rte_res_number
= bfd_getb16 (buf
+ 4);
326 entry
->rte_nte_index
= bfd_getb32 (buf
+ 6);
327 entry
->rte_mte_first
= bfd_getb16 (buf
+ 10);
328 entry
->rte_mte_last
= bfd_getb16 (buf
+ 12);
329 entry
->rte_res_size
= bfd_getb32 (buf
+ 14);
333 bfd_sym_parse_modules_table_entry_v33 (unsigned char *buf
,
335 bfd_sym_modules_table_entry
*entry
)
337 BFD_ASSERT (len
== 46);
339 entry
->mte_rte_index
= bfd_getb16 (buf
);
340 entry
->mte_res_offset
= bfd_getb32 (buf
+ 2);
341 entry
->mte_size
= bfd_getb32 (buf
+ 6);
342 entry
->mte_kind
= buf
[10];
343 entry
->mte_scope
= buf
[11];
344 entry
->mte_parent
= bfd_getb16 (buf
+ 12);
345 bfd_sym_parse_file_reference_v32 (buf
+ 14, 6, &entry
->mte_imp_fref
);
346 entry
->mte_imp_end
= bfd_getb32 (buf
+ 20);
347 entry
->mte_nte_index
= bfd_getb32 (buf
+ 24);
348 entry
->mte_cmte_index
= bfd_getb16 (buf
+ 28);
349 entry
->mte_cvte_index
= bfd_getb32 (buf
+ 30);
350 entry
->mte_clte_index
= bfd_getb16 (buf
+ 34);
351 entry
->mte_ctte_index
= bfd_getb16 (buf
+ 36);
352 entry
->mte_csnte_idx_1
= bfd_getb32 (buf
+ 38);
353 entry
->mte_csnte_idx_2
= bfd_getb32 (buf
+ 42);
357 bfd_sym_parse_file_references_table_entry_v32 (unsigned char *buf
,
359 bfd_sym_file_references_table_entry
*entry
)
363 BFD_ASSERT (len
== 10);
365 memset (entry
, 0, sizeof (bfd_sym_file_references_table_entry
));
366 type
= bfd_getb16 (buf
);
370 case BFD_SYM_END_OF_LIST_3_2
:
371 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
374 case BFD_SYM_FILE_NAME_INDEX_3_2
:
375 entry
->filename
.type
= BFD_SYM_FILE_NAME_INDEX
;
376 entry
->filename
.nte_index
= bfd_getb32 (buf
+ 2);
377 entry
->filename
.mod_date
= bfd_getb32 (buf
+ 6);
381 entry
->entry
.mte_index
= type
;
382 entry
->entry
.file_offset
= bfd_getb32 (buf
+ 2);
387 bfd_sym_parse_contained_modules_table_entry_v32 (unsigned char *buf
,
389 bfd_sym_contained_modules_table_entry
*entry
)
393 BFD_ASSERT (len
== 6);
395 memset (entry
, 0, sizeof (bfd_sym_contained_modules_table_entry
));
396 type
= bfd_getb16 (buf
);
400 case BFD_SYM_END_OF_LIST_3_2
:
401 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
405 entry
->entry
.mte_index
= type
;
406 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 2);
412 bfd_sym_parse_contained_variables_table_entry_v32 (unsigned char *buf
,
414 bfd_sym_contained_variables_table_entry
*entry
)
418 BFD_ASSERT (len
== 26);
420 memset (entry
, 0, sizeof (bfd_sym_contained_variables_table_entry
));
421 type
= bfd_getb16 (buf
);
425 case BFD_SYM_END_OF_LIST_3_2
:
426 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
429 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
430 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
431 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
435 entry
->entry
.tte_index
= type
;
436 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 2);
437 entry
->entry
.file_delta
= bfd_getb16 (buf
+ 6);
438 entry
->entry
.scope
= buf
[8];
439 entry
->entry
.la_size
= buf
[9];
441 if (entry
->entry
.la_size
== BFD_SYM_CVTE_SCA
)
443 entry
->entry
.address
.scstruct
.sca_kind
= buf
[10];
444 entry
->entry
.address
.scstruct
.sca_class
= buf
[11];
445 entry
->entry
.address
.scstruct
.sca_offset
= bfd_getb32 (buf
+ 12);
447 else if (entry
->entry
.la_size
<= BFD_SYM_CVTE_SCA
)
449 #if BFD_SYM_CVTE_SCA > 0
450 memcpy (&entry
->entry
.address
.lastruct
.la
, buf
+ 10,
453 entry
->entry
.address
.lastruct
.la_kind
= buf
[23];
455 else if (entry
->entry
.la_size
== BFD_SYM_CVTE_BIG_LA
)
457 entry
->entry
.address
.biglastruct
.big_la
= bfd_getb32 (buf
+ 10);
458 entry
->entry
.address
.biglastruct
.big_la_kind
= buf
[12];
464 bfd_sym_parse_contained_statements_table_entry_v32 (unsigned char *buf
,
466 bfd_sym_contained_statements_table_entry
*entry
)
470 BFD_ASSERT (len
== 8);
472 memset (entry
, 0, sizeof (bfd_sym_contained_statements_table_entry
));
473 type
= bfd_getb16 (buf
);
477 case BFD_SYM_END_OF_LIST_3_2
:
478 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
481 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
482 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
483 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
487 entry
->entry
.mte_index
= type
;
488 entry
->entry
.mte_offset
= bfd_getb16 (buf
+ 2);
489 entry
->entry
.file_delta
= bfd_getb32 (buf
+ 4);
495 bfd_sym_parse_contained_labels_table_entry_v32 (unsigned char *buf
,
497 bfd_sym_contained_labels_table_entry
*entry
)
501 BFD_ASSERT (len
== 12);
503 memset (entry
, 0, sizeof (bfd_sym_contained_labels_table_entry
));
504 type
= bfd_getb16 (buf
);
508 case BFD_SYM_END_OF_LIST_3_2
:
509 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
512 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
513 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
514 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
518 entry
->entry
.mte_index
= type
;
519 entry
->entry
.mte_offset
= bfd_getb16 (buf
+ 2);
520 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 4);
521 entry
->entry
.file_delta
= bfd_getb16 (buf
+ 8);
522 entry
->entry
.scope
= bfd_getb16 (buf
+ 10);
528 bfd_sym_parse_type_table_entry_v32 (unsigned char *buf
,
530 bfd_sym_type_table_entry
*entry
)
532 BFD_ASSERT (len
== 4);
534 *entry
= bfd_getb32 (buf
);
538 bfd_sym_fetch_resources_table_entry (bfd
*abfd
,
539 bfd_sym_resources_table_entry
*entry
,
540 unsigned long sym_index
)
542 void (*parser
) (unsigned char *, size_t, bfd_sym_resources_table_entry
*);
543 unsigned long offset
;
544 unsigned long entry_size
;
545 unsigned char buf
[18];
546 bfd_sym_data_struct
*sdata
= NULL
;
549 BFD_ASSERT (bfd_sym_valid (abfd
));
550 sdata
= abfd
->tdata
.sym_data
;
555 switch (sdata
->version
)
557 case BFD_SYM_VERSION_3_5
:
558 case BFD_SYM_VERSION_3_4
:
561 case BFD_SYM_VERSION_3_3
:
562 case BFD_SYM_VERSION_3_2
:
564 parser
= bfd_sym_parse_resources_table_entry_v32
;
567 case BFD_SYM_VERSION_3_1
:
574 offset
= compute_offset (sdata
->header
.dshb_rte
.dti_first_page
,
575 sdata
->header
.dshb_page_size
,
576 entry_size
, sym_index
);
578 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
580 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
583 (*parser
) (buf
, entry_size
, entry
);
589 bfd_sym_fetch_modules_table_entry (bfd
*abfd
,
590 bfd_sym_modules_table_entry
*entry
,
591 unsigned long sym_index
)
593 void (*parser
) (unsigned char *, size_t, bfd_sym_modules_table_entry
*);
594 unsigned long offset
;
595 unsigned long entry_size
;
596 unsigned char buf
[46];
597 bfd_sym_data_struct
*sdata
= NULL
;
600 BFD_ASSERT (bfd_sym_valid (abfd
));
601 sdata
= abfd
->tdata
.sym_data
;
606 switch (sdata
->version
)
608 case BFD_SYM_VERSION_3_5
:
609 case BFD_SYM_VERSION_3_4
:
612 case BFD_SYM_VERSION_3_3
:
614 parser
= bfd_sym_parse_modules_table_entry_v33
;
617 case BFD_SYM_VERSION_3_2
:
618 case BFD_SYM_VERSION_3_1
:
625 offset
= compute_offset (sdata
->header
.dshb_mte
.dti_first_page
,
626 sdata
->header
.dshb_page_size
,
627 entry_size
, sym_index
);
629 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
631 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
634 (*parser
) (buf
, entry_size
, entry
);
640 bfd_sym_fetch_file_references_table_entry (bfd
*abfd
,
641 bfd_sym_file_references_table_entry
*entry
,
642 unsigned long sym_index
)
644 void (*parser
) (unsigned char *, size_t, bfd_sym_file_references_table_entry
*);
645 unsigned long offset
;
646 unsigned long entry_size
= 0;
647 unsigned char buf
[8];
648 bfd_sym_data_struct
*sdata
= NULL
;
651 BFD_ASSERT (bfd_sym_valid (abfd
));
652 sdata
= abfd
->tdata
.sym_data
;
657 switch (sdata
->version
)
659 case BFD_SYM_VERSION_3_3
:
660 case BFD_SYM_VERSION_3_2
:
662 parser
= bfd_sym_parse_file_references_table_entry_v32
;
665 case BFD_SYM_VERSION_3_5
:
666 case BFD_SYM_VERSION_3_4
:
667 case BFD_SYM_VERSION_3_1
:
675 offset
= compute_offset (sdata
->header
.dshb_frte
.dti_first_page
,
676 sdata
->header
.dshb_page_size
,
677 entry_size
, sym_index
);
679 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
681 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
684 (*parser
) (buf
, entry_size
, entry
);
690 bfd_sym_fetch_contained_modules_table_entry (bfd
*abfd
,
691 bfd_sym_contained_modules_table_entry
*entry
,
692 unsigned long sym_index
)
694 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_modules_table_entry
*);
695 unsigned long offset
;
696 unsigned long entry_size
= 0;
697 unsigned char buf
[6];
698 bfd_sym_data_struct
*sdata
= NULL
;
701 BFD_ASSERT (bfd_sym_valid (abfd
));
702 sdata
= abfd
->tdata
.sym_data
;
707 switch (sdata
->version
)
709 case BFD_SYM_VERSION_3_3
:
710 case BFD_SYM_VERSION_3_2
:
712 parser
= bfd_sym_parse_contained_modules_table_entry_v32
;
715 case BFD_SYM_VERSION_3_5
:
716 case BFD_SYM_VERSION_3_4
:
717 case BFD_SYM_VERSION_3_1
:
725 offset
= compute_offset (sdata
->header
.dshb_cmte
.dti_first_page
,
726 sdata
->header
.dshb_page_size
,
727 entry_size
, sym_index
);
729 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
731 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
734 (*parser
) (buf
, entry_size
, entry
);
740 bfd_sym_fetch_contained_variables_table_entry (bfd
*abfd
,
741 bfd_sym_contained_variables_table_entry
*entry
,
742 unsigned long sym_index
)
744 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_variables_table_entry
*);
745 unsigned long offset
;
746 unsigned long entry_size
= 0;
747 unsigned char buf
[26];
748 bfd_sym_data_struct
*sdata
= NULL
;
751 BFD_ASSERT (bfd_sym_valid (abfd
));
752 sdata
= abfd
->tdata
.sym_data
;
757 switch (sdata
->version
)
759 case BFD_SYM_VERSION_3_3
:
760 case BFD_SYM_VERSION_3_2
:
762 parser
= bfd_sym_parse_contained_variables_table_entry_v32
;
765 case BFD_SYM_VERSION_3_5
:
766 case BFD_SYM_VERSION_3_4
:
767 case BFD_SYM_VERSION_3_1
:
775 offset
= compute_offset (sdata
->header
.dshb_cvte
.dti_first_page
,
776 sdata
->header
.dshb_page_size
,
777 entry_size
, sym_index
);
779 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
781 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
784 (*parser
) (buf
, entry_size
, entry
);
790 bfd_sym_fetch_contained_statements_table_entry (bfd
*abfd
,
791 bfd_sym_contained_statements_table_entry
*entry
,
792 unsigned long sym_index
)
794 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_statements_table_entry
*);
795 unsigned long offset
;
796 unsigned long entry_size
= 0;
797 unsigned char buf
[8];
798 bfd_sym_data_struct
*sdata
= NULL
;
801 BFD_ASSERT (bfd_sym_valid (abfd
));
802 sdata
= abfd
->tdata
.sym_data
;
807 switch (sdata
->version
)
809 case BFD_SYM_VERSION_3_3
:
810 case BFD_SYM_VERSION_3_2
:
812 parser
= bfd_sym_parse_contained_statements_table_entry_v32
;
815 case BFD_SYM_VERSION_3_5
:
816 case BFD_SYM_VERSION_3_4
:
817 case BFD_SYM_VERSION_3_1
:
825 offset
= compute_offset (sdata
->header
.dshb_csnte
.dti_first_page
,
826 sdata
->header
.dshb_page_size
,
827 entry_size
, sym_index
);
829 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
831 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
834 (*parser
) (buf
, entry_size
, entry
);
840 bfd_sym_fetch_contained_labels_table_entry (bfd
*abfd
,
841 bfd_sym_contained_labels_table_entry
*entry
,
842 unsigned long sym_index
)
844 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_labels_table_entry
*);
845 unsigned long offset
;
846 unsigned long entry_size
= 0;
847 unsigned char buf
[12];
848 bfd_sym_data_struct
*sdata
= NULL
;
851 BFD_ASSERT (bfd_sym_valid (abfd
));
852 sdata
= abfd
->tdata
.sym_data
;
857 switch (sdata
->version
)
859 case BFD_SYM_VERSION_3_3
:
860 case BFD_SYM_VERSION_3_2
:
862 parser
= bfd_sym_parse_contained_labels_table_entry_v32
;
865 case BFD_SYM_VERSION_3_5
:
866 case BFD_SYM_VERSION_3_4
:
867 case BFD_SYM_VERSION_3_1
:
875 offset
= compute_offset (sdata
->header
.dshb_clte
.dti_first_page
,
876 sdata
->header
.dshb_page_size
,
877 entry_size
, sym_index
);
879 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
881 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
884 (*parser
) (buf
, entry_size
, entry
);
890 bfd_sym_fetch_contained_types_table_entry (bfd
*abfd
,
891 bfd_sym_contained_types_table_entry
*entry
,
892 unsigned long sym_index
)
894 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_types_table_entry
*);
895 unsigned long offset
;
896 unsigned long entry_size
= 0;
897 unsigned char buf
[0];
898 bfd_sym_data_struct
*sdata
= NULL
;
901 BFD_ASSERT (bfd_sym_valid (abfd
));
902 sdata
= abfd
->tdata
.sym_data
;
907 switch (sdata
->version
)
909 case BFD_SYM_VERSION_3_3
:
910 case BFD_SYM_VERSION_3_2
:
915 case BFD_SYM_VERSION_3_5
:
916 case BFD_SYM_VERSION_3_4
:
917 case BFD_SYM_VERSION_3_1
:
925 offset
= compute_offset (sdata
->header
.dshb_ctte
.dti_first_page
,
926 sdata
->header
.dshb_page_size
,
927 entry_size
, sym_index
);
929 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
931 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
934 (*parser
) (buf
, entry_size
, entry
);
940 bfd_sym_fetch_file_references_index_table_entry (bfd
*abfd
,
941 bfd_sym_file_references_index_table_entry
*entry
,
942 unsigned long sym_index
)
944 void (*parser
) (unsigned char *, size_t, bfd_sym_file_references_index_table_entry
*);
945 unsigned long offset
;
946 unsigned long entry_size
= 0;
947 unsigned char buf
[0];
948 bfd_sym_data_struct
*sdata
= NULL
;
951 BFD_ASSERT (bfd_sym_valid (abfd
));
952 sdata
= abfd
->tdata
.sym_data
;
957 switch (sdata
->version
)
959 case BFD_SYM_VERSION_3_3
:
960 case BFD_SYM_VERSION_3_2
:
965 case BFD_SYM_VERSION_3_5
:
966 case BFD_SYM_VERSION_3_4
:
967 case BFD_SYM_VERSION_3_1
:
975 offset
= compute_offset (sdata
->header
.dshb_fite
.dti_first_page
,
976 sdata
->header
.dshb_page_size
,
977 entry_size
, sym_index
);
979 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
981 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
984 (*parser
) (buf
, entry_size
, entry
);
990 bfd_sym_fetch_constant_pool_entry (bfd
*abfd
,
991 bfd_sym_constant_pool_entry
*entry
,
992 unsigned long sym_index
)
994 void (*parser
) (unsigned char *, size_t, bfd_sym_constant_pool_entry
*);
995 unsigned long offset
;
996 unsigned long entry_size
= 0;
997 unsigned char buf
[0];
998 bfd_sym_data_struct
*sdata
= NULL
;
1001 BFD_ASSERT (bfd_sym_valid (abfd
));
1002 sdata
= abfd
->tdata
.sym_data
;
1007 switch (sdata
->version
)
1009 case BFD_SYM_VERSION_3_3
:
1010 case BFD_SYM_VERSION_3_2
:
1015 case BFD_SYM_VERSION_3_5
:
1016 case BFD_SYM_VERSION_3_4
:
1017 case BFD_SYM_VERSION_3_1
:
1025 offset
= compute_offset (sdata
->header
.dshb_fite
.dti_first_page
,
1026 sdata
->header
.dshb_page_size
,
1027 entry_size
, sym_index
);
1029 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1031 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1034 (*parser
) (buf
, entry_size
, entry
);
1040 bfd_sym_fetch_type_table_entry (bfd
*abfd
,
1041 bfd_sym_type_table_entry
*entry
,
1042 unsigned long sym_index
)
1044 void (*parser
) (unsigned char *, size_t, bfd_sym_type_table_entry
*);
1045 unsigned long offset
;
1046 unsigned long entry_size
= 0;
1047 unsigned char buf
[4];
1048 bfd_sym_data_struct
*sdata
= NULL
;
1051 BFD_ASSERT (bfd_sym_valid (abfd
));
1052 sdata
= abfd
->tdata
.sym_data
;
1054 switch (sdata
->version
)
1056 case BFD_SYM_VERSION_3_3
:
1057 case BFD_SYM_VERSION_3_2
:
1059 parser
= bfd_sym_parse_type_table_entry_v32
;
1062 case BFD_SYM_VERSION_3_5
:
1063 case BFD_SYM_VERSION_3_4
:
1064 case BFD_SYM_VERSION_3_1
:
1072 offset
= compute_offset (sdata
->header
.dshb_tte
.dti_first_page
,
1073 sdata
->header
.dshb_page_size
,
1074 entry_size
, sym_index
);
1076 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1078 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1081 (*parser
) (buf
, entry_size
, entry
);
1087 bfd_sym_fetch_type_information_table_entry (bfd
*abfd
,
1088 bfd_sym_type_information_table_entry
*entry
,
1089 unsigned long offset
)
1091 unsigned char buf
[4];
1093 BFD_ASSERT (bfd_sym_valid (abfd
));
1098 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1101 if (bfd_bread (buf
, 4, abfd
) != 4)
1103 entry
->nte_index
= bfd_getb32 (buf
);
1105 if (bfd_bread (buf
, 2, abfd
) != 2)
1107 entry
->physical_size
= bfd_getb16 (buf
);
1109 if (entry
->physical_size
& 0x8000)
1111 if (bfd_bread (buf
, 4, abfd
) != 4)
1113 entry
->physical_size
&= 0x7fff;
1114 entry
->logical_size
= bfd_getb32 (buf
);
1115 entry
->offset
= offset
+ 10;
1119 if (bfd_bread (buf
, 2, abfd
) != 2)
1121 entry
->physical_size
&= 0x7fff;
1122 entry
->logical_size
= bfd_getb16 (buf
);
1123 entry
->offset
= offset
+ 8;
1130 bfd_sym_fetch_type_table_information (bfd
*abfd
,
1131 bfd_sym_type_information_table_entry
*entry
,
1132 unsigned long sym_index
)
1134 bfd_sym_type_table_entry tindex
;
1135 bfd_sym_data_struct
*sdata
= NULL
;
1137 BFD_ASSERT (bfd_sym_valid (abfd
));
1138 sdata
= abfd
->tdata
.sym_data
;
1140 if (sdata
->header
.dshb_tte
.dti_object_count
<= 99)
1142 if (sym_index
< 100)
1145 if (bfd_sym_fetch_type_table_entry (abfd
, &tindex
, sym_index
- 100) < 0)
1147 if (bfd_sym_fetch_type_information_table_entry (abfd
, entry
, tindex
) < 0)
1153 const unsigned char *
1154 bfd_sym_symbol_name (bfd
*abfd
, unsigned long sym_index
)
1156 bfd_sym_data_struct
*sdata
= NULL
;
1158 BFD_ASSERT (bfd_sym_valid (abfd
));
1159 sdata
= abfd
->tdata
.sym_data
;
1162 return (const unsigned char *) "";
1165 if ((sym_index
/ sdata
->header
.dshb_page_size
)
1166 > sdata
->header
.dshb_nte
.dti_page_count
)
1167 return (const unsigned char *) "\09[INVALID]";
1169 return (const unsigned char *) sdata
->name_table
+ sym_index
;
1172 const unsigned char *
1173 bfd_sym_module_name (bfd
*abfd
, unsigned long sym_index
)
1175 bfd_sym_modules_table_entry entry
;
1177 if (bfd_sym_fetch_modules_table_entry (abfd
, &entry
, sym_index
) < 0)
1178 return (const unsigned char *) "\09[INVALID]";
1180 return bfd_sym_symbol_name (abfd
, entry
.mte_nte_index
);
1184 bfd_sym_unparse_storage_kind (enum bfd_sym_storage_kind kind
)
1188 case BFD_SYM_STORAGE_KIND_LOCAL
: return "LOCAL";
1189 case BFD_SYM_STORAGE_KIND_VALUE
: return "VALUE";
1190 case BFD_SYM_STORAGE_KIND_REFERENCE
: return "REFERENCE";
1191 case BFD_SYM_STORAGE_KIND_WITH
: return "WITH";
1192 default: return "[UNKNOWN]";
1197 bfd_sym_unparse_storage_class (enum bfd_sym_storage_class kind
)
1201 case BFD_SYM_STORAGE_CLASS_REGISTER
: return "REGISTER";
1202 case BFD_SYM_STORAGE_CLASS_GLOBAL
: return "GLOBAL";
1203 case BFD_SYM_STORAGE_CLASS_FRAME_RELATIVE
: return "FRAME_RELATIVE";
1204 case BFD_SYM_STORAGE_CLASS_STACK_RELATIVE
: return "STACK_RELATIVE";
1205 case BFD_SYM_STORAGE_CLASS_ABSOLUTE
: return "ABSOLUTE";
1206 case BFD_SYM_STORAGE_CLASS_CONSTANT
: return "CONSTANT";
1207 case BFD_SYM_STORAGE_CLASS_RESOURCE
: return "RESOURCE";
1208 case BFD_SYM_STORAGE_CLASS_BIGCONSTANT
: return "BIGCONSTANT";
1209 default: return "[UNKNOWN]";
1214 bfd_sym_unparse_module_kind (enum bfd_sym_module_kind kind
)
1218 case BFD_SYM_MODULE_KIND_NONE
: return "NONE";
1219 case BFD_SYM_MODULE_KIND_PROGRAM
: return "PROGRAM";
1220 case BFD_SYM_MODULE_KIND_UNIT
: return "UNIT";
1221 case BFD_SYM_MODULE_KIND_PROCEDURE
: return "PROCEDURE";
1222 case BFD_SYM_MODULE_KIND_FUNCTION
: return "FUNCTION";
1223 case BFD_SYM_MODULE_KIND_DATA
: return "DATA";
1224 case BFD_SYM_MODULE_KIND_BLOCK
: return "BLOCK";
1225 default: return "[UNKNOWN]";
1230 bfd_sym_unparse_symbol_scope (enum bfd_sym_symbol_scope scope
)
1234 case BFD_SYM_SYMBOL_SCOPE_LOCAL
: return "LOCAL";
1235 case BFD_SYM_SYMBOL_SCOPE_GLOBAL
: return "GLOBAL";
1242 bfd_sym_print_file_reference (bfd
*abfd
,
1244 bfd_sym_file_reference
*entry
)
1246 bfd_sym_file_references_table_entry frtentry
;
1249 ret
= bfd_sym_fetch_file_references_table_entry (abfd
, &frtentry
,
1250 entry
->fref_frte_index
);
1251 fprintf (f
, "FILE ");
1253 if ((ret
< 0) || (frtentry
.generic
.type
!= BFD_SYM_FILE_NAME_INDEX
))
1254 fprintf (f
, "[INVALID]");
1256 fprintf (f
, "\"%.*s\"",
1257 bfd_sym_symbol_name (abfd
, frtentry
.filename
.nte_index
)[0],
1258 &bfd_sym_symbol_name (abfd
, frtentry
.filename
.nte_index
)[1]);
1260 fprintf (f
, " (FRTE %lu)", entry
->fref_frte_index
);
1264 bfd_sym_print_resources_table_entry (bfd
*abfd
,
1266 bfd_sym_resources_table_entry
*entry
)
1268 fprintf (f
, " \"%.*s\" (NTE %lu), type \"%.4s\", num %u, size %lu, MTE %lu -- %lu",
1269 bfd_sym_symbol_name (abfd
, entry
->rte_nte_index
)[0],
1270 &bfd_sym_symbol_name (abfd
, entry
->rte_nte_index
)[1],
1271 entry
->rte_nte_index
, entry
->rte_res_type
, entry
->rte_res_number
,
1272 entry
->rte_res_size
, entry
->rte_mte_first
, entry
->rte_mte_last
);
1276 bfd_sym_print_modules_table_entry (bfd
*abfd
,
1278 bfd_sym_modules_table_entry
*entry
)
1280 fprintf (f
, "\"%.*s\" (NTE %lu)",
1281 bfd_sym_symbol_name (abfd
, entry
->mte_nte_index
)[0],
1282 &bfd_sym_symbol_name (abfd
, entry
->mte_nte_index
)[1],
1283 entry
->mte_nte_index
);
1287 bfd_sym_print_file_reference (abfd
, f
, &entry
->mte_imp_fref
);
1288 fprintf (f
, " range %lu -- %lu",
1289 entry
->mte_imp_fref
.fref_offset
, entry
->mte_imp_end
);
1293 fprintf (f
, "kind %s", bfd_sym_unparse_module_kind (entry
->mte_kind
));
1294 fprintf (f
, ", scope %s", bfd_sym_unparse_symbol_scope (entry
->mte_scope
));
1296 fprintf (f
, ", RTE %lu, offset %lu, size %lu",
1297 entry
->mte_rte_index
, entry
->mte_res_offset
, entry
->mte_size
);
1301 fprintf (f
, "CMTE %lu, CVTE %lu, CLTE %lu, CTTE %lu, CSNTE1 %lu, CSNTE2 %lu",
1302 entry
->mte_cmte_index
, entry
->mte_cvte_index
,
1303 entry
->mte_clte_index
, entry
->mte_ctte_index
,
1304 entry
->mte_csnte_idx_1
, entry
->mte_csnte_idx_2
);
1306 if (entry
->mte_parent
!= 0)
1307 fprintf (f
, ", parent %lu", entry
->mte_parent
);
1309 fprintf (f
, ", no parent");
1311 if (entry
->mte_cmte_index
!= 0)
1312 fprintf (f
, ", child %lu", entry
->mte_cmte_index
);
1314 fprintf (f
, ", no child");
1318 bfd_sym_print_file_references_table_entry (bfd
*abfd
,
1320 bfd_sym_file_references_table_entry
*entry
)
1322 switch (entry
->generic
.type
)
1324 case BFD_SYM_FILE_NAME_INDEX
:
1325 fprintf (f
, "FILE \"%.*s\" (NTE %lu), modtime ",
1326 bfd_sym_symbol_name (abfd
, entry
->filename
.nte_index
)[0],
1327 &bfd_sym_symbol_name (abfd
, entry
->filename
.nte_index
)[1],
1328 entry
->filename
.nte_index
);
1330 fprintf (f
, "[UNIMPLEMENTED]");
1331 /* printModDate (entry->filename.mod_date); */
1332 fprintf (f
, " (0x%lx)", entry
->filename
.mod_date
);
1335 case BFD_SYM_END_OF_LIST
:
1340 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu",
1341 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1342 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1343 entry
->entry
.mte_index
,
1344 entry
->entry
.file_offset
);
1350 bfd_sym_print_contained_modules_table_entry (bfd
*abfd
,
1352 bfd_sym_contained_modules_table_entry
*entry
)
1354 switch (entry
->generic
.type
)
1356 case BFD_SYM_END_OF_LIST
:
1361 fprintf (f
, "\"%.*s\" (MTE %lu, NTE %lu)",
1362 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1363 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1364 entry
->entry
.mte_index
,
1365 entry
->entry
.nte_index
);
1371 bfd_sym_print_contained_variables_table_entry (bfd
*abfd
,
1373 bfd_sym_contained_variables_table_entry
*entry
)
1375 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1381 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1383 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1384 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1388 fprintf (f
, "\"%.*s\" (NTE %lu)",
1389 bfd_sym_symbol_name (abfd
, entry
->entry
.nte_index
)[0],
1390 &bfd_sym_symbol_name (abfd
, entry
->entry
.nte_index
)[1],
1391 entry
->entry
.nte_index
);
1393 fprintf (f
, ", TTE %lu", entry
->entry
.tte_index
);
1394 fprintf (f
, ", offset %lu", entry
->entry
.file_delta
);
1395 fprintf (f
, ", scope %s", bfd_sym_unparse_symbol_scope (entry
->entry
.scope
));
1397 if (entry
->entry
.la_size
== BFD_SYM_CVTE_SCA
)
1398 fprintf (f
, ", latype %s, laclass %s, laoffset %lu",
1399 bfd_sym_unparse_storage_kind (entry
->entry
.address
.scstruct
.sca_kind
),
1400 bfd_sym_unparse_storage_class (entry
->entry
.address
.scstruct
.sca_class
),
1401 entry
->entry
.address
.scstruct
.sca_offset
);
1402 else if (entry
->entry
.la_size
<= BFD_SYM_CVTE_LA_MAX_SIZE
)
1406 fprintf (f
, ", la [");
1407 for (i
= 0; i
< entry
->entry
.la_size
; i
++)
1408 fprintf (f
, "0x%02x ", entry
->entry
.address
.lastruct
.la
[i
]);
1411 else if (entry
->entry
.la_size
== BFD_SYM_CVTE_BIG_LA
)
1412 fprintf (f
, ", bigla %lu, biglakind %u",
1413 entry
->entry
.address
.biglastruct
.big_la
,
1414 entry
->entry
.address
.biglastruct
.big_la_kind
);
1417 fprintf (f
, ", la [INVALID]");
1421 bfd_sym_print_contained_statements_table_entry (bfd
*abfd
,
1423 bfd_sym_contained_statements_table_entry
*entry
)
1425 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1431 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1433 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1434 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1438 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu, delta %lu",
1439 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1440 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1441 entry
->entry
.mte_index
,
1442 entry
->entry
.mte_offset
,
1443 entry
->entry
.file_delta
);
1447 bfd_sym_print_contained_labels_table_entry (bfd
*abfd
,
1449 bfd_sym_contained_labels_table_entry
*entry
)
1451 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1457 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1459 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1460 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1464 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu, delta %lu, scope %s",
1465 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1466 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1467 entry
->entry
.mte_index
,
1468 entry
->entry
.mte_offset
,
1469 entry
->entry
.file_delta
,
1470 bfd_sym_unparse_symbol_scope (entry
->entry
.scope
));
1474 bfd_sym_print_contained_types_table_entry (bfd
*abfd ATTRIBUTE_UNUSED
,
1476 bfd_sym_contained_types_table_entry
*entry ATTRIBUTE_UNUSED
)
1478 fprintf (f
, "[UNIMPLEMENTED]");
1482 bfd_sym_type_operator_name (unsigned char num
)
1486 case 1: return "TTE";
1487 case 2: return "PointerTo";
1488 case 3: return "ScalarOf";
1489 case 4: return "ConstantOf";
1490 case 5: return "EnumerationOf";
1491 case 6: return "VectorOf";
1492 case 7: return "RecordOf";
1493 case 8: return "UnionOf";
1494 case 9: return "SubRangeOf";
1495 case 10: return "SetOf";
1496 case 11: return "NamedTypeOf";
1497 case 12: return "ProcOf";
1498 case 13: return "ValueOf";
1499 case 14: return "ArrayOf";
1500 default: return "[UNKNOWN OPERATOR]";
1505 bfd_sym_type_basic_name (unsigned char num
)
1509 case 0: return "void";
1510 case 1: return "pascal string";
1511 case 2: return "unsigned long";
1512 case 3: return "signed long";
1513 case 4: return "extended (10 bytes)";
1514 case 5: return "pascal boolean (1 byte)";
1515 case 6: return "unsigned byte";
1516 case 7: return "signed byte";
1517 case 8: return "character (1 byte)";
1518 case 9: return "wide character (2 bytes)";
1519 case 10: return "unsigned short";
1520 case 11: return "signed short";
1521 case 12: return "singled";
1522 case 13: return "double";
1523 case 14: return "extended (12 bytes)";
1524 case 15: return "computational (8 bytes)";
1525 case 16: return "c string";
1526 case 17: return "as-is string";
1527 default: return "[UNKNOWN BASIC TYPE]";
1532 bfd_sym_fetch_long (unsigned char *buf
,
1534 unsigned long offset
,
1535 unsigned long *offsetptr
,
1546 else if (! (buf
[offset
] & 0x80))
1548 *value
= buf
[offset
];
1552 else if (buf
[offset
] == 0xc0)
1554 if ((offset
+ 5) > len
)
1562 *value
= bfd_getb32 (buf
+ offset
+ 1);
1567 else if ((buf
[offset
] & 0xc0) == 0xc0)
1569 *value
= -(buf
[offset
] & 0x3f);
1573 else if ((buf
[offset
] & 0xc0) == 0x80)
1575 if ((offset
+ 2) > len
)
1583 *value
= bfd_getb16 (buf
+ offset
) & 0x3fff;
1591 if (offsetptr
!= NULL
)
1592 *offsetptr
= offset
;
1598 bfd_sym_print_type_information (bfd
*abfd
,
1602 unsigned long offset
,
1603 unsigned long *offsetptr
)
1609 fprintf (f
, "[NULL]");
1611 if (offsetptr
!= NULL
)
1612 *offsetptr
= offset
;
1619 if (! (type
& 0x80))
1621 fprintf (f
, "[%s] (0x%x)", bfd_sym_type_basic_name (type
& 0x7f), type
);
1623 if (offsetptr
!= NULL
)
1624 *offsetptr
= offset
;
1629 fprintf (f
, "[packed ");
1633 switch (type
& 0x3f)
1638 bfd_sym_type_information_table_entry tinfo
;
1640 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1642 fprintf (f
, "[INVALID]");
1645 if (bfd_sym_fetch_type_table_information (abfd
, &tinfo
, value
) < 0)
1646 fprintf (f
, "[INVALID]");
1648 fprintf (f
, "\"%.*s\"",
1649 bfd_sym_symbol_name (abfd
, tinfo
.nte_index
)[0],
1650 &bfd_sym_symbol_name (abfd
, tinfo
.nte_index
)[1]);
1652 fprintf (f
, " (TTE %lu)", (unsigned long) value
);
1657 fprintf (f
, "pointer (0x%x) to ", type
);
1658 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1665 fprintf (f
, "scalar (0x%x) of ", type
);
1666 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1667 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1668 fprintf (f
, " (%lu)", (unsigned long) value
);
1674 long lower
, upper
, nelem
;
1677 fprintf (f
, "enumeration (0x%x) of ", type
);
1678 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1679 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &lower
);
1680 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &upper
);
1681 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &nelem
);
1682 fprintf (f
, " from %lu to %lu with %lu elements: ",
1683 (unsigned long) lower
, (unsigned long) upper
,
1684 (unsigned long) nelem
);
1686 for (i
= 0; i
< nelem
; i
++)
1689 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1695 fprintf (f
, "vector (0x%x)", type
);
1696 fprintf (f
, "\n index ");
1697 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1698 fprintf (f
, "\n target ");
1699 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1705 long nrec
, eloff
, i
;
1707 if ((type
& 0x3f) == 7)
1708 fprintf (f
, "record (0x%x) of ", type
);
1710 fprintf (f
, "union (0x%x) of ", type
);
1712 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &nrec
);
1713 fprintf (f
, "%lu elements: ", (unsigned long) nrec
);
1715 for (i
= 0; i
< nrec
; i
++)
1717 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &eloff
);
1719 fprintf (f
, "offset %lu: ", (unsigned long) eloff
);
1720 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1726 fprintf (f
, "subrange (0x%x) of ", type
);
1727 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1728 fprintf (f
, " lower ");
1729 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1730 fprintf (f
, " upper ");
1731 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1738 fprintf (f
, "named type (0x%x) ", type
);
1739 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1741 fprintf (f
, "[INVALID]");
1743 fprintf (f
, "\"%.*s\"",
1744 bfd_sym_symbol_name (abfd
, value
)[0],
1745 &bfd_sym_symbol_name (abfd
, value
)[1]);
1747 fprintf (f
, " (NTE %lu) with type ", (unsigned long) value
);
1748 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1753 fprintf (f
, "%s (0x%x)", bfd_sym_type_operator_name (type
), type
);
1757 if (type
== (0x40 | 0x6))
1764 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &n
);
1765 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &width
);
1766 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &m
);
1767 /* fprintf (f, "\n "); */
1768 fprintf (f
, " N %ld, width %ld, M %ld, ", n
, width
, m
);
1769 for (i
= 0; i
< m
; i
++)
1771 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &l
);
1774 fprintf (f
, "%ld", l
);
1777 else if (type
& 0x40)
1779 /* Other packed type. */
1782 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &msb
);
1783 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &lsb
);
1784 /* fprintf (f, "\n "); */
1785 fprintf (f
, " msb %ld, lsb %ld", msb
, lsb
);
1790 if (offsetptr
!= NULL
)
1791 *offsetptr
= offset
;
1795 bfd_sym_print_type_information_table_entry (bfd
*abfd
,
1797 bfd_sym_type_information_table_entry
*entry
)
1800 unsigned long offset
;
1803 fprintf (f
, "\"%.*s\" (NTE %lu), %lu bytes at %lu, logical size %lu",
1804 bfd_sym_symbol_name (abfd
, entry
->nte_index
)[0],
1805 &bfd_sym_symbol_name (abfd
, entry
->nte_index
)[1],
1807 entry
->physical_size
, entry
->offset
, entry
->logical_size
);
1811 buf
= malloc (entry
->physical_size
);
1814 fprintf (f
, "[ERROR]\n");
1817 if (bfd_seek (abfd
, entry
->offset
, SEEK_SET
) < 0)
1819 fprintf (f
, "[ERROR]\n");
1823 if (bfd_bread (buf
, entry
->physical_size
, abfd
) != entry
->physical_size
)
1825 fprintf (f
, "[ERROR]\n");
1831 for (i
= 0; i
< entry
->physical_size
; i
++)
1834 fprintf (f
, "0x%02x", buf
[i
]);
1836 fprintf (f
, " 0x%02x", buf
[i
]);
1842 bfd_sym_print_type_information (abfd
, f
, buf
, entry
->physical_size
, 0, &offset
);
1844 if (offset
!= entry
->physical_size
)
1845 fprintf (f
, "\n [parser used %lu bytes instead of %lu]", offset
, entry
->physical_size
);
1850 bfd_sym_print_file_references_index_table_entry (bfd
*abfd ATTRIBUTE_UNUSED
,
1852 bfd_sym_file_references_index_table_entry
*entry ATTRIBUTE_UNUSED
)
1854 fprintf (f
, "[UNIMPLEMENTED]");
1858 bfd_sym_print_constant_pool_entry (bfd
*abfd ATTRIBUTE_UNUSED
,
1860 bfd_sym_constant_pool_entry
*entry ATTRIBUTE_UNUSED
)
1862 fprintf (f
, "[UNIMPLEMENTED]");
1866 bfd_sym_display_name_table_entry (bfd
*abfd
,
1868 unsigned char *entry
)
1870 unsigned long sym_index
;
1871 unsigned long offset
;
1872 bfd_sym_data_struct
*sdata
= NULL
;
1874 BFD_ASSERT (bfd_sym_valid (abfd
));
1875 sdata
= abfd
->tdata
.sym_data
;
1876 sym_index
= (entry
- sdata
->name_table
) / 2;
1878 if (sdata
->version
>= BFD_SYM_VERSION_3_4
&& entry
[0] == 255 && entry
[1] == 0)
1880 unsigned short length
= bfd_getb16 (entry
+ 2);
1881 fprintf (f
, "[%8lu] \"%.*s\"\n", sym_index
, length
, entry
+ 4);
1882 offset
= 2 + length
+ 1;
1886 if (! (entry
[0] == 0 || (entry
[0] == 1 && entry
[1] == '\0')))
1887 fprintf (f
, "[%8lu] \"%.*s\"\n", sym_index
, entry
[0], entry
+ 1);
1889 if (sdata
->version
>= BFD_SYM_VERSION_3_4
)
1890 offset
= entry
[0] + 2;
1892 offset
= entry
[0] + 1;
1895 return (entry
+ offset
+ (offset
% 2));
1899 bfd_sym_display_name_table (bfd
*abfd
, FILE *f
)
1901 unsigned long name_table_len
;
1902 unsigned char *name_table
, *name_table_end
, *cur
;
1903 bfd_sym_data_struct
*sdata
= NULL
;
1905 BFD_ASSERT (bfd_sym_valid (abfd
));
1906 sdata
= abfd
->tdata
.sym_data
;
1908 name_table_len
= sdata
->header
.dshb_nte
.dti_page_count
* sdata
->header
.dshb_page_size
;
1909 name_table
= sdata
->name_table
;
1910 name_table_end
= name_table
+ name_table_len
;
1912 fprintf (f
, "name table (NTE) contains %lu bytes:\n\n", name_table_len
);
1917 cur
= bfd_sym_display_name_table_entry (abfd
, f
, cur
);
1918 if (cur
>= name_table_end
)
1924 bfd_sym_display_resources_table (bfd
*abfd
, FILE *f
)
1927 bfd_sym_resources_table_entry entry
;
1928 bfd_sym_data_struct
*sdata
= NULL
;
1930 BFD_ASSERT (bfd_sym_valid (abfd
));
1931 sdata
= abfd
->tdata
.sym_data
;
1933 fprintf (f
, "resource table (RTE) contains %lu objects:\n\n",
1934 sdata
->header
.dshb_rte
.dti_object_count
);
1936 for (i
= 1; i
<= sdata
->header
.dshb_rte
.dti_object_count
; i
++)
1938 if (bfd_sym_fetch_resources_table_entry (abfd
, &entry
, i
) < 0)
1939 fprintf (f
, " [%8lu] [INVALID]\n", i
);
1942 fprintf (f
, " [%8lu] ", i
);
1943 bfd_sym_print_resources_table_entry (abfd
, f
, &entry
);
1950 bfd_sym_display_modules_table (bfd
*abfd
, FILE *f
)
1953 bfd_sym_modules_table_entry entry
;
1954 bfd_sym_data_struct
*sdata
= NULL
;
1956 BFD_ASSERT (bfd_sym_valid (abfd
));
1957 sdata
= abfd
->tdata
.sym_data
;
1959 fprintf (f
, "module table (MTE) contains %lu objects:\n\n",
1960 sdata
->header
.dshb_mte
.dti_object_count
);
1962 for (i
= 1; i
<= sdata
->header
.dshb_mte
.dti_object_count
; i
++)
1964 if (bfd_sym_fetch_modules_table_entry (abfd
, &entry
, i
) < 0)
1965 fprintf (f
, " [%8lu] [INVALID]\n", i
);
1968 fprintf (f
, " [%8lu] ", i
);
1969 bfd_sym_print_modules_table_entry (abfd
, f
, &entry
);
1976 bfd_sym_display_file_references_table (bfd
*abfd
, FILE *f
)
1979 bfd_sym_file_references_table_entry entry
;
1980 bfd_sym_data_struct
*sdata
= NULL
;
1982 BFD_ASSERT (bfd_sym_valid (abfd
));
1983 sdata
= abfd
->tdata
.sym_data
;
1985 fprintf (f
, "file reference table (FRTE) contains %lu objects:\n\n",
1986 sdata
->header
.dshb_frte
.dti_object_count
);
1988 for (i
= 1; i
<= sdata
->header
.dshb_frte
.dti_object_count
; i
++)
1990 if (bfd_sym_fetch_file_references_table_entry (abfd
, &entry
, i
) < 0)
1991 fprintf (f
, " [%8lu] [INVALID]\n", i
);
1994 fprintf (f
, " [%8lu] ", i
);
1995 bfd_sym_print_file_references_table_entry (abfd
, f
, &entry
);
2002 bfd_sym_display_contained_modules_table (bfd
*abfd
, FILE *f
)
2005 bfd_sym_contained_modules_table_entry entry
;
2006 bfd_sym_data_struct
*sdata
= NULL
;
2008 BFD_ASSERT (bfd_sym_valid (abfd
));
2009 sdata
= abfd
->tdata
.sym_data
;
2011 fprintf (f
, "contained modules table (CMTE) contains %lu objects:\n\n",
2012 sdata
->header
.dshb_cmte
.dti_object_count
);
2014 for (i
= 1; i
<= sdata
->header
.dshb_cmte
.dti_object_count
; i
++)
2016 if (bfd_sym_fetch_contained_modules_table_entry (abfd
, &entry
, i
) < 0)
2017 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2020 fprintf (f
, " [%8lu] ", i
);
2021 bfd_sym_print_contained_modules_table_entry (abfd
, f
, &entry
);
2028 bfd_sym_display_contained_variables_table (bfd
*abfd
, FILE *f
)
2031 bfd_sym_contained_variables_table_entry entry
;
2032 bfd_sym_data_struct
*sdata
= NULL
;
2034 BFD_ASSERT (bfd_sym_valid (abfd
));
2035 sdata
= abfd
->tdata
.sym_data
;
2037 fprintf (f
, "contained variables table (CVTE) contains %lu objects:\n\n",
2038 sdata
->header
.dshb_cvte
.dti_object_count
);
2040 for (i
= 1; i
<= sdata
->header
.dshb_cvte
.dti_object_count
; i
++)
2042 if (bfd_sym_fetch_contained_variables_table_entry (abfd
, &entry
, i
) < 0)
2043 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2046 fprintf (f
, " [%8lu] ", i
);
2047 bfd_sym_print_contained_variables_table_entry (abfd
, f
, &entry
);
2056 bfd_sym_display_contained_statements_table (bfd
*abfd
, FILE *f
)
2059 bfd_sym_contained_statements_table_entry entry
;
2060 bfd_sym_data_struct
*sdata
= NULL
;
2062 BFD_ASSERT (bfd_sym_valid (abfd
));
2063 sdata
= abfd
->tdata
.sym_data
;
2065 fprintf (f
, "contained statements table (CSNTE) contains %lu objects:\n\n",
2066 sdata
->header
.dshb_csnte
.dti_object_count
);
2068 for (i
= 1; i
<= sdata
->header
.dshb_csnte
.dti_object_count
; i
++)
2070 if (bfd_sym_fetch_contained_statements_table_entry (abfd
, &entry
, i
) < 0)
2071 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2074 fprintf (f
, " [%8lu] ", i
);
2075 bfd_sym_print_contained_statements_table_entry (abfd
, f
, &entry
);
2082 bfd_sym_display_contained_labels_table (bfd
*abfd
, FILE *f
)
2085 bfd_sym_contained_labels_table_entry entry
;
2086 bfd_sym_data_struct
*sdata
= NULL
;
2088 BFD_ASSERT (bfd_sym_valid (abfd
));
2089 sdata
= abfd
->tdata
.sym_data
;
2091 fprintf (f
, "contained labels table (CLTE) contains %lu objects:\n\n",
2092 sdata
->header
.dshb_clte
.dti_object_count
);
2094 for (i
= 1; i
<= sdata
->header
.dshb_clte
.dti_object_count
; i
++)
2096 if (bfd_sym_fetch_contained_labels_table_entry (abfd
, &entry
, i
) < 0)
2097 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2100 fprintf (f
, " [%8lu] ", i
);
2101 bfd_sym_print_contained_labels_table_entry (abfd
, f
, &entry
);
2108 bfd_sym_display_contained_types_table (bfd
*abfd
, FILE *f
)
2111 bfd_sym_contained_types_table_entry entry
;
2112 bfd_sym_data_struct
*sdata
= NULL
;
2114 BFD_ASSERT (bfd_sym_valid (abfd
));
2115 sdata
= abfd
->tdata
.sym_data
;
2117 fprintf (f
, "contained types table (CTTE) contains %lu objects:\n\n",
2118 sdata
->header
.dshb_ctte
.dti_object_count
);
2120 for (i
= 1; i
<= sdata
->header
.dshb_ctte
.dti_object_count
; i
++)
2122 if (bfd_sym_fetch_contained_types_table_entry (abfd
, &entry
, i
) < 0)
2123 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2126 fprintf (f
, " [%8lu] ", i
);
2127 bfd_sym_print_contained_types_table_entry (abfd
, f
, &entry
);
2134 bfd_sym_display_file_references_index_table (bfd
*abfd
, FILE *f
)
2137 bfd_sym_file_references_index_table_entry entry
;
2138 bfd_sym_data_struct
*sdata
= NULL
;
2140 BFD_ASSERT (bfd_sym_valid (abfd
));
2141 sdata
= abfd
->tdata
.sym_data
;
2143 fprintf (f
, "file references index table (FITE) contains %lu objects:\n\n",
2144 sdata
->header
.dshb_fite
.dti_object_count
);
2146 for (i
= 1; i
<= sdata
->header
.dshb_fite
.dti_object_count
; i
++)
2148 if (bfd_sym_fetch_file_references_index_table_entry (abfd
, &entry
, i
) < 0)
2149 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2152 fprintf (f
, " [%8lu] ", i
);
2153 bfd_sym_print_file_references_index_table_entry (abfd
, f
, &entry
);
2160 bfd_sym_display_constant_pool (bfd
*abfd
, FILE *f
)
2163 bfd_sym_constant_pool_entry entry
;
2164 bfd_sym_data_struct
*sdata
= NULL
;
2166 BFD_ASSERT (bfd_sym_valid (abfd
));
2167 sdata
= abfd
->tdata
.sym_data
;
2169 fprintf (f
, "constant pool (CONST) contains %lu objects:\n\n",
2170 sdata
->header
.dshb_const
.dti_object_count
);
2172 for (i
= 1; i
<= sdata
->header
.dshb_const
.dti_object_count
; i
++)
2174 if (bfd_sym_fetch_constant_pool_entry (abfd
, &entry
, i
) < 0)
2175 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2178 fprintf (f
, " [%8lu] ", i
);
2179 bfd_sym_print_constant_pool_entry (abfd
, f
, &entry
);
2186 bfd_sym_display_type_information_table (bfd
*abfd
, FILE *f
)
2189 bfd_sym_type_table_entry sym_index
;
2190 bfd_sym_type_information_table_entry entry
;
2191 bfd_sym_data_struct
*sdata
= NULL
;
2193 BFD_ASSERT (bfd_sym_valid (abfd
));
2194 sdata
= abfd
->tdata
.sym_data
;
2196 if (sdata
->header
.dshb_tte
.dti_object_count
> 99)
2197 fprintf (f
, "type table (TINFO) contains %lu objects:\n\n",
2198 sdata
->header
.dshb_tte
.dti_object_count
- 99);
2201 fprintf (f
, "type table (TINFO) contains [INVALID] objects:\n\n");
2205 for (i
= 100; i
<= sdata
->header
.dshb_tte
.dti_object_count
; i
++)
2207 if (bfd_sym_fetch_type_table_entry (abfd
, &sym_index
, i
- 100) < 0)
2208 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2211 fprintf (f
, " [%8lu] (TINFO %lu) ", i
, sym_index
);
2213 if (bfd_sym_fetch_type_information_table_entry (abfd
, &entry
, sym_index
) < 0)
2214 fprintf (f
, "[INVALID]");
2216 bfd_sym_print_type_information_table_entry (abfd
, f
, &entry
);
2224 bfd_sym_scan (bfd
*abfd
, bfd_sym_version version
, bfd_sym_data_struct
*mdata
)
2227 const char *name
= "symbols";
2229 mdata
->name_table
= 0;
2231 mdata
->version
= version
;
2233 bfd_seek (abfd
, 0, SEEK_SET
);
2234 if (bfd_sym_read_header (abfd
, &mdata
->header
, mdata
->version
) != 0)
2237 mdata
->name_table
= bfd_sym_read_name_table (abfd
, &mdata
->header
);
2238 if (mdata
->name_table
== NULL
)
2241 bfdsec
= bfd_make_section_anyway_with_flags (abfd
, name
, SEC_HAS_CONTENTS
);
2248 bfdsec
->filepos
= 0;
2249 bfdsec
->alignment_power
= 0;
2251 abfd
->tdata
.sym_data
= mdata
;
2257 bfd_sym_object_p (bfd
*abfd
)
2259 bfd_sym_version version
= -1;
2260 bfd_sym_data_struct
*mdata
;
2262 bfd_seek (abfd
, 0, SEEK_SET
);
2263 if (bfd_sym_read_version (abfd
, &version
) != 0)
2266 mdata
= (bfd_sym_data_struct
*) bfd_alloc (abfd
, sizeof (*mdata
));
2270 if (bfd_sym_scan (abfd
, version
, mdata
) != 0)
2276 bfd_set_error (bfd_error_wrong_format
);
2282 #define bfd_sym_make_empty_symbol _bfd_generic_make_empty_symbol
2285 bfd_sym_get_symbol_info (bfd
*abfd ATTRIBUTE_UNUSED
, asymbol
*symbol
, symbol_info
*ret
)
2287 bfd_symbol_info (symbol
, ret
);
2291 bfd_sym_get_symtab_upper_bound (bfd
*abfd ATTRIBUTE_UNUSED
)
2297 bfd_sym_canonicalize_symtab (bfd
*abfd ATTRIBUTE_UNUSED
, asymbol
**sym ATTRIBUTE_UNUSED
)
2303 bfd_sym_sizeof_headers (bfd
*abfd ATTRIBUTE_UNUSED
,
2304 struct bfd_link_info
*info ATTRIBUTE_UNUSED
)
2309 const bfd_target sym_vec
=
2312 bfd_target_sym_flavour
, /* Flavour. */
2313 BFD_ENDIAN_BIG
, /* Byteorder. */
2314 BFD_ENDIAN_BIG
, /* Header byteorder. */
2315 (HAS_RELOC
| EXEC_P
| /* Object flags. */
2316 HAS_LINENO
| HAS_DEBUG
|
2317 HAS_SYMS
| HAS_LOCALS
| DYNAMIC
| WP_TEXT
| D_PAGED
),
2318 (SEC_ALLOC
| SEC_LOAD
| SEC_READONLY
| SEC_CODE
| SEC_DATA
2319 | SEC_ROM
| SEC_HAS_CONTENTS
), /* Section_flags. */
2320 0, /* Symbol_leading_char. */
2321 ' ', /* AR_pad_char. */
2322 16, /* AR_max_namelen. */
2323 0, /* match priority. */
2324 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2325 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2326 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* Data. */
2327 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2328 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2329 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* Hdrs. */
2330 { /* bfd_check_format. */
2332 bfd_sym_object_p
, /* bfd_check_format. */
2336 { /* bfd_set_format. */
2337 _bfd_bool_bfd_false_error
,
2339 _bfd_bool_bfd_false_error
,
2340 _bfd_bool_bfd_false_error
,
2342 { /* bfd_write_contents. */
2343 _bfd_bool_bfd_false_error
,
2345 _bfd_bool_bfd_false_error
,
2346 _bfd_bool_bfd_false_error
,
2349 BFD_JUMP_TABLE_GENERIC (bfd_sym
),
2350 BFD_JUMP_TABLE_COPY (_bfd_generic
),
2351 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
2352 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive
),
2353 BFD_JUMP_TABLE_SYMBOLS (bfd_sym
),
2354 BFD_JUMP_TABLE_RELOCS (_bfd_norelocs
),
2355 BFD_JUMP_TABLE_WRITE (bfd_sym
),
2356 BFD_JUMP_TABLE_LINK (bfd_sym
),
2357 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),