1 /* xSYM symbol-file support for BFD.
2 Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
3 2009, 2010, 2011 Free Software Foundation, Inc.
5 This file is part of BFD, the Binary File Descriptor library.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20 MA 02110-1301, USA. */
22 /* xSYM is the debugging format used by CodeWarrior on Mac OS classic. */
24 #include "alloca-conf.h"
30 #define bfd_sym_close_and_cleanup _bfd_generic_close_and_cleanup
31 #define bfd_sym_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
32 #define bfd_sym_new_section_hook _bfd_generic_new_section_hook
33 #define bfd_sym_bfd_is_local_label_name bfd_generic_is_local_label_name
34 #define bfd_sym_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
35 #define bfd_sym_get_lineno _bfd_nosymbols_get_lineno
36 #define bfd_sym_find_nearest_line _bfd_nosymbols_find_nearest_line
37 #define bfd_sym_find_inliner_info _bfd_nosymbols_find_inliner_info
38 #define bfd_sym_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
39 #define bfd_sym_read_minisymbols _bfd_generic_read_minisymbols
40 #define bfd_sym_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
41 #define bfd_sym_set_arch_mach _bfd_generic_set_arch_mach
42 #define bfd_sym_get_section_contents _bfd_generic_get_section_contents
43 #define bfd_sym_set_section_contents _bfd_generic_set_section_contents
44 #define bfd_sym_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
45 #define bfd_sym_bfd_relax_section bfd_generic_relax_section
46 #define bfd_sym_bfd_gc_sections bfd_generic_gc_sections
47 #define bfd_sym_bfd_lookup_section_flags bfd_generic_lookup_section_flags
48 #define bfd_sym_bfd_merge_sections bfd_generic_merge_sections
49 #define bfd_sym_bfd_is_group_section bfd_generic_is_group_section
50 #define bfd_sym_bfd_discard_group bfd_generic_discard_group
51 #define bfd_sym_section_already_linked _bfd_generic_section_already_linked
52 #define bfd_sym_bfd_define_common_symbol bfd_generic_define_common_symbol
53 #define bfd_sym_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
54 #define bfd_sym_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
55 #define bfd_sym_bfd_link_add_symbols _bfd_generic_link_add_symbols
56 #define bfd_sym_bfd_link_just_syms _bfd_generic_link_just_syms
57 #define bfd_sym_bfd_copy_link_hash_symbol_type \
58 _bfd_generic_copy_link_hash_symbol_type
59 #define bfd_sym_bfd_final_link _bfd_generic_final_link
60 #define bfd_sym_bfd_link_split_section _bfd_generic_link_split_section
61 #define bfd_sym_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
63 extern const bfd_target sym_vec
;
66 pstrcmp (const char *as
, const char *bs
)
68 const unsigned char *a
= (const unsigned char *) as
;
69 const unsigned char *b
= (const unsigned char *) bs
;
73 clen
= (a
[0] > b
[0]) ? b
[0] : a
[0];
74 ret
= memcmp (a
+ 1, b
+ 1, clen
);
87 compute_offset (unsigned long first_page
,
88 unsigned long page_size
,
89 unsigned long entry_size
,
90 unsigned long sym_index
)
92 unsigned long entries_per_page
= page_size
/ entry_size
;
93 unsigned long page_number
= first_page
+ (sym_index
/ entries_per_page
);
94 unsigned long page_offset
= (sym_index
% entries_per_page
) * entry_size
;
96 return (page_number
* page_size
) + page_offset
;
100 bfd_sym_mkobject (bfd
*abfd ATTRIBUTE_UNUSED
)
106 bfd_sym_print_symbol (bfd
*abfd ATTRIBUTE_UNUSED
,
107 void * afile ATTRIBUTE_UNUSED
,
108 asymbol
*symbol ATTRIBUTE_UNUSED
,
109 bfd_print_symbol_type how ATTRIBUTE_UNUSED
)
115 bfd_sym_valid (bfd
*abfd
)
117 if (abfd
== NULL
|| abfd
->xvec
== NULL
)
120 return abfd
->xvec
== &sym_vec
;
124 bfd_sym_read_name_table (bfd
*abfd
, bfd_sym_header_block
*dshb
)
128 size_t table_size
= dshb
->dshb_nte
.dti_page_count
* dshb
->dshb_page_size
;
129 size_t table_offset
= dshb
->dshb_nte
.dti_first_page
* dshb
->dshb_page_size
;
131 rstr
= bfd_alloc (abfd
, table_size
);
135 bfd_seek (abfd
, table_offset
, SEEK_SET
);
136 ret
= bfd_bread (rstr
, table_size
, abfd
);
137 if (ret
< 0 || (unsigned long) ret
!= table_size
)
139 bfd_release (abfd
, rstr
);
147 bfd_sym_parse_file_reference_v32 (unsigned char *buf
,
149 bfd_sym_file_reference
*entry
)
151 BFD_ASSERT (len
== 6);
153 entry
->fref_frte_index
= bfd_getb16 (buf
);
154 entry
->fref_offset
= bfd_getb32 (buf
+ 2);
158 bfd_sym_parse_disk_table_v32 (unsigned char *buf
,
160 bfd_sym_table_info
*table
)
162 BFD_ASSERT (len
== 8);
164 table
->dti_first_page
= bfd_getb16 (buf
);
165 table
->dti_page_count
= bfd_getb16 (buf
+ 2);
166 table
->dti_object_count
= bfd_getb32 (buf
+ 4);
170 bfd_sym_parse_header_v32 (unsigned char *buf
,
172 bfd_sym_header_block
*header
)
174 BFD_ASSERT (len
== 154);
176 memcpy (header
->dshb_id
, buf
, 32);
177 header
->dshb_page_size
= bfd_getb16 (buf
+ 32);
178 header
->dshb_hash_page
= bfd_getb16 (buf
+ 34);
179 header
->dshb_root_mte
= bfd_getb16 (buf
+ 36);
180 header
->dshb_mod_date
= bfd_getb32 (buf
+ 38);
182 bfd_sym_parse_disk_table_v32 (buf
+ 42, 8, &header
->dshb_frte
);
183 bfd_sym_parse_disk_table_v32 (buf
+ 50, 8, &header
->dshb_rte
);
184 bfd_sym_parse_disk_table_v32 (buf
+ 58, 8, &header
->dshb_mte
);
185 bfd_sym_parse_disk_table_v32 (buf
+ 66, 8, &header
->dshb_cmte
);
186 bfd_sym_parse_disk_table_v32 (buf
+ 74, 8, &header
->dshb_cvte
);
187 bfd_sym_parse_disk_table_v32 (buf
+ 82, 8, &header
->dshb_csnte
);
188 bfd_sym_parse_disk_table_v32 (buf
+ 90, 8, &header
->dshb_clte
);
189 bfd_sym_parse_disk_table_v32 (buf
+ 98, 8, &header
->dshb_ctte
);
190 bfd_sym_parse_disk_table_v32 (buf
+ 106, 8, &header
->dshb_tte
);
191 bfd_sym_parse_disk_table_v32 (buf
+ 114, 8, &header
->dshb_nte
);
192 bfd_sym_parse_disk_table_v32 (buf
+ 122, 8, &header
->dshb_tinfo
);
193 bfd_sym_parse_disk_table_v32 (buf
+ 130, 8, &header
->dshb_fite
);
194 bfd_sym_parse_disk_table_v32 (buf
+ 138, 8, &header
->dshb_const
);
196 memcpy (&header
->dshb_file_creator
, buf
+ 146, 4);
197 memcpy (&header
->dshb_file_type
, buf
+ 150, 4);
201 bfd_sym_read_header_v32 (bfd
*abfd
, bfd_sym_header_block
*header
)
203 unsigned char buf
[154];
206 ret
= bfd_bread (buf
, 154, abfd
);
210 bfd_sym_parse_header_v32 (buf
, 154, header
);
216 bfd_sym_read_header_v34 (bfd
*abfd ATTRIBUTE_UNUSED
,
217 bfd_sym_header_block
*header ATTRIBUTE_UNUSED
)
223 bfd_sym_read_header (bfd
*abfd
,
224 bfd_sym_header_block
*header
,
225 bfd_sym_version version
)
229 case BFD_SYM_VERSION_3_5
:
230 case BFD_SYM_VERSION_3_4
:
231 return bfd_sym_read_header_v34 (abfd
, header
);
232 case BFD_SYM_VERSION_3_3
:
233 case BFD_SYM_VERSION_3_2
:
234 return bfd_sym_read_header_v32 (abfd
, header
);
235 case BFD_SYM_VERSION_3_1
:
242 bfd_sym_read_version (bfd
*abfd
, bfd_sym_version
*version
)
244 char version_string
[32];
247 ret
= bfd_bread (version_string
, sizeof (version_string
), abfd
);
248 if (ret
!= sizeof (version_string
))
251 if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_1
) == 0)
252 *version
= BFD_SYM_VERSION_3_1
;
253 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_2
) == 0)
254 *version
= BFD_SYM_VERSION_3_2
;
255 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_3
) == 0)
256 *version
= BFD_SYM_VERSION_3_3
;
257 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_4
) == 0)
258 *version
= BFD_SYM_VERSION_3_4
;
259 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_5
) == 0)
260 *version
= BFD_SYM_VERSION_3_5
;
268 bfd_sym_display_table_summary (FILE *f
,
269 bfd_sym_table_info
*dti
,
272 fprintf (f
, "%-6s %13ld %13ld %13ld\n",
276 dti
->dti_object_count
);
280 bfd_sym_display_header (FILE *f
, bfd_sym_header_block
*dshb
)
282 fprintf (f
, " Version: %.*s\n", dshb
->dshb_id
[0], dshb
->dshb_id
+ 1);
283 fprintf (f
, " Page Size: 0x%x\n", dshb
->dshb_page_size
);
284 fprintf (f
, " Hash Page: %lu\n", dshb
->dshb_hash_page
);
285 fprintf (f
, " Root MTE: %lu\n", dshb
->dshb_root_mte
);
286 fprintf (f
, " Modification Date: ");
287 fprintf (f
, "[unimplemented]");
288 fprintf (f
, " (0x%lx)\n", dshb
->dshb_mod_date
);
290 fprintf (f
, " File Creator: %.4s Type: %.4s\n\n",
291 dshb
->dshb_file_creator
, dshb
->dshb_file_type
);
293 fprintf (f
, "Table Name First Page Page Count Object Count\n");
294 fprintf (f
, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
296 bfd_sym_display_table_summary (f
, &dshb
->dshb_nte
, "NTE");
297 bfd_sym_display_table_summary (f
, &dshb
->dshb_rte
, "RTE");
298 bfd_sym_display_table_summary (f
, &dshb
->dshb_mte
, "MTE");
299 bfd_sym_display_table_summary (f
, &dshb
->dshb_frte
, "FRTE");
300 bfd_sym_display_table_summary (f
, &dshb
->dshb_cmte
, "CMTE");
301 bfd_sym_display_table_summary (f
, &dshb
->dshb_cvte
, "CVTE");
302 bfd_sym_display_table_summary (f
, &dshb
->dshb_csnte
, "CSNTE");
303 bfd_sym_display_table_summary (f
, &dshb
->dshb_clte
, "CLTE");
304 bfd_sym_display_table_summary (f
, &dshb
->dshb_ctte
, "CTTE");
305 bfd_sym_display_table_summary (f
, &dshb
->dshb_tte
, "TTE");
306 bfd_sym_display_table_summary (f
, &dshb
->dshb_tinfo
, "TINFO");
307 bfd_sym_display_table_summary (f
, &dshb
->dshb_fite
, "FITE");
308 bfd_sym_display_table_summary (f
, &dshb
->dshb_const
, "CONST");
314 bfd_sym_parse_resources_table_entry_v32 (unsigned char *buf
,
316 bfd_sym_resources_table_entry
*entry
)
318 BFD_ASSERT (len
== 18);
320 memcpy (&entry
->rte_res_type
, buf
, 4);
321 entry
->rte_res_number
= bfd_getb16 (buf
+ 4);
322 entry
->rte_nte_index
= bfd_getb32 (buf
+ 6);
323 entry
->rte_mte_first
= bfd_getb16 (buf
+ 10);
324 entry
->rte_mte_last
= bfd_getb16 (buf
+ 12);
325 entry
->rte_res_size
= bfd_getb32 (buf
+ 14);
329 bfd_sym_parse_modules_table_entry_v33 (unsigned char *buf
,
331 bfd_sym_modules_table_entry
*entry
)
333 BFD_ASSERT (len
== 46);
335 entry
->mte_rte_index
= bfd_getb16 (buf
);
336 entry
->mte_res_offset
= bfd_getb32 (buf
+ 2);
337 entry
->mte_size
= bfd_getb32 (buf
+ 6);
338 entry
->mte_kind
= buf
[10];
339 entry
->mte_scope
= buf
[11];
340 entry
->mte_parent
= bfd_getb16 (buf
+ 12);
341 bfd_sym_parse_file_reference_v32 (buf
+ 14, 6, &entry
->mte_imp_fref
);
342 entry
->mte_imp_end
= bfd_getb32 (buf
+ 20);
343 entry
->mte_nte_index
= bfd_getb32 (buf
+ 24);
344 entry
->mte_cmte_index
= bfd_getb16 (buf
+ 28);
345 entry
->mte_cvte_index
= bfd_getb32 (buf
+ 30);
346 entry
->mte_clte_index
= bfd_getb16 (buf
+ 34);
347 entry
->mte_ctte_index
= bfd_getb16 (buf
+ 36);
348 entry
->mte_csnte_idx_1
= bfd_getb32 (buf
+ 38);
349 entry
->mte_csnte_idx_2
= bfd_getb32 (buf
+ 42);
353 bfd_sym_parse_file_references_table_entry_v32 (unsigned char *buf
,
355 bfd_sym_file_references_table_entry
*entry
)
359 BFD_ASSERT (len
== 10);
361 memset (entry
, 0, sizeof (bfd_sym_file_references_table_entry
));
362 type
= bfd_getb16 (buf
);
366 case BFD_SYM_END_OF_LIST_3_2
:
367 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
370 case BFD_SYM_FILE_NAME_INDEX_3_2
:
371 entry
->filename
.type
= BFD_SYM_FILE_NAME_INDEX
;
372 entry
->filename
.nte_index
= bfd_getb32 (buf
+ 2);
373 entry
->filename
.mod_date
= bfd_getb32 (buf
+ 6);
377 entry
->entry
.mte_index
= type
;
378 entry
->entry
.file_offset
= bfd_getb32 (buf
+ 2);
383 bfd_sym_parse_contained_modules_table_entry_v32 (unsigned char *buf
,
385 bfd_sym_contained_modules_table_entry
*entry
)
389 BFD_ASSERT (len
== 6);
391 memset (entry
, 0, sizeof (bfd_sym_contained_modules_table_entry
));
392 type
= bfd_getb16 (buf
);
396 case BFD_SYM_END_OF_LIST_3_2
:
397 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
401 entry
->entry
.mte_index
= type
;
402 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 2);
408 bfd_sym_parse_contained_variables_table_entry_v32 (unsigned char *buf
,
410 bfd_sym_contained_variables_table_entry
*entry
)
414 BFD_ASSERT (len
== 26);
416 memset (entry
, 0, sizeof (bfd_sym_contained_variables_table_entry
));
417 type
= bfd_getb16 (buf
);
421 case BFD_SYM_END_OF_LIST_3_2
:
422 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
425 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
426 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
427 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
431 entry
->entry
.tte_index
= type
;
432 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 2);
433 entry
->entry
.file_delta
= bfd_getb16 (buf
+ 6);
434 entry
->entry
.scope
= buf
[8];
435 entry
->entry
.la_size
= buf
[9];
437 if (entry
->entry
.la_size
== BFD_SYM_CVTE_SCA
)
439 entry
->entry
.address
.scstruct
.sca_kind
= buf
[10];
440 entry
->entry
.address
.scstruct
.sca_class
= buf
[11];
441 entry
->entry
.address
.scstruct
.sca_offset
= bfd_getb32 (buf
+ 12);
443 else if (entry
->entry
.la_size
<= BFD_SYM_CVTE_SCA
)
445 #if BFD_SYM_CVTE_SCA > 0
446 memcpy (&entry
->entry
.address
.lastruct
.la
, buf
+ 10,
449 entry
->entry
.address
.lastruct
.la_kind
= buf
[23];
451 else if (entry
->entry
.la_size
== BFD_SYM_CVTE_BIG_LA
)
453 entry
->entry
.address
.biglastruct
.big_la
= bfd_getb32 (buf
+ 10);
454 entry
->entry
.address
.biglastruct
.big_la_kind
= buf
[12];
460 bfd_sym_parse_contained_statements_table_entry_v32 (unsigned char *buf
,
462 bfd_sym_contained_statements_table_entry
*entry
)
466 BFD_ASSERT (len
== 8);
468 memset (entry
, 0, sizeof (bfd_sym_contained_statements_table_entry
));
469 type
= bfd_getb16 (buf
);
473 case BFD_SYM_END_OF_LIST_3_2
:
474 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
477 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
478 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
479 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
483 entry
->entry
.mte_index
= type
;
484 entry
->entry
.mte_offset
= bfd_getb16 (buf
+ 2);
485 entry
->entry
.file_delta
= bfd_getb32 (buf
+ 4);
491 bfd_sym_parse_contained_labels_table_entry_v32 (unsigned char *buf
,
493 bfd_sym_contained_labels_table_entry
*entry
)
497 BFD_ASSERT (len
== 12);
499 memset (entry
, 0, sizeof (bfd_sym_contained_labels_table_entry
));
500 type
= bfd_getb16 (buf
);
504 case BFD_SYM_END_OF_LIST_3_2
:
505 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
508 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
509 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
510 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
514 entry
->entry
.mte_index
= type
;
515 entry
->entry
.mte_offset
= bfd_getb16 (buf
+ 2);
516 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 4);
517 entry
->entry
.file_delta
= bfd_getb16 (buf
+ 8);
518 entry
->entry
.scope
= bfd_getb16 (buf
+ 10);
524 bfd_sym_parse_type_table_entry_v32 (unsigned char *buf
,
526 bfd_sym_type_table_entry
*entry
)
528 BFD_ASSERT (len
== 4);
530 *entry
= bfd_getb32 (buf
);
534 bfd_sym_fetch_resources_table_entry (bfd
*abfd
,
535 bfd_sym_resources_table_entry
*entry
,
536 unsigned long sym_index
)
538 void (*parser
) (unsigned char *, size_t, bfd_sym_resources_table_entry
*);
539 unsigned long offset
;
540 unsigned long entry_size
;
541 unsigned char buf
[18];
542 bfd_sym_data_struct
*sdata
= NULL
;
545 BFD_ASSERT (bfd_sym_valid (abfd
));
546 sdata
= abfd
->tdata
.sym_data
;
551 switch (sdata
->version
)
553 case BFD_SYM_VERSION_3_5
:
554 case BFD_SYM_VERSION_3_4
:
557 case BFD_SYM_VERSION_3_3
:
558 case BFD_SYM_VERSION_3_2
:
560 parser
= bfd_sym_parse_resources_table_entry_v32
;
563 case BFD_SYM_VERSION_3_1
:
570 offset
= compute_offset (sdata
->header
.dshb_rte
.dti_first_page
,
571 sdata
->header
.dshb_page_size
,
572 entry_size
, sym_index
);
574 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
576 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
579 (*parser
) (buf
, entry_size
, entry
);
585 bfd_sym_fetch_modules_table_entry (bfd
*abfd
,
586 bfd_sym_modules_table_entry
*entry
,
587 unsigned long sym_index
)
589 void (*parser
) (unsigned char *, size_t, bfd_sym_modules_table_entry
*);
590 unsigned long offset
;
591 unsigned long entry_size
;
592 unsigned char buf
[46];
593 bfd_sym_data_struct
*sdata
= NULL
;
596 BFD_ASSERT (bfd_sym_valid (abfd
));
597 sdata
= abfd
->tdata
.sym_data
;
602 switch (sdata
->version
)
604 case BFD_SYM_VERSION_3_5
:
605 case BFD_SYM_VERSION_3_4
:
608 case BFD_SYM_VERSION_3_3
:
610 parser
= bfd_sym_parse_modules_table_entry_v33
;
613 case BFD_SYM_VERSION_3_2
:
614 case BFD_SYM_VERSION_3_1
:
621 offset
= compute_offset (sdata
->header
.dshb_mte
.dti_first_page
,
622 sdata
->header
.dshb_page_size
,
623 entry_size
, sym_index
);
625 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
627 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
630 (*parser
) (buf
, entry_size
, entry
);
636 bfd_sym_fetch_file_references_table_entry (bfd
*abfd
,
637 bfd_sym_file_references_table_entry
*entry
,
638 unsigned long sym_index
)
640 void (*parser
) (unsigned char *, size_t, bfd_sym_file_references_table_entry
*);
641 unsigned long offset
;
642 unsigned long entry_size
= 0;
643 unsigned char buf
[8];
644 bfd_sym_data_struct
*sdata
= NULL
;
647 BFD_ASSERT (bfd_sym_valid (abfd
));
648 sdata
= abfd
->tdata
.sym_data
;
653 switch (sdata
->version
)
655 case BFD_SYM_VERSION_3_3
:
656 case BFD_SYM_VERSION_3_2
:
658 parser
= bfd_sym_parse_file_references_table_entry_v32
;
661 case BFD_SYM_VERSION_3_5
:
662 case BFD_SYM_VERSION_3_4
:
663 case BFD_SYM_VERSION_3_1
:
671 offset
= compute_offset (sdata
->header
.dshb_frte
.dti_first_page
,
672 sdata
->header
.dshb_page_size
,
673 entry_size
, sym_index
);
675 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
677 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
680 (*parser
) (buf
, entry_size
, entry
);
686 bfd_sym_fetch_contained_modules_table_entry (bfd
*abfd
,
687 bfd_sym_contained_modules_table_entry
*entry
,
688 unsigned long sym_index
)
690 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_modules_table_entry
*);
691 unsigned long offset
;
692 unsigned long entry_size
= 0;
693 unsigned char buf
[6];
694 bfd_sym_data_struct
*sdata
= NULL
;
697 BFD_ASSERT (bfd_sym_valid (abfd
));
698 sdata
= abfd
->tdata
.sym_data
;
703 switch (sdata
->version
)
705 case BFD_SYM_VERSION_3_3
:
706 case BFD_SYM_VERSION_3_2
:
708 parser
= bfd_sym_parse_contained_modules_table_entry_v32
;
711 case BFD_SYM_VERSION_3_5
:
712 case BFD_SYM_VERSION_3_4
:
713 case BFD_SYM_VERSION_3_1
:
721 offset
= compute_offset (sdata
->header
.dshb_cmte
.dti_first_page
,
722 sdata
->header
.dshb_page_size
,
723 entry_size
, sym_index
);
725 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
727 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
730 (*parser
) (buf
, entry_size
, entry
);
736 bfd_sym_fetch_contained_variables_table_entry (bfd
*abfd
,
737 bfd_sym_contained_variables_table_entry
*entry
,
738 unsigned long sym_index
)
740 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_variables_table_entry
*);
741 unsigned long offset
;
742 unsigned long entry_size
= 0;
743 unsigned char buf
[26];
744 bfd_sym_data_struct
*sdata
= NULL
;
747 BFD_ASSERT (bfd_sym_valid (abfd
));
748 sdata
= abfd
->tdata
.sym_data
;
753 switch (sdata
->version
)
755 case BFD_SYM_VERSION_3_3
:
756 case BFD_SYM_VERSION_3_2
:
758 parser
= bfd_sym_parse_contained_variables_table_entry_v32
;
761 case BFD_SYM_VERSION_3_5
:
762 case BFD_SYM_VERSION_3_4
:
763 case BFD_SYM_VERSION_3_1
:
771 offset
= compute_offset (sdata
->header
.dshb_cvte
.dti_first_page
,
772 sdata
->header
.dshb_page_size
,
773 entry_size
, sym_index
);
775 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
777 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
780 (*parser
) (buf
, entry_size
, entry
);
786 bfd_sym_fetch_contained_statements_table_entry (bfd
*abfd
,
787 bfd_sym_contained_statements_table_entry
*entry
,
788 unsigned long sym_index
)
790 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_statements_table_entry
*);
791 unsigned long offset
;
792 unsigned long entry_size
= 0;
793 unsigned char buf
[8];
794 bfd_sym_data_struct
*sdata
= NULL
;
797 BFD_ASSERT (bfd_sym_valid (abfd
));
798 sdata
= abfd
->tdata
.sym_data
;
803 switch (sdata
->version
)
805 case BFD_SYM_VERSION_3_3
:
806 case BFD_SYM_VERSION_3_2
:
808 parser
= bfd_sym_parse_contained_statements_table_entry_v32
;
811 case BFD_SYM_VERSION_3_5
:
812 case BFD_SYM_VERSION_3_4
:
813 case BFD_SYM_VERSION_3_1
:
821 offset
= compute_offset (sdata
->header
.dshb_csnte
.dti_first_page
,
822 sdata
->header
.dshb_page_size
,
823 entry_size
, sym_index
);
825 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
827 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
830 (*parser
) (buf
, entry_size
, entry
);
836 bfd_sym_fetch_contained_labels_table_entry (bfd
*abfd
,
837 bfd_sym_contained_labels_table_entry
*entry
,
838 unsigned long sym_index
)
840 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_labels_table_entry
*);
841 unsigned long offset
;
842 unsigned long entry_size
= 0;
843 unsigned char buf
[12];
844 bfd_sym_data_struct
*sdata
= NULL
;
847 BFD_ASSERT (bfd_sym_valid (abfd
));
848 sdata
= abfd
->tdata
.sym_data
;
853 switch (sdata
->version
)
855 case BFD_SYM_VERSION_3_3
:
856 case BFD_SYM_VERSION_3_2
:
858 parser
= bfd_sym_parse_contained_labels_table_entry_v32
;
861 case BFD_SYM_VERSION_3_5
:
862 case BFD_SYM_VERSION_3_4
:
863 case BFD_SYM_VERSION_3_1
:
871 offset
= compute_offset (sdata
->header
.dshb_clte
.dti_first_page
,
872 sdata
->header
.dshb_page_size
,
873 entry_size
, sym_index
);
875 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
877 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
880 (*parser
) (buf
, entry_size
, entry
);
886 bfd_sym_fetch_contained_types_table_entry (bfd
*abfd
,
887 bfd_sym_contained_types_table_entry
*entry
,
888 unsigned long sym_index
)
890 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_types_table_entry
*);
891 unsigned long offset
;
892 unsigned long entry_size
= 0;
893 unsigned char buf
[0];
894 bfd_sym_data_struct
*sdata
= NULL
;
897 BFD_ASSERT (bfd_sym_valid (abfd
));
898 sdata
= abfd
->tdata
.sym_data
;
903 switch (sdata
->version
)
905 case BFD_SYM_VERSION_3_3
:
906 case BFD_SYM_VERSION_3_2
:
911 case BFD_SYM_VERSION_3_5
:
912 case BFD_SYM_VERSION_3_4
:
913 case BFD_SYM_VERSION_3_1
:
921 offset
= compute_offset (sdata
->header
.dshb_ctte
.dti_first_page
,
922 sdata
->header
.dshb_page_size
,
923 entry_size
, sym_index
);
925 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
927 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
930 (*parser
) (buf
, entry_size
, entry
);
936 bfd_sym_fetch_file_references_index_table_entry (bfd
*abfd
,
937 bfd_sym_file_references_index_table_entry
*entry
,
938 unsigned long sym_index
)
940 void (*parser
) (unsigned char *, size_t, bfd_sym_file_references_index_table_entry
*);
941 unsigned long offset
;
942 unsigned long entry_size
= 0;
943 unsigned char buf
[0];
944 bfd_sym_data_struct
*sdata
= NULL
;
947 BFD_ASSERT (bfd_sym_valid (abfd
));
948 sdata
= abfd
->tdata
.sym_data
;
953 switch (sdata
->version
)
955 case BFD_SYM_VERSION_3_3
:
956 case BFD_SYM_VERSION_3_2
:
961 case BFD_SYM_VERSION_3_5
:
962 case BFD_SYM_VERSION_3_4
:
963 case BFD_SYM_VERSION_3_1
:
971 offset
= compute_offset (sdata
->header
.dshb_fite
.dti_first_page
,
972 sdata
->header
.dshb_page_size
,
973 entry_size
, sym_index
);
975 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
977 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
980 (*parser
) (buf
, entry_size
, entry
);
986 bfd_sym_fetch_constant_pool_entry (bfd
*abfd
,
987 bfd_sym_constant_pool_entry
*entry
,
988 unsigned long sym_index
)
990 void (*parser
) (unsigned char *, size_t, bfd_sym_constant_pool_entry
*);
991 unsigned long offset
;
992 unsigned long entry_size
= 0;
993 unsigned char buf
[0];
994 bfd_sym_data_struct
*sdata
= NULL
;
997 BFD_ASSERT (bfd_sym_valid (abfd
));
998 sdata
= abfd
->tdata
.sym_data
;
1003 switch (sdata
->version
)
1005 case BFD_SYM_VERSION_3_3
:
1006 case BFD_SYM_VERSION_3_2
:
1011 case BFD_SYM_VERSION_3_5
:
1012 case BFD_SYM_VERSION_3_4
:
1013 case BFD_SYM_VERSION_3_1
:
1021 offset
= compute_offset (sdata
->header
.dshb_fite
.dti_first_page
,
1022 sdata
->header
.dshb_page_size
,
1023 entry_size
, sym_index
);
1025 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1027 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1030 (*parser
) (buf
, entry_size
, entry
);
1036 bfd_sym_fetch_type_table_entry (bfd
*abfd
,
1037 bfd_sym_type_table_entry
*entry
,
1038 unsigned long sym_index
)
1040 void (*parser
) (unsigned char *, size_t, bfd_sym_type_table_entry
*);
1041 unsigned long offset
;
1042 unsigned long entry_size
= 0;
1043 unsigned char buf
[4];
1044 bfd_sym_data_struct
*sdata
= NULL
;
1047 BFD_ASSERT (bfd_sym_valid (abfd
));
1048 sdata
= abfd
->tdata
.sym_data
;
1050 switch (sdata
->version
)
1052 case BFD_SYM_VERSION_3_3
:
1053 case BFD_SYM_VERSION_3_2
:
1055 parser
= bfd_sym_parse_type_table_entry_v32
;
1058 case BFD_SYM_VERSION_3_5
:
1059 case BFD_SYM_VERSION_3_4
:
1060 case BFD_SYM_VERSION_3_1
:
1068 offset
= compute_offset (sdata
->header
.dshb_tte
.dti_first_page
,
1069 sdata
->header
.dshb_page_size
,
1070 entry_size
, sym_index
);
1072 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1074 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1077 (*parser
) (buf
, entry_size
, entry
);
1083 bfd_sym_fetch_type_information_table_entry (bfd
*abfd
,
1084 bfd_sym_type_information_table_entry
*entry
,
1085 unsigned long offset
)
1087 unsigned char buf
[4];
1089 BFD_ASSERT (bfd_sym_valid (abfd
));
1094 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1097 if (bfd_bread (buf
, 4, abfd
) != 4)
1099 entry
->nte_index
= bfd_getb32 (buf
);
1101 if (bfd_bread (buf
, 2, abfd
) != 2)
1103 entry
->physical_size
= bfd_getb16 (buf
);
1105 if (entry
->physical_size
& 0x8000)
1107 if (bfd_bread (buf
, 4, abfd
) != 4)
1109 entry
->physical_size
&= 0x7fff;
1110 entry
->logical_size
= bfd_getb32 (buf
);
1111 entry
->offset
= offset
+ 10;
1115 if (bfd_bread (buf
, 2, abfd
) != 2)
1117 entry
->physical_size
&= 0x7fff;
1118 entry
->logical_size
= bfd_getb16 (buf
);
1119 entry
->offset
= offset
+ 8;
1126 bfd_sym_fetch_type_table_information (bfd
*abfd
,
1127 bfd_sym_type_information_table_entry
*entry
,
1128 unsigned long sym_index
)
1130 bfd_sym_type_table_entry tindex
;
1131 bfd_sym_data_struct
*sdata
= NULL
;
1133 BFD_ASSERT (bfd_sym_valid (abfd
));
1134 sdata
= abfd
->tdata
.sym_data
;
1136 if (sdata
->header
.dshb_tte
.dti_object_count
<= 99)
1138 if (sym_index
< 100)
1141 if (bfd_sym_fetch_type_table_entry (abfd
, &tindex
, sym_index
- 100) < 0)
1143 if (bfd_sym_fetch_type_information_table_entry (abfd
, entry
, tindex
) < 0)
1149 const unsigned char *
1150 bfd_sym_symbol_name (bfd
*abfd
, unsigned long sym_index
)
1152 bfd_sym_data_struct
*sdata
= NULL
;
1154 BFD_ASSERT (bfd_sym_valid (abfd
));
1155 sdata
= abfd
->tdata
.sym_data
;
1158 return (const unsigned char *) "";
1161 if ((sym_index
/ sdata
->header
.dshb_page_size
)
1162 > sdata
->header
.dshb_nte
.dti_page_count
)
1163 return (const unsigned char *) "\09[INVALID]";
1165 return (const unsigned char *) sdata
->name_table
+ sym_index
;
1168 const unsigned char *
1169 bfd_sym_module_name (bfd
*abfd
, unsigned long sym_index
)
1171 bfd_sym_modules_table_entry entry
;
1173 if (bfd_sym_fetch_modules_table_entry (abfd
, &entry
, sym_index
) < 0)
1174 return (const unsigned char *) "\09[INVALID]";
1176 return bfd_sym_symbol_name (abfd
, entry
.mte_nte_index
);
1180 bfd_sym_unparse_storage_kind (enum bfd_sym_storage_kind kind
)
1184 case BFD_SYM_STORAGE_KIND_LOCAL
: return "LOCAL";
1185 case BFD_SYM_STORAGE_KIND_VALUE
: return "VALUE";
1186 case BFD_SYM_STORAGE_KIND_REFERENCE
: return "REFERENCE";
1187 case BFD_SYM_STORAGE_KIND_WITH
: return "WITH";
1188 default: return "[UNKNOWN]";
1193 bfd_sym_unparse_storage_class (enum bfd_sym_storage_class kind
)
1197 case BFD_SYM_STORAGE_CLASS_REGISTER
: return "REGISTER";
1198 case BFD_SYM_STORAGE_CLASS_GLOBAL
: return "GLOBAL";
1199 case BFD_SYM_STORAGE_CLASS_FRAME_RELATIVE
: return "FRAME_RELATIVE";
1200 case BFD_SYM_STORAGE_CLASS_STACK_RELATIVE
: return "STACK_RELATIVE";
1201 case BFD_SYM_STORAGE_CLASS_ABSOLUTE
: return "ABSOLUTE";
1202 case BFD_SYM_STORAGE_CLASS_CONSTANT
: return "CONSTANT";
1203 case BFD_SYM_STORAGE_CLASS_RESOURCE
: return "RESOURCE";
1204 case BFD_SYM_STORAGE_CLASS_BIGCONSTANT
: return "BIGCONSTANT";
1205 default: return "[UNKNOWN]";
1210 bfd_sym_unparse_module_kind (enum bfd_sym_module_kind kind
)
1214 case BFD_SYM_MODULE_KIND_NONE
: return "NONE";
1215 case BFD_SYM_MODULE_KIND_PROGRAM
: return "PROGRAM";
1216 case BFD_SYM_MODULE_KIND_UNIT
: return "UNIT";
1217 case BFD_SYM_MODULE_KIND_PROCEDURE
: return "PROCEDURE";
1218 case BFD_SYM_MODULE_KIND_FUNCTION
: return "FUNCTION";
1219 case BFD_SYM_MODULE_KIND_DATA
: return "DATA";
1220 case BFD_SYM_MODULE_KIND_BLOCK
: return "BLOCK";
1221 default: return "[UNKNOWN]";
1226 bfd_sym_unparse_symbol_scope (enum bfd_sym_symbol_scope scope
)
1230 case BFD_SYM_SYMBOL_SCOPE_LOCAL
: return "LOCAL";
1231 case BFD_SYM_SYMBOL_SCOPE_GLOBAL
: return "GLOBAL";
1238 bfd_sym_print_file_reference (bfd
*abfd
,
1240 bfd_sym_file_reference
*entry
)
1242 bfd_sym_file_references_table_entry frtentry
;
1245 ret
= bfd_sym_fetch_file_references_table_entry (abfd
, &frtentry
,
1246 entry
->fref_frte_index
);
1247 fprintf (f
, "FILE ");
1249 if ((ret
< 0) || (frtentry
.generic
.type
!= BFD_SYM_FILE_NAME_INDEX
))
1250 fprintf (f
, "[INVALID]");
1252 fprintf (f
, "\"%.*s\"",
1253 bfd_sym_symbol_name (abfd
, frtentry
.filename
.nte_index
)[0],
1254 &bfd_sym_symbol_name (abfd
, frtentry
.filename
.nte_index
)[1]);
1256 fprintf (f
, " (FRTE %lu)", entry
->fref_frte_index
);
1260 bfd_sym_print_resources_table_entry (bfd
*abfd
,
1262 bfd_sym_resources_table_entry
*entry
)
1264 fprintf (f
, " \"%.*s\" (NTE %lu), type \"%.4s\", num %u, size %lu, MTE %lu -- %lu",
1265 bfd_sym_symbol_name (abfd
, entry
->rte_nte_index
)[0],
1266 &bfd_sym_symbol_name (abfd
, entry
->rte_nte_index
)[1],
1267 entry
->rte_nte_index
, entry
->rte_res_type
, entry
->rte_res_number
,
1268 entry
->rte_res_size
, entry
->rte_mte_first
, entry
->rte_mte_last
);
1272 bfd_sym_print_modules_table_entry (bfd
*abfd
,
1274 bfd_sym_modules_table_entry
*entry
)
1276 fprintf (f
, "\"%.*s\" (NTE %lu)",
1277 bfd_sym_symbol_name (abfd
, entry
->mte_nte_index
)[0],
1278 &bfd_sym_symbol_name (abfd
, entry
->mte_nte_index
)[1],
1279 entry
->mte_nte_index
);
1283 bfd_sym_print_file_reference (abfd
, f
, &entry
->mte_imp_fref
);
1284 fprintf (f
, " range %lu -- %lu",
1285 entry
->mte_imp_fref
.fref_offset
, entry
->mte_imp_end
);
1289 fprintf (f
, "kind %s", bfd_sym_unparse_module_kind (entry
->mte_kind
));
1290 fprintf (f
, ", scope %s", bfd_sym_unparse_symbol_scope (entry
->mte_scope
));
1292 fprintf (f
, ", RTE %lu, offset %lu, size %lu",
1293 entry
->mte_rte_index
, entry
->mte_res_offset
, entry
->mte_size
);
1297 fprintf (f
, "CMTE %lu, CVTE %lu, CLTE %lu, CTTE %lu, CSNTE1 %lu, CSNTE2 %lu",
1298 entry
->mte_cmte_index
, entry
->mte_cvte_index
,
1299 entry
->mte_clte_index
, entry
->mte_ctte_index
,
1300 entry
->mte_csnte_idx_1
, entry
->mte_csnte_idx_2
);
1302 if (entry
->mte_parent
!= 0)
1303 fprintf (f
, ", parent %lu", entry
->mte_parent
);
1305 fprintf (f
, ", no parent");
1307 if (entry
->mte_cmte_index
!= 0)
1308 fprintf (f
, ", child %lu", entry
->mte_cmte_index
);
1310 fprintf (f
, ", no child");
1314 bfd_sym_print_file_references_table_entry (bfd
*abfd
,
1316 bfd_sym_file_references_table_entry
*entry
)
1318 switch (entry
->generic
.type
)
1320 case BFD_SYM_FILE_NAME_INDEX
:
1321 fprintf (f
, "FILE \"%.*s\" (NTE %lu), modtime ",
1322 bfd_sym_symbol_name (abfd
, entry
->filename
.nte_index
)[0],
1323 &bfd_sym_symbol_name (abfd
, entry
->filename
.nte_index
)[1],
1324 entry
->filename
.nte_index
);
1326 fprintf (f
, "[UNIMPLEMENTED]");
1327 /* printModDate (entry->filename.mod_date); */
1328 fprintf (f
, " (0x%lx)", entry
->filename
.mod_date
);
1331 case BFD_SYM_END_OF_LIST
:
1336 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu",
1337 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1338 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1339 entry
->entry
.mte_index
,
1340 entry
->entry
.file_offset
);
1346 bfd_sym_print_contained_modules_table_entry (bfd
*abfd
,
1348 bfd_sym_contained_modules_table_entry
*entry
)
1350 switch (entry
->generic
.type
)
1352 case BFD_SYM_END_OF_LIST
:
1357 fprintf (f
, "\"%.*s\" (MTE %lu, NTE %lu)",
1358 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1359 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1360 entry
->entry
.mte_index
,
1361 entry
->entry
.nte_index
);
1367 bfd_sym_print_contained_variables_table_entry (bfd
*abfd
,
1369 bfd_sym_contained_variables_table_entry
*entry
)
1371 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1377 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1379 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1380 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1384 fprintf (f
, "\"%.*s\" (NTE %lu)",
1385 bfd_sym_symbol_name (abfd
, entry
->entry
.nte_index
)[0],
1386 &bfd_sym_symbol_name (abfd
, entry
->entry
.nte_index
)[1],
1387 entry
->entry
.nte_index
);
1389 fprintf (f
, ", TTE %lu", entry
->entry
.tte_index
);
1390 fprintf (f
, ", offset %lu", entry
->entry
.file_delta
);
1391 fprintf (f
, ", scope %s", bfd_sym_unparse_symbol_scope (entry
->entry
.scope
));
1393 if (entry
->entry
.la_size
== BFD_SYM_CVTE_SCA
)
1394 fprintf (f
, ", latype %s, laclass %s, laoffset %lu",
1395 bfd_sym_unparse_storage_kind (entry
->entry
.address
.scstruct
.sca_kind
),
1396 bfd_sym_unparse_storage_class (entry
->entry
.address
.scstruct
.sca_class
),
1397 entry
->entry
.address
.scstruct
.sca_offset
);
1398 else if (entry
->entry
.la_size
<= BFD_SYM_CVTE_LA_MAX_SIZE
)
1402 fprintf (f
, ", la [");
1403 for (i
= 0; i
< entry
->entry
.la_size
; i
++)
1404 fprintf (f
, "0x%02x ", entry
->entry
.address
.lastruct
.la
[i
]);
1407 else if (entry
->entry
.la_size
== BFD_SYM_CVTE_BIG_LA
)
1408 fprintf (f
, ", bigla %lu, biglakind %u",
1409 entry
->entry
.address
.biglastruct
.big_la
,
1410 entry
->entry
.address
.biglastruct
.big_la_kind
);
1413 fprintf (f
, ", la [INVALID]");
1417 bfd_sym_print_contained_statements_table_entry (bfd
*abfd
,
1419 bfd_sym_contained_statements_table_entry
*entry
)
1421 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1427 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1429 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1430 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1434 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu, delta %lu",
1435 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1436 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1437 entry
->entry
.mte_index
,
1438 entry
->entry
.mte_offset
,
1439 entry
->entry
.file_delta
);
1443 bfd_sym_print_contained_labels_table_entry (bfd
*abfd
,
1445 bfd_sym_contained_labels_table_entry
*entry
)
1447 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1453 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1455 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1456 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1460 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu, delta %lu, scope %s",
1461 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1462 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1463 entry
->entry
.mte_index
,
1464 entry
->entry
.mte_offset
,
1465 entry
->entry
.file_delta
,
1466 bfd_sym_unparse_symbol_scope (entry
->entry
.scope
));
1470 bfd_sym_print_contained_types_table_entry (bfd
*abfd ATTRIBUTE_UNUSED
,
1472 bfd_sym_contained_types_table_entry
*entry ATTRIBUTE_UNUSED
)
1474 fprintf (f
, "[UNIMPLEMENTED]");
1478 bfd_sym_type_operator_name (unsigned char num
)
1482 case 1: return "TTE";
1483 case 2: return "PointerTo";
1484 case 3: return "ScalarOf";
1485 case 4: return "ConstantOf";
1486 case 5: return "EnumerationOf";
1487 case 6: return "VectorOf";
1488 case 7: return "RecordOf";
1489 case 8: return "UnionOf";
1490 case 9: return "SubRangeOf";
1491 case 10: return "SetOf";
1492 case 11: return "NamedTypeOf";
1493 case 12: return "ProcOf";
1494 case 13: return "ValueOf";
1495 case 14: return "ArrayOf";
1496 default: return "[UNKNOWN OPERATOR]";
1501 bfd_sym_type_basic_name (unsigned char num
)
1505 case 0: return "void";
1506 case 1: return "pascal string";
1507 case 2: return "unsigned long";
1508 case 3: return "signed long";
1509 case 4: return "extended (10 bytes)";
1510 case 5: return "pascal boolean (1 byte)";
1511 case 6: return "unsigned byte";
1512 case 7: return "signed byte";
1513 case 8: return "character (1 byte)";
1514 case 9: return "wide character (2 bytes)";
1515 case 10: return "unsigned short";
1516 case 11: return "signed short";
1517 case 12: return "singled";
1518 case 13: return "double";
1519 case 14: return "extended (12 bytes)";
1520 case 15: return "computational (8 bytes)";
1521 case 16: return "c string";
1522 case 17: return "as-is string";
1523 default: return "[UNKNOWN BASIC TYPE]";
1528 bfd_sym_fetch_long (unsigned char *buf
,
1530 unsigned long offset
,
1531 unsigned long *offsetptr
,
1542 else if (! (buf
[offset
] & 0x80))
1544 *value
= buf
[offset
];
1548 else if (buf
[offset
] == 0xc0)
1550 if ((offset
+ 5) > len
)
1558 *value
= bfd_getb32 (buf
+ offset
+ 1);
1563 else if ((buf
[offset
] & 0xc0) == 0xc0)
1565 *value
= -(buf
[offset
] & 0x3f);
1569 else if ((buf
[offset
] & 0xc0) == 0x80)
1571 if ((offset
+ 2) > len
)
1579 *value
= bfd_getb16 (buf
+ offset
) & 0x3fff;
1587 if (offsetptr
!= NULL
)
1588 *offsetptr
= offset
;
1594 bfd_sym_print_type_information (bfd
*abfd
,
1598 unsigned long offset
,
1599 unsigned long *offsetptr
)
1605 fprintf (f
, "[NULL]");
1607 if (offsetptr
!= NULL
)
1608 *offsetptr
= offset
;
1615 if (! (type
& 0x80))
1617 fprintf (f
, "[%s] (0x%x)", bfd_sym_type_basic_name (type
& 0x7f), type
);
1619 if (offsetptr
!= NULL
)
1620 *offsetptr
= offset
;
1625 fprintf (f
, "[packed ");
1629 switch (type
& 0x3f)
1634 bfd_sym_type_information_table_entry tinfo
;
1636 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1638 fprintf (f
, "[INVALID]");
1641 if (bfd_sym_fetch_type_table_information (abfd
, &tinfo
, value
) < 0)
1642 fprintf (f
, "[INVALID]");
1644 fprintf (f
, "\"%.*s\"",
1645 bfd_sym_symbol_name (abfd
, tinfo
.nte_index
)[0],
1646 &bfd_sym_symbol_name (abfd
, tinfo
.nte_index
)[1]);
1648 fprintf (f
, " (TTE %lu)", (unsigned long) value
);
1653 fprintf (f
, "pointer (0x%x) to ", type
);
1654 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1661 fprintf (f
, "scalar (0x%x) of ", type
);
1662 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1663 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1664 fprintf (f
, " (%lu)", (unsigned long) value
);
1670 long lower
, upper
, nelem
;
1673 fprintf (f
, "enumeration (0x%x) of ", type
);
1674 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1675 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &lower
);
1676 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &upper
);
1677 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &nelem
);
1678 fprintf (f
, " from %lu to %lu with %lu elements: ",
1679 (unsigned long) lower
, (unsigned long) upper
,
1680 (unsigned long) nelem
);
1682 for (i
= 0; i
< nelem
; i
++)
1685 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1691 fprintf (f
, "vector (0x%x)", type
);
1692 fprintf (f
, "\n index ");
1693 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1694 fprintf (f
, "\n target ");
1695 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1701 long nrec
, eloff
, i
;
1703 if ((type
& 0x3f) == 7)
1704 fprintf (f
, "record (0x%x) of ", type
);
1706 fprintf (f
, "union (0x%x) of ", type
);
1708 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &nrec
);
1709 fprintf (f
, "%lu elements: ", (unsigned long) nrec
);
1711 for (i
= 0; i
< nrec
; i
++)
1713 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &eloff
);
1715 fprintf (f
, "offset %lu: ", (unsigned long) eloff
);
1716 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1722 fprintf (f
, "subrange (0x%x) of ", type
);
1723 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1724 fprintf (f
, " lower ");
1725 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1726 fprintf (f
, " upper ");
1727 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1734 fprintf (f
, "named type (0x%x) ", type
);
1735 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1737 fprintf (f
, "[INVALID]");
1739 fprintf (f
, "\"%.*s\"",
1740 bfd_sym_symbol_name (abfd
, value
)[0],
1741 &bfd_sym_symbol_name (abfd
, value
)[1]);
1743 fprintf (f
, " (NTE %lu) with type ", (unsigned long) value
);
1744 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1749 fprintf (f
, "%s (0x%x)", bfd_sym_type_operator_name (type
), type
);
1753 if (type
== (0x40 | 0x6))
1760 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &n
);
1761 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &width
);
1762 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &m
);
1763 /* fprintf (f, "\n "); */
1764 fprintf (f
, " N %ld, width %ld, M %ld, ", n
, width
, m
);
1765 for (i
= 0; i
< m
; i
++)
1767 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &l
);
1770 fprintf (f
, "%ld", l
);
1773 else if (type
& 0x40)
1775 /* Other packed type. */
1778 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &msb
);
1779 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &lsb
);
1780 /* fprintf (f, "\n "); */
1781 fprintf (f
, " msb %ld, lsb %ld", msb
, lsb
);
1786 if (offsetptr
!= NULL
)
1787 *offsetptr
= offset
;
1791 bfd_sym_print_type_information_table_entry (bfd
*abfd
,
1793 bfd_sym_type_information_table_entry
*entry
)
1796 unsigned long offset
;
1799 fprintf (f
, "\"%.*s\" (NTE %lu), %lu bytes at %lu, logical size %lu",
1800 bfd_sym_symbol_name (abfd
, entry
->nte_index
)[0],
1801 &bfd_sym_symbol_name (abfd
, entry
->nte_index
)[1],
1803 entry
->physical_size
, entry
->offset
, entry
->logical_size
);
1807 buf
= alloca (entry
->physical_size
);
1810 fprintf (f
, "[ERROR]\n");
1813 if (bfd_seek (abfd
, entry
->offset
, SEEK_SET
) < 0)
1815 fprintf (f
, "[ERROR]\n");
1818 if (bfd_bread (buf
, entry
->physical_size
, abfd
) != entry
->physical_size
)
1820 fprintf (f
, "[ERROR]\n");
1825 for (i
= 0; i
< entry
->physical_size
; i
++)
1828 fprintf (f
, "0x%02x", buf
[i
]);
1830 fprintf (f
, " 0x%02x", buf
[i
]);
1836 bfd_sym_print_type_information (abfd
, f
, buf
, entry
->physical_size
, 0, &offset
);
1838 if (offset
!= entry
->physical_size
)
1839 fprintf (f
, "\n [parser used %lu bytes instead of %lu]", offset
, entry
->physical_size
);
1843 bfd_sym_print_file_references_index_table_entry (bfd
*abfd ATTRIBUTE_UNUSED
,
1845 bfd_sym_file_references_index_table_entry
*entry ATTRIBUTE_UNUSED
)
1847 fprintf (f
, "[UNIMPLEMENTED]");
1851 bfd_sym_print_constant_pool_entry (bfd
*abfd ATTRIBUTE_UNUSED
,
1853 bfd_sym_constant_pool_entry
*entry ATTRIBUTE_UNUSED
)
1855 fprintf (f
, "[UNIMPLEMENTED]");
1859 bfd_sym_display_name_table_entry (bfd
*abfd
,
1861 unsigned char *entry
)
1863 unsigned long sym_index
;
1864 unsigned long offset
;
1865 bfd_sym_data_struct
*sdata
= NULL
;
1867 BFD_ASSERT (bfd_sym_valid (abfd
));
1868 sdata
= abfd
->tdata
.sym_data
;
1869 sym_index
= (entry
- sdata
->name_table
) / 2;
1871 if (sdata
->version
>= BFD_SYM_VERSION_3_4
&& entry
[0] == 255 && entry
[1] == 0)
1873 unsigned short length
= bfd_getb16 (entry
+ 2);
1874 fprintf (f
, "[%8lu] \"%.*s\"\n", sym_index
, length
, entry
+ 4);
1875 offset
= 2 + length
+ 1;
1879 if (! (entry
[0] == 0 || (entry
[0] == 1 && entry
[1] == '\0')))
1880 fprintf (f
, "[%8lu] \"%.*s\"\n", sym_index
, entry
[0], entry
+ 1);
1882 if (sdata
->version
>= BFD_SYM_VERSION_3_4
)
1883 offset
= entry
[0] + 2;
1885 offset
= entry
[0] + 1;
1888 return (entry
+ offset
+ (offset
% 2));
1892 bfd_sym_display_name_table (bfd
*abfd
, FILE *f
)
1894 unsigned long name_table_len
;
1895 unsigned char *name_table
, *name_table_end
, *cur
;
1896 bfd_sym_data_struct
*sdata
= NULL
;
1898 BFD_ASSERT (bfd_sym_valid (abfd
));
1899 sdata
= abfd
->tdata
.sym_data
;
1901 name_table_len
= sdata
->header
.dshb_nte
.dti_page_count
* sdata
->header
.dshb_page_size
;
1902 name_table
= sdata
->name_table
;
1903 name_table_end
= name_table
+ name_table_len
;
1905 fprintf (f
, "name table (NTE) contains %lu bytes:\n\n", name_table_len
);
1910 cur
= bfd_sym_display_name_table_entry (abfd
, f
, cur
);
1911 if (cur
>= name_table_end
)
1917 bfd_sym_display_resources_table (bfd
*abfd
, FILE *f
)
1920 bfd_sym_resources_table_entry entry
;
1921 bfd_sym_data_struct
*sdata
= NULL
;
1923 BFD_ASSERT (bfd_sym_valid (abfd
));
1924 sdata
= abfd
->tdata
.sym_data
;
1926 fprintf (f
, "resource table (RTE) contains %lu objects:\n\n",
1927 sdata
->header
.dshb_rte
.dti_object_count
);
1929 for (i
= 1; i
<= sdata
->header
.dshb_rte
.dti_object_count
; i
++)
1931 if (bfd_sym_fetch_resources_table_entry (abfd
, &entry
, i
) < 0)
1932 fprintf (f
, " [%8lu] [INVALID]\n", i
);
1935 fprintf (f
, " [%8lu] ", i
);
1936 bfd_sym_print_resources_table_entry (abfd
, f
, &entry
);
1943 bfd_sym_display_modules_table (bfd
*abfd
, FILE *f
)
1946 bfd_sym_modules_table_entry entry
;
1947 bfd_sym_data_struct
*sdata
= NULL
;
1949 BFD_ASSERT (bfd_sym_valid (abfd
));
1950 sdata
= abfd
->tdata
.sym_data
;
1952 fprintf (f
, "module table (MTE) contains %lu objects:\n\n",
1953 sdata
->header
.dshb_mte
.dti_object_count
);
1955 for (i
= 1; i
<= sdata
->header
.dshb_mte
.dti_object_count
; i
++)
1957 if (bfd_sym_fetch_modules_table_entry (abfd
, &entry
, i
) < 0)
1958 fprintf (f
, " [%8lu] [INVALID]\n", i
);
1961 fprintf (f
, " [%8lu] ", i
);
1962 bfd_sym_print_modules_table_entry (abfd
, f
, &entry
);
1969 bfd_sym_display_file_references_table (bfd
*abfd
, FILE *f
)
1972 bfd_sym_file_references_table_entry entry
;
1973 bfd_sym_data_struct
*sdata
= NULL
;
1975 BFD_ASSERT (bfd_sym_valid (abfd
));
1976 sdata
= abfd
->tdata
.sym_data
;
1978 fprintf (f
, "file reference table (FRTE) contains %lu objects:\n\n",
1979 sdata
->header
.dshb_frte
.dti_object_count
);
1981 for (i
= 1; i
<= sdata
->header
.dshb_frte
.dti_object_count
; i
++)
1983 if (bfd_sym_fetch_file_references_table_entry (abfd
, &entry
, i
) < 0)
1984 fprintf (f
, " [%8lu] [INVALID]\n", i
);
1987 fprintf (f
, " [%8lu] ", i
);
1988 bfd_sym_print_file_references_table_entry (abfd
, f
, &entry
);
1995 bfd_sym_display_contained_modules_table (bfd
*abfd
, FILE *f
)
1998 bfd_sym_contained_modules_table_entry entry
;
1999 bfd_sym_data_struct
*sdata
= NULL
;
2001 BFD_ASSERT (bfd_sym_valid (abfd
));
2002 sdata
= abfd
->tdata
.sym_data
;
2004 fprintf (f
, "contained modules table (CMTE) contains %lu objects:\n\n",
2005 sdata
->header
.dshb_cmte
.dti_object_count
);
2007 for (i
= 1; i
<= sdata
->header
.dshb_cmte
.dti_object_count
; i
++)
2009 if (bfd_sym_fetch_contained_modules_table_entry (abfd
, &entry
, i
) < 0)
2010 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2013 fprintf (f
, " [%8lu] ", i
);
2014 bfd_sym_print_contained_modules_table_entry (abfd
, f
, &entry
);
2021 bfd_sym_display_contained_variables_table (bfd
*abfd
, FILE *f
)
2024 bfd_sym_contained_variables_table_entry entry
;
2025 bfd_sym_data_struct
*sdata
= NULL
;
2027 BFD_ASSERT (bfd_sym_valid (abfd
));
2028 sdata
= abfd
->tdata
.sym_data
;
2030 fprintf (f
, "contained variables table (CVTE) contains %lu objects:\n\n",
2031 sdata
->header
.dshb_cvte
.dti_object_count
);
2033 for (i
= 1; i
<= sdata
->header
.dshb_cvte
.dti_object_count
; i
++)
2035 if (bfd_sym_fetch_contained_variables_table_entry (abfd
, &entry
, i
) < 0)
2036 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2039 fprintf (f
, " [%8lu] ", i
);
2040 bfd_sym_print_contained_variables_table_entry (abfd
, f
, &entry
);
2049 bfd_sym_display_contained_statements_table (bfd
*abfd
, FILE *f
)
2052 bfd_sym_contained_statements_table_entry entry
;
2053 bfd_sym_data_struct
*sdata
= NULL
;
2055 BFD_ASSERT (bfd_sym_valid (abfd
));
2056 sdata
= abfd
->tdata
.sym_data
;
2058 fprintf (f
, "contained statements table (CSNTE) contains %lu objects:\n\n",
2059 sdata
->header
.dshb_csnte
.dti_object_count
);
2061 for (i
= 1; i
<= sdata
->header
.dshb_csnte
.dti_object_count
; i
++)
2063 if (bfd_sym_fetch_contained_statements_table_entry (abfd
, &entry
, i
) < 0)
2064 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2067 fprintf (f
, " [%8lu] ", i
);
2068 bfd_sym_print_contained_statements_table_entry (abfd
, f
, &entry
);
2075 bfd_sym_display_contained_labels_table (bfd
*abfd
, FILE *f
)
2078 bfd_sym_contained_labels_table_entry entry
;
2079 bfd_sym_data_struct
*sdata
= NULL
;
2081 BFD_ASSERT (bfd_sym_valid (abfd
));
2082 sdata
= abfd
->tdata
.sym_data
;
2084 fprintf (f
, "contained labels table (CLTE) contains %lu objects:\n\n",
2085 sdata
->header
.dshb_clte
.dti_object_count
);
2087 for (i
= 1; i
<= sdata
->header
.dshb_clte
.dti_object_count
; i
++)
2089 if (bfd_sym_fetch_contained_labels_table_entry (abfd
, &entry
, i
) < 0)
2090 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2093 fprintf (f
, " [%8lu] ", i
);
2094 bfd_sym_print_contained_labels_table_entry (abfd
, f
, &entry
);
2101 bfd_sym_display_contained_types_table (bfd
*abfd
, FILE *f
)
2104 bfd_sym_contained_types_table_entry entry
;
2105 bfd_sym_data_struct
*sdata
= NULL
;
2107 BFD_ASSERT (bfd_sym_valid (abfd
));
2108 sdata
= abfd
->tdata
.sym_data
;
2110 fprintf (f
, "contained types table (CTTE) contains %lu objects:\n\n",
2111 sdata
->header
.dshb_ctte
.dti_object_count
);
2113 for (i
= 1; i
<= sdata
->header
.dshb_ctte
.dti_object_count
; i
++)
2115 if (bfd_sym_fetch_contained_types_table_entry (abfd
, &entry
, i
) < 0)
2116 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2119 fprintf (f
, " [%8lu] ", i
);
2120 bfd_sym_print_contained_types_table_entry (abfd
, f
, &entry
);
2127 bfd_sym_display_file_references_index_table (bfd
*abfd
, FILE *f
)
2130 bfd_sym_file_references_index_table_entry entry
;
2131 bfd_sym_data_struct
*sdata
= NULL
;
2133 BFD_ASSERT (bfd_sym_valid (abfd
));
2134 sdata
= abfd
->tdata
.sym_data
;
2136 fprintf (f
, "file references index table (FITE) contains %lu objects:\n\n",
2137 sdata
->header
.dshb_fite
.dti_object_count
);
2139 for (i
= 1; i
<= sdata
->header
.dshb_fite
.dti_object_count
; i
++)
2141 if (bfd_sym_fetch_file_references_index_table_entry (abfd
, &entry
, i
) < 0)
2142 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2145 fprintf (f
, " [%8lu] ", i
);
2146 bfd_sym_print_file_references_index_table_entry (abfd
, f
, &entry
);
2153 bfd_sym_display_constant_pool (bfd
*abfd
, FILE *f
)
2156 bfd_sym_constant_pool_entry entry
;
2157 bfd_sym_data_struct
*sdata
= NULL
;
2159 BFD_ASSERT (bfd_sym_valid (abfd
));
2160 sdata
= abfd
->tdata
.sym_data
;
2162 fprintf (f
, "constant pool (CONST) contains %lu objects:\n\n",
2163 sdata
->header
.dshb_const
.dti_object_count
);
2165 for (i
= 1; i
<= sdata
->header
.dshb_const
.dti_object_count
; i
++)
2167 if (bfd_sym_fetch_constant_pool_entry (abfd
, &entry
, i
) < 0)
2168 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2171 fprintf (f
, " [%8lu] ", i
);
2172 bfd_sym_print_constant_pool_entry (abfd
, f
, &entry
);
2179 bfd_sym_display_type_information_table (bfd
*abfd
, FILE *f
)
2182 bfd_sym_type_table_entry sym_index
;
2183 bfd_sym_type_information_table_entry entry
;
2184 bfd_sym_data_struct
*sdata
= NULL
;
2186 BFD_ASSERT (bfd_sym_valid (abfd
));
2187 sdata
= abfd
->tdata
.sym_data
;
2189 if (sdata
->header
.dshb_tte
.dti_object_count
> 99)
2190 fprintf (f
, "type table (TINFO) contains %lu objects:\n\n",
2191 sdata
->header
.dshb_tte
.dti_object_count
- 99);
2194 fprintf (f
, "type table (TINFO) contains [INVALID] objects:\n\n");
2198 for (i
= 100; i
<= sdata
->header
.dshb_tte
.dti_object_count
; i
++)
2200 if (bfd_sym_fetch_type_table_entry (abfd
, &sym_index
, i
- 100) < 0)
2201 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2204 fprintf (f
, " [%8lu] (TINFO %lu) ", i
, sym_index
);
2206 if (bfd_sym_fetch_type_information_table_entry (abfd
, &entry
, sym_index
) < 0)
2207 fprintf (f
, "[INVALID]");
2209 bfd_sym_print_type_information_table_entry (abfd
, f
, &entry
);
2217 bfd_sym_scan (bfd
*abfd
, bfd_sym_version version
, bfd_sym_data_struct
*mdata
)
2220 const char *name
= "symbols";
2222 mdata
->name_table
= 0;
2224 mdata
->version
= version
;
2226 bfd_seek (abfd
, 0, SEEK_SET
);
2227 if (bfd_sym_read_header (abfd
, &mdata
->header
, mdata
->version
) != 0)
2230 mdata
->name_table
= bfd_sym_read_name_table (abfd
, &mdata
->header
);
2231 if (mdata
->name_table
== NULL
)
2234 bfdsec
= bfd_make_section_anyway_with_flags (abfd
, name
, SEC_HAS_CONTENTS
);
2241 bfdsec
->filepos
= 0;
2242 bfdsec
->alignment_power
= 0;
2244 abfd
->tdata
.sym_data
= mdata
;
2250 bfd_sym_object_p (bfd
*abfd
)
2252 struct bfd_preserve preserve
;
2253 bfd_sym_version version
= -1;
2255 preserve
.marker
= NULL
;
2256 bfd_seek (abfd
, 0, SEEK_SET
);
2257 if (bfd_sym_read_version (abfd
, &version
) != 0)
2260 preserve
.marker
= bfd_alloc (abfd
, sizeof (bfd_sym_data_struct
));
2261 if (preserve
.marker
== NULL
2262 || ! bfd_preserve_save (abfd
, &preserve
))
2265 if (bfd_sym_scan (abfd
, version
,
2266 (bfd_sym_data_struct
*) preserve
.marker
) != 0)
2269 bfd_preserve_finish (abfd
, &preserve
);
2273 bfd_set_error (bfd_error_wrong_format
);
2276 if (preserve
.marker
!= NULL
)
2277 bfd_preserve_restore (abfd
, &preserve
);
2281 #define bfd_sym_make_empty_symbol _bfd_generic_make_empty_symbol
2284 bfd_sym_get_symbol_info (bfd
*abfd ATTRIBUTE_UNUSED
, asymbol
*symbol
, symbol_info
*ret
)
2286 bfd_symbol_info (symbol
, ret
);
2290 bfd_sym_get_symtab_upper_bound (bfd
*abfd ATTRIBUTE_UNUSED
)
2296 bfd_sym_canonicalize_symtab (bfd
*abfd ATTRIBUTE_UNUSED
, asymbol
**sym ATTRIBUTE_UNUSED
)
2302 bfd_sym_sizeof_headers (bfd
*abfd ATTRIBUTE_UNUSED
,
2303 struct bfd_link_info
*info ATTRIBUTE_UNUSED
)
2308 const bfd_target sym_vec
=
2311 bfd_target_sym_flavour
, /* Flavour. */
2312 BFD_ENDIAN_BIG
, /* Byteorder. */
2313 BFD_ENDIAN_BIG
, /* Header byteorder. */
2314 (HAS_RELOC
| EXEC_P
| /* Object flags. */
2315 HAS_LINENO
| HAS_DEBUG
|
2316 HAS_SYMS
| HAS_LOCALS
| DYNAMIC
| WP_TEXT
| D_PAGED
),
2317 (SEC_ALLOC
| SEC_LOAD
| SEC_READONLY
| SEC_CODE
| SEC_DATA
2318 | SEC_ROM
| SEC_HAS_CONTENTS
), /* Section_flags. */
2319 0, /* Symbol_leading_char. */
2320 ' ', /* AR_pad_char. */
2321 16, /* AR_max_namelen. */
2322 0, /* match priority. */
2323 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2324 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2325 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* Data. */
2326 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2327 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2328 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* Hdrs. */
2329 { /* bfd_check_format. */
2331 bfd_sym_object_p
, /* bfd_check_format. */
2335 { /* bfd_set_format. */
2341 { /* bfd_write_contents. */
2348 BFD_JUMP_TABLE_GENERIC (bfd_sym
),
2349 BFD_JUMP_TABLE_COPY (_bfd_generic
),
2350 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
2351 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive
),
2352 BFD_JUMP_TABLE_SYMBOLS (bfd_sym
),
2353 BFD_JUMP_TABLE_RELOCS (_bfd_norelocs
),
2354 BFD_JUMP_TABLE_WRITE (bfd_sym
),
2355 BFD_JUMP_TABLE_LINK (bfd_sym
),
2356 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),