1 /* xSYM symbol-file support for BFD.
2 Copyright 1999, 2000, 2001, 2002
3 Free Software Foundation, Inc.
5 This file is part of BFD, the Binary File Descriptor library.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
26 #define bfd_sym_close_and_cleanup _bfd_generic_close_and_cleanup
27 #define bfd_sym_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
28 #define bfd_sym_new_section_hook _bfd_generic_new_section_hook
29 #define bfd_sym_bfd_is_local_label_name bfd_generic_is_local_label_name
30 #define bfd_sym_get_lineno _bfd_nosymbols_get_lineno
31 #define bfd_sym_find_nearest_line _bfd_nosymbols_find_nearest_line
32 #define bfd_sym_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
33 #define bfd_sym_read_minisymbols _bfd_generic_read_minisymbols
34 #define bfd_sym_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
35 #define bfd_sym_get_reloc_upper_bound _bfd_norelocs_get_reloc_upper_bound
36 #define bfd_sym_canonicalize_reloc _bfd_norelocs_canonicalize_reloc
37 #define bfd_sym_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
38 #define bfd_sym_set_arch_mach _bfd_generic_set_arch_mach
39 #define bfd_sym_get_section_contents _bfd_generic_get_section_contents
40 #define bfd_sym_set_section_contents _bfd_generic_set_section_contents
41 #define bfd_sym_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
42 #define bfd_sym_bfd_relax_section bfd_generic_relax_section
43 #define bfd_sym_bfd_gc_sections bfd_generic_gc_sections
44 #define bfd_sym_bfd_merge_sections bfd_generic_merge_sections
45 #define bfd_sym_bfd_discard_group bfd_generic_discard_group
46 #define bfd_sym_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
47 #define bfd_sym_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
48 #define bfd_sym_bfd_link_add_symbols _bfd_generic_link_add_symbols
49 #define bfd_sym_bfd_link_just_syms _bfd_generic_link_just_syms
50 #define bfd_sym_bfd_final_link _bfd_generic_final_link
51 #define bfd_sym_bfd_link_split_section _bfd_generic_link_split_section
52 #define bfd_sym_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
54 static int pstrcmp
PARAMS ((unsigned char *, unsigned char *));
55 static unsigned long compute_offset
56 PARAMS ((unsigned long, unsigned long, unsigned long, unsigned long));
58 extern const bfd_target sym_vec
;
68 clen
= (a
[0] > b
[0]) ? a
[0] : b
[0];
69 ret
= memcmp (a
+ 1, b
+ 1, clen
);
82 compute_offset (first_page
, page_size
, entry_size
, index
)
83 unsigned long first_page
;
84 unsigned long page_size
;
85 unsigned long entry_size
;
88 unsigned long entries_per_page
= page_size
/ entry_size
;
89 unsigned long page_number
= first_page
+ (index
/ entries_per_page
);
90 unsigned long page_offset
= (index
% entries_per_page
) * entry_size
;
92 return (page_number
* page_size
) + page_offset
;
96 bfd_sym_mkobject (abfd
)
97 bfd
*abfd ATTRIBUTE_UNUSED
;
99 return (boolean
) true;
103 bfd_sym_print_symbol (abfd
, afile
, symbol
, how
)
104 bfd
*abfd ATTRIBUTE_UNUSED
;
105 PTR afile ATTRIBUTE_UNUSED
;
106 asymbol
*symbol ATTRIBUTE_UNUSED
;
107 bfd_print_symbol_type how ATTRIBUTE_UNUSED
;
116 if (abfd
== NULL
|| abfd
->xvec
== NULL
)
119 return (abfd
->xvec
== &sym_vec
);
123 bfd_sym_read_name_table (abfd
, dshb
)
125 bfd_sym_header_block
*dshb
;
129 size_t table_size
= dshb
->dshb_nte
.dti_page_count
* dshb
->dshb_page_size
;
130 size_t table_offset
= dshb
->dshb_nte
.dti_first_page
* dshb
->dshb_page_size
;
132 rstr
= (unsigned char *) bfd_alloc (abfd
, table_size
);
136 bfd_seek (abfd
, table_offset
, SEEK_SET
);
137 ret
= bfd_bread (rstr
, table_size
, abfd
);
138 if ((ret
< 0) || ((unsigned long) ret
!= table_size
))
140 bfd_release (abfd
, rstr
);
148 bfd_sym_parse_file_reference_v32 (buf
, len
, entry
)
151 bfd_sym_file_reference
*entry
;
153 BFD_ASSERT (len
== 6);
155 entry
->fref_frte_index
= bfd_getb16 (buf
);
156 entry
->fref_offset
= bfd_getb32 (buf
+ 2);
160 bfd_sym_parse_disk_table_v32 (buf
, len
, table
)
163 bfd_sym_table_info
*table
;
165 BFD_ASSERT (len
== 8);
167 table
->dti_first_page
= bfd_getb16 (buf
);
168 table
->dti_page_count
= bfd_getb16 (buf
+ 2);
169 table
->dti_object_count
= bfd_getb32 (buf
+ 4);
173 bfd_sym_parse_header_v32 (buf
, len
, header
)
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 (abfd
, header
)
207 bfd_sym_header_block
*header
;
209 unsigned char buf
[154];
212 ret
= bfd_bread (buf
, 154, abfd
);
216 bfd_sym_parse_header_v32 (buf
, 154, header
);
222 bfd_sym_read_header_v34 (abfd
, header
)
223 bfd
*abfd ATTRIBUTE_UNUSED
;
224 bfd_sym_header_block
*header ATTRIBUTE_UNUSED
;
230 bfd_sym_read_header (abfd
, header
, version
)
232 bfd_sym_header_block
*header
;
233 bfd_sym_version version
;
237 case BFD_SYM_VERSION_3_5
:
238 case BFD_SYM_VERSION_3_4
:
239 return bfd_sym_read_header_v34 (abfd
, header
);
240 case BFD_SYM_VERSION_3_3
:
241 case BFD_SYM_VERSION_3_2
:
242 return bfd_sym_read_header_v32 (abfd
, header
);
243 case BFD_SYM_VERSION_3_1
:
250 bfd_sym_read_version (abfd
, version
)
252 bfd_sym_version
*version
;
254 unsigned char version_string
[32];
257 ret
= bfd_bread (version_string
, sizeof (version_string
), abfd
);
258 if (ret
!= sizeof (version_string
))
261 if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_1
) == 0)
262 *version
= BFD_SYM_VERSION_3_1
;
263 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_2
) == 0)
264 *version
= BFD_SYM_VERSION_3_2
;
265 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_3
) == 0)
266 *version
= BFD_SYM_VERSION_3_3
;
267 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_4
) == 0)
268 *version
= BFD_SYM_VERSION_3_4
;
269 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_5
) == 0)
270 *version
= BFD_SYM_VERSION_3_5
;
278 bfd_sym_display_table_summary (f
, dti
, name
)
280 bfd_sym_table_info
*dti
;
283 fprintf (f
, "%-6s %13ld %13ld %13ld\n",
287 dti
->dti_object_count
);
291 bfd_sym_display_header (f
, dshb
)
293 bfd_sym_header_block
*dshb
;
295 fprintf (f
, " Version: %.*s\n", dshb
->dshb_id
[0], dshb
->dshb_id
+ 1);
296 fprintf (f
, " Page Size: 0x%x\n", dshb
->dshb_page_size
);
297 fprintf (f
, " Hash Page: %lu\n", dshb
->dshb_hash_page
);
298 fprintf (f
, " Root MTE: %lu\n", dshb
->dshb_root_mte
);
299 fprintf (f
, " Modification Date: ");
300 fprintf (f
, "[unimplemented]");
301 fprintf (f
, " (0x%lx)\n", dshb
->dshb_mod_date
);
303 fprintf (f
, " File Creator: %.4s Type: %.4s\n\n",
304 dshb
->dshb_file_creator
, dshb
->dshb_file_type
);
306 fprintf (f
, "Table Name First Page Page Count Object Count\n");
307 fprintf (f
, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
309 bfd_sym_display_table_summary (f
, &dshb
->dshb_nte
, "NTE");
310 bfd_sym_display_table_summary (f
, &dshb
->dshb_rte
, "RTE");
311 bfd_sym_display_table_summary (f
, &dshb
->dshb_mte
, "MTE");
312 bfd_sym_display_table_summary (f
, &dshb
->dshb_frte
, "FRTE");
313 bfd_sym_display_table_summary (f
, &dshb
->dshb_cmte
, "CMTE");
314 bfd_sym_display_table_summary (f
, &dshb
->dshb_cvte
, "CVTE");
315 bfd_sym_display_table_summary (f
, &dshb
->dshb_csnte
, "CSNTE");
316 bfd_sym_display_table_summary (f
, &dshb
->dshb_clte
, "CLTE");
317 bfd_sym_display_table_summary (f
, &dshb
->dshb_ctte
, "CTTE");
318 bfd_sym_display_table_summary (f
, &dshb
->dshb_tte
, "TTE");
319 bfd_sym_display_table_summary (f
, &dshb
->dshb_tinfo
, "TINFO");
320 bfd_sym_display_table_summary (f
, &dshb
->dshb_fite
, "FITE");
321 bfd_sym_display_table_summary (f
, &dshb
->dshb_const
, "CONST");
327 bfd_sym_parse_resources_table_entry_v32 (buf
, len
, entry
)
330 bfd_sym_resources_table_entry
*entry
;
332 BFD_ASSERT (len
== 18);
334 memcpy (&entry
->rte_res_type
, buf
, 4);
335 entry
->rte_res_number
= bfd_getb16 (buf
+ 4);
336 entry
->rte_nte_index
= bfd_getb32 (buf
+ 6);
337 entry
->rte_mte_first
= bfd_getb16 (buf
+ 10);
338 entry
->rte_mte_last
= bfd_getb16 (buf
+ 12);
339 entry
->rte_res_size
= bfd_getb32 (buf
+ 14);
343 bfd_sym_parse_modules_table_entry_v33 (buf
, len
, entry
)
346 bfd_sym_modules_table_entry
*entry
;
348 BFD_ASSERT (len
== 46);
350 entry
->mte_rte_index
= bfd_getb16 (buf
);
351 entry
->mte_res_offset
= bfd_getb32 (buf
+ 2);
352 entry
->mte_size
= bfd_getb32 (buf
+ 6);
353 entry
->mte_kind
= buf
[10];
354 entry
->mte_scope
= buf
[11];
355 entry
->mte_parent
= bfd_getb16 (buf
+ 12);
356 bfd_sym_parse_file_reference_v32 (buf
+ 14, 6, &entry
->mte_imp_fref
);
357 entry
->mte_imp_end
= bfd_getb32 (buf
+ 20);
358 entry
->mte_nte_index
= bfd_getb32 (buf
+ 24);
359 entry
->mte_cmte_index
= bfd_getb16 (buf
+ 28);
360 entry
->mte_cvte_index
= bfd_getb32 (buf
+ 30);
361 entry
->mte_clte_index
= bfd_getb16 (buf
+ 34);
362 entry
->mte_ctte_index
= bfd_getb16 (buf
+ 36);
363 entry
->mte_csnte_idx_1
= bfd_getb32 (buf
+ 38);
364 entry
->mte_csnte_idx_2
= bfd_getb32 (buf
+ 42);
368 bfd_sym_parse_file_references_table_entry_v32 (buf
, len
, entry
)
371 bfd_sym_file_references_table_entry
*entry
;
375 BFD_ASSERT (len
== 10);
377 memset (entry
, 0, sizeof (bfd_sym_file_references_table_entry
));
378 type
= bfd_getb16 (buf
);
382 case BFD_SYM_END_OF_LIST_3_2
:
383 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
386 case BFD_SYM_FILE_NAME_INDEX_3_2
:
387 entry
->filename
.type
= BFD_SYM_FILE_NAME_INDEX
;
388 entry
->filename
.nte_index
= bfd_getb32 (buf
+ 2);
389 entry
->filename
.mod_date
= bfd_getb32 (buf
+ 6);
393 entry
->entry
.mte_index
= type
;
394 entry
->entry
.file_offset
= bfd_getb32 (buf
+ 2);
399 bfd_sym_parse_contained_modules_table_entry_v32 (buf
, len
, entry
)
402 bfd_sym_contained_modules_table_entry
*entry
;
406 BFD_ASSERT (len
== 6);
408 memset (entry
, 0, sizeof (bfd_sym_contained_modules_table_entry
));
409 type
= bfd_getb16 (buf
);
413 case BFD_SYM_END_OF_LIST_3_2
:
414 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
418 entry
->entry
.mte_index
= type
;
419 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 2);
425 bfd_sym_parse_contained_variables_table_entry_v32 (buf
, len
, entry
)
428 bfd_sym_contained_variables_table_entry
*entry
;
432 BFD_ASSERT (len
== 26);
434 memset (entry
, 0, sizeof (bfd_sym_contained_variables_table_entry
));
435 type
= bfd_getb16 (buf
);
439 case BFD_SYM_END_OF_LIST_3_2
:
440 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
443 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
444 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
445 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
449 entry
->entry
.tte_index
= type
;
450 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 2);
451 entry
->entry
.file_delta
= bfd_getb16 (buf
+ 6);
452 entry
->entry
.scope
= buf
[8];
453 entry
->entry
.la_size
= buf
[9];
455 if (entry
->entry
.la_size
== BFD_SYM_CVTE_SCA
)
457 entry
->entry
.address
.scstruct
.sca_kind
= buf
[10];
458 entry
->entry
.address
.scstruct
.sca_class
= buf
[11];
459 entry
->entry
.address
.scstruct
.sca_offset
= bfd_getb32 (buf
+ 12);
461 else if (entry
->entry
.la_size
<= BFD_SYM_CVTE_SCA
)
463 memcpy (&entry
->entry
.address
.lastruct
.la
, buf
+ 10, BFD_SYM_CVTE_SCA
);
464 entry
->entry
.address
.lastruct
.la_kind
= buf
[23];
466 else if (entry
->entry
.la_size
== BFD_SYM_CVTE_BIG_LA
)
468 entry
->entry
.address
.biglastruct
.big_la
= bfd_getb32 (buf
+ 10);
469 entry
->entry
.address
.biglastruct
.big_la_kind
= buf
[12];
475 bfd_sym_parse_contained_statements_table_entry_v32 (buf
, len
, entry
)
478 bfd_sym_contained_statements_table_entry
*entry
;
482 BFD_ASSERT (len
== 8);
484 memset (entry
, 0, sizeof (bfd_sym_contained_statements_table_entry
));
485 type
= bfd_getb16 (buf
);
489 case BFD_SYM_END_OF_LIST_3_2
:
490 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
493 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
494 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
495 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
499 entry
->entry
.mte_index
= type
;
500 entry
->entry
.mte_offset
= bfd_getb16 (buf
+ 2);
501 entry
->entry
.file_delta
= bfd_getb32 (buf
+ 4);
507 bfd_sym_parse_contained_labels_table_entry_v32 (buf
, len
, entry
)
510 bfd_sym_contained_labels_table_entry
*entry
;
514 BFD_ASSERT (len
== 12);
516 memset (entry
, 0, sizeof (bfd_sym_contained_labels_table_entry
));
517 type
= bfd_getb16 (buf
);
521 case BFD_SYM_END_OF_LIST_3_2
:
522 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
525 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
526 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
527 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
531 entry
->entry
.mte_index
= type
;
532 entry
->entry
.mte_offset
= bfd_getb16 (buf
+ 2);
533 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 4);
534 entry
->entry
.file_delta
= bfd_getb16 (buf
+ 8);
535 entry
->entry
.scope
= bfd_getb16 (buf
+ 10);
541 bfd_sym_parse_type_table_entry_v32 (buf
, len
, entry
)
544 bfd_sym_type_table_entry
*entry
;
546 BFD_ASSERT (len
== 4);
548 *entry
= bfd_getb32 (buf
);
552 bfd_sym_fetch_resources_table_entry (abfd
, entry
, index
)
554 bfd_sym_resources_table_entry
*entry
;
557 void (*parser
) (unsigned char *, size_t, bfd_sym_resources_table_entry
*) = NULL
;
558 unsigned long offset
;
559 unsigned long entry_size
;
560 unsigned char buf
[18];
561 bfd_sym_data_struct
*sdata
= NULL
;
563 BFD_ASSERT (bfd_sym_valid (abfd
));
564 sdata
= abfd
->tdata
.sym_data
;
569 switch (sdata
->version
)
571 case BFD_SYM_VERSION_3_5
:
572 case BFD_SYM_VERSION_3_4
:
575 case BFD_SYM_VERSION_3_3
:
576 case BFD_SYM_VERSION_3_2
:
578 parser
= bfd_sym_parse_resources_table_entry_v32
;
581 case BFD_SYM_VERSION_3_1
:
588 offset
= compute_offset (sdata
->header
.dshb_rte
.dti_first_page
,
589 sdata
->header
.dshb_page_size
,
592 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
594 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
597 (*parser
) (buf
, entry_size
, entry
);
603 bfd_sym_fetch_modules_table_entry (abfd
, entry
, index
)
605 bfd_sym_modules_table_entry
*entry
;
608 void (*parser
) (unsigned char *, size_t, bfd_sym_modules_table_entry
*) = NULL
;
609 unsigned long offset
;
610 unsigned long entry_size
;
611 unsigned char buf
[46];
612 bfd_sym_data_struct
*sdata
= NULL
;
614 BFD_ASSERT (bfd_sym_valid (abfd
));
615 sdata
= abfd
->tdata
.sym_data
;
620 switch (sdata
->version
)
622 case BFD_SYM_VERSION_3_5
:
623 case BFD_SYM_VERSION_3_4
:
626 case BFD_SYM_VERSION_3_3
:
628 parser
= bfd_sym_parse_modules_table_entry_v33
;
631 case BFD_SYM_VERSION_3_2
:
632 case BFD_SYM_VERSION_3_1
:
639 offset
= compute_offset (sdata
->header
.dshb_mte
.dti_first_page
,
640 sdata
->header
.dshb_page_size
,
643 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
645 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
648 (*parser
) (buf
, entry_size
, entry
);
654 bfd_sym_fetch_file_references_table_entry (abfd
, entry
, index
)
656 bfd_sym_file_references_table_entry
*entry
;
659 void (*parser
) (unsigned char *, size_t, bfd_sym_file_references_table_entry
*) = NULL
;
660 unsigned long offset
;
661 unsigned long entry_size
= 0;
662 unsigned char buf
[8];
663 bfd_sym_data_struct
*sdata
= NULL
;
665 BFD_ASSERT (bfd_sym_valid (abfd
));
666 sdata
= abfd
->tdata
.sym_data
;
671 switch (sdata
->version
)
673 case BFD_SYM_VERSION_3_3
:
674 case BFD_SYM_VERSION_3_2
:
676 parser
= bfd_sym_parse_file_references_table_entry_v32
;
679 case BFD_SYM_VERSION_3_5
:
680 case BFD_SYM_VERSION_3_4
:
681 case BFD_SYM_VERSION_3_1
:
689 offset
= compute_offset (sdata
->header
.dshb_frte
.dti_first_page
,
690 sdata
->header
.dshb_page_size
,
693 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
695 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
698 (*parser
) (buf
, entry_size
, entry
);
704 bfd_sym_fetch_contained_modules_table_entry (abfd
, entry
, index
)
706 bfd_sym_contained_modules_table_entry
*entry
;
709 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_modules_table_entry
*) = NULL
;
710 unsigned long offset
;
711 unsigned long entry_size
= 0;
712 unsigned char buf
[6];
713 bfd_sym_data_struct
*sdata
= NULL
;
715 BFD_ASSERT (bfd_sym_valid (abfd
));
716 sdata
= abfd
->tdata
.sym_data
;
721 switch (sdata
->version
)
723 case BFD_SYM_VERSION_3_3
:
724 case BFD_SYM_VERSION_3_2
:
726 parser
= bfd_sym_parse_contained_modules_table_entry_v32
;
729 case BFD_SYM_VERSION_3_5
:
730 case BFD_SYM_VERSION_3_4
:
731 case BFD_SYM_VERSION_3_1
:
739 offset
= compute_offset (sdata
->header
.dshb_cmte
.dti_first_page
,
740 sdata
->header
.dshb_page_size
,
743 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
745 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
748 (*parser
) (buf
, entry_size
, entry
);
754 bfd_sym_fetch_contained_variables_table_entry (abfd
, entry
, index
)
756 bfd_sym_contained_variables_table_entry
*entry
;
759 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_variables_table_entry
*) = NULL
;
760 unsigned long offset
;
761 unsigned long entry_size
= 0;
762 unsigned char buf
[26];
763 bfd_sym_data_struct
*sdata
= NULL
;
765 BFD_ASSERT (bfd_sym_valid (abfd
));
766 sdata
= abfd
->tdata
.sym_data
;
771 switch (sdata
->version
)
773 case BFD_SYM_VERSION_3_3
:
774 case BFD_SYM_VERSION_3_2
:
776 parser
= bfd_sym_parse_contained_variables_table_entry_v32
;
779 case BFD_SYM_VERSION_3_5
:
780 case BFD_SYM_VERSION_3_4
:
781 case BFD_SYM_VERSION_3_1
:
789 offset
= compute_offset (sdata
->header
.dshb_cvte
.dti_first_page
,
790 sdata
->header
.dshb_page_size
,
793 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
795 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
798 (*parser
) (buf
, entry_size
, entry
);
804 bfd_sym_fetch_contained_statements_table_entry (abfd
, entry
, index
)
806 bfd_sym_contained_statements_table_entry
*entry
;
809 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_statements_table_entry
*) = NULL
;
810 unsigned long offset
;
811 unsigned long entry_size
= 0;
812 unsigned char buf
[8];
813 bfd_sym_data_struct
*sdata
= NULL
;
815 BFD_ASSERT (bfd_sym_valid (abfd
));
816 sdata
= abfd
->tdata
.sym_data
;
821 switch (sdata
->version
)
823 case BFD_SYM_VERSION_3_3
:
824 case BFD_SYM_VERSION_3_2
:
826 parser
= bfd_sym_parse_contained_statements_table_entry_v32
;
829 case BFD_SYM_VERSION_3_5
:
830 case BFD_SYM_VERSION_3_4
:
831 case BFD_SYM_VERSION_3_1
:
839 offset
= compute_offset (sdata
->header
.dshb_csnte
.dti_first_page
,
840 sdata
->header
.dshb_page_size
,
843 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
845 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
848 (*parser
) (buf
, entry_size
, entry
);
854 bfd_sym_fetch_contained_labels_table_entry (abfd
, entry
, index
)
856 bfd_sym_contained_labels_table_entry
*entry
;
859 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_labels_table_entry
*) = NULL
;
860 unsigned long offset
;
861 unsigned long entry_size
= 0;
862 unsigned char buf
[12];
863 bfd_sym_data_struct
*sdata
= NULL
;
865 BFD_ASSERT (bfd_sym_valid (abfd
));
866 sdata
= abfd
->tdata
.sym_data
;
871 switch (sdata
->version
)
873 case BFD_SYM_VERSION_3_3
:
874 case BFD_SYM_VERSION_3_2
:
876 parser
= bfd_sym_parse_contained_labels_table_entry_v32
;
879 case BFD_SYM_VERSION_3_5
:
880 case BFD_SYM_VERSION_3_4
:
881 case BFD_SYM_VERSION_3_1
:
889 offset
= compute_offset (sdata
->header
.dshb_clte
.dti_first_page
,
890 sdata
->header
.dshb_page_size
,
893 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
895 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
898 (*parser
) (buf
, entry_size
, entry
);
904 bfd_sym_fetch_contained_types_table_entry (abfd
, entry
, index
)
906 bfd_sym_contained_types_table_entry
*entry
;
909 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_types_table_entry
*) = NULL
;
910 unsigned long offset
;
911 unsigned long entry_size
= 0;
912 unsigned char buf
[0];
913 bfd_sym_data_struct
*sdata
= NULL
;
915 BFD_ASSERT (bfd_sym_valid (abfd
));
916 sdata
= abfd
->tdata
.sym_data
;
921 switch (sdata
->version
)
923 case BFD_SYM_VERSION_3_3
:
924 case BFD_SYM_VERSION_3_2
:
929 case BFD_SYM_VERSION_3_5
:
930 case BFD_SYM_VERSION_3_4
:
931 case BFD_SYM_VERSION_3_1
:
939 offset
= compute_offset (sdata
->header
.dshb_ctte
.dti_first_page
,
940 sdata
->header
.dshb_page_size
,
943 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
945 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
948 (*parser
) (buf
, entry_size
, entry
);
954 bfd_sym_fetch_file_references_index_table_entry (abfd
, entry
, index
)
956 bfd_sym_file_references_index_table_entry
*entry
;
959 void (*parser
) (unsigned char *, size_t, bfd_sym_file_references_index_table_entry
*) = NULL
;
960 unsigned long offset
;
961 unsigned long entry_size
= 0;
962 unsigned char buf
[0];
963 bfd_sym_data_struct
*sdata
= NULL
;
965 BFD_ASSERT (bfd_sym_valid (abfd
));
966 sdata
= abfd
->tdata
.sym_data
;
971 switch (sdata
->version
)
973 case BFD_SYM_VERSION_3_3
:
974 case BFD_SYM_VERSION_3_2
:
979 case BFD_SYM_VERSION_3_5
:
980 case BFD_SYM_VERSION_3_4
:
981 case BFD_SYM_VERSION_3_1
:
989 offset
= compute_offset (sdata
->header
.dshb_fite
.dti_first_page
,
990 sdata
->header
.dshb_page_size
,
993 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
995 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
998 (*parser
) (buf
, entry_size
, entry
);
1004 bfd_sym_fetch_constant_pool_entry (abfd
, entry
, index
)
1006 bfd_sym_constant_pool_entry
*entry
;
1007 unsigned long index
;
1009 void (*parser
) (unsigned char *, size_t, bfd_sym_constant_pool_entry
*) = NULL
;
1010 unsigned long offset
;
1011 unsigned long entry_size
= 0;
1012 unsigned char buf
[0];
1013 bfd_sym_data_struct
*sdata
= NULL
;
1015 BFD_ASSERT (bfd_sym_valid (abfd
));
1016 sdata
= abfd
->tdata
.sym_data
;
1021 switch (sdata
->version
)
1023 case BFD_SYM_VERSION_3_3
:
1024 case BFD_SYM_VERSION_3_2
:
1029 case BFD_SYM_VERSION_3_5
:
1030 case BFD_SYM_VERSION_3_4
:
1031 case BFD_SYM_VERSION_3_1
:
1039 offset
= compute_offset (sdata
->header
.dshb_fite
.dti_first_page
,
1040 sdata
->header
.dshb_page_size
,
1043 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1045 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1048 (*parser
) (buf
, entry_size
, entry
);
1054 bfd_sym_fetch_type_table_entry (abfd
, entry
, index
)
1056 bfd_sym_type_table_entry
*entry
;
1057 unsigned long index
;
1059 void (*parser
) (unsigned char *, size_t, bfd_sym_type_table_entry
*) = NULL
;
1060 unsigned long offset
;
1061 unsigned long entry_size
= 0;
1062 unsigned char buf
[4];
1063 bfd_sym_data_struct
*sdata
= NULL
;
1065 BFD_ASSERT (bfd_sym_valid (abfd
));
1066 sdata
= abfd
->tdata
.sym_data
;
1068 switch (sdata
->version
)
1070 case BFD_SYM_VERSION_3_3
:
1071 case BFD_SYM_VERSION_3_2
:
1073 parser
= bfd_sym_parse_type_table_entry_v32
;
1076 case BFD_SYM_VERSION_3_5
:
1077 case BFD_SYM_VERSION_3_4
:
1078 case BFD_SYM_VERSION_3_1
:
1086 offset
= compute_offset (sdata
->header
.dshb_tte
.dti_first_page
,
1087 sdata
->header
.dshb_page_size
,
1090 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1092 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1095 (*parser
) (buf
, entry_size
, entry
);
1101 bfd_sym_fetch_type_information_table_entry (abfd
, entry
, offset
)
1103 bfd_sym_type_information_table_entry
*entry
;
1104 unsigned long offset
;
1106 unsigned char buf
[4];
1107 bfd_sym_data_struct
*sdata
= NULL
;
1109 BFD_ASSERT (bfd_sym_valid (abfd
));
1110 sdata
= abfd
->tdata
.sym_data
;
1115 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1118 if (bfd_bread (buf
, 4, abfd
) != 4)
1120 entry
->nte_index
= bfd_getb32 (buf
);
1122 if (bfd_bread (buf
, 2, abfd
) != 2)
1124 entry
->physical_size
= bfd_getb16 (buf
);
1126 if (entry
->physical_size
& 0x8000)
1128 if (bfd_bread (buf
, 4, abfd
) != 4)
1130 entry
->physical_size
&= 0x7fff;
1131 entry
->logical_size
= bfd_getb32 (buf
);
1132 entry
->offset
= offset
+ 10;
1136 if (bfd_bread (buf
, 2, abfd
) != 2)
1138 entry
->physical_size
&= 0x7fff;
1139 entry
->logical_size
= bfd_getb16 (buf
);
1140 entry
->offset
= offset
+ 8;
1147 bfd_sym_fetch_type_table_information (abfd
, entry
, index
)
1149 bfd_sym_type_information_table_entry
*entry
;
1150 unsigned long index
;
1152 bfd_sym_type_table_entry tindex
;
1153 bfd_sym_data_struct
*sdata
= NULL
;
1155 BFD_ASSERT (bfd_sym_valid (abfd
));
1156 sdata
= abfd
->tdata
.sym_data
;
1158 if (sdata
->header
.dshb_tte
.dti_object_count
<= 99)
1163 if (bfd_sym_fetch_type_table_entry (abfd
, &tindex
, index
- 100) < 0)
1165 if (bfd_sym_fetch_type_information_table_entry (abfd
, entry
, tindex
) < 0)
1171 const unsigned char *
1172 bfd_sym_symbol_name (abfd
, index
)
1174 unsigned long index
;
1176 bfd_sym_data_struct
*sdata
= NULL
;
1178 BFD_ASSERT (bfd_sym_valid (abfd
));
1179 sdata
= abfd
->tdata
.sym_data
;
1185 if ((index
/ sdata
->header
.dshb_page_size
) > sdata
->header
.dshb_nte
.dti_page_count
)
1186 return "\009[INVALID]";
1188 return ((const unsigned char *) sdata
->name_table
+ index
);
1191 const unsigned char *
1192 bfd_sym_module_name (abfd
, index
)
1194 unsigned long index
;
1196 bfd_sym_modules_table_entry entry
;
1198 if (bfd_sym_fetch_modules_table_entry (abfd
, &entry
, index
) < 0)
1199 return "\011[INVALID]";
1201 return bfd_sym_symbol_name (abfd
, entry
.mte_nte_index
);
1205 bfd_sym_unparse_storage_kind (kind
)
1206 enum bfd_sym_storage_kind kind
;
1210 case BFD_SYM_STORAGE_KIND_LOCAL
: return "LOCAL";
1211 case BFD_SYM_STORAGE_KIND_VALUE
: return "VALUE";
1212 case BFD_SYM_STORAGE_KIND_REFERENCE
: return "REFERENCE";
1213 case BFD_SYM_STORAGE_KIND_WITH
: return "WITH";
1214 default: return "[UNKNOWN]";
1219 bfd_sym_unparse_storage_class (kind
)
1220 enum bfd_sym_storage_class kind
;
1224 case BFD_SYM_STORAGE_CLASS_REGISTER
: return "REGISTER";
1225 case BFD_SYM_STORAGE_CLASS_GLOBAL
: return "GLOBAL";
1226 case BFD_SYM_STORAGE_CLASS_FRAME_RELATIVE
: return "FRAME_RELATIVE";
1227 case BFD_SYM_STORAGE_CLASS_STACK_RELATIVE
: return "STACK_RELATIVE";
1228 case BFD_SYM_STORAGE_CLASS_ABSOLUTE
: return "ABSOLUTE";
1229 case BFD_SYM_STORAGE_CLASS_CONSTANT
: return "CONSTANT";
1230 case BFD_SYM_STORAGE_CLASS_RESOURCE
: return "RESOURCE";
1231 case BFD_SYM_STORAGE_CLASS_BIGCONSTANT
: return "BIGCONSTANT";
1232 default: return "[UNKNOWN]";
1237 bfd_sym_unparse_module_kind (kind
)
1238 enum bfd_sym_module_kind kind
;
1242 case BFD_SYM_MODULE_KIND_NONE
: return "NONE";
1243 case BFD_SYM_MODULE_KIND_PROGRAM
: return "PROGRAM";
1244 case BFD_SYM_MODULE_KIND_UNIT
: return "UNIT";
1245 case BFD_SYM_MODULE_KIND_PROCEDURE
: return "PROCEDURE";
1246 case BFD_SYM_MODULE_KIND_FUNCTION
: return "FUNCTION";
1247 case BFD_SYM_MODULE_KIND_DATA
: return "DATA";
1248 case BFD_SYM_MODULE_KIND_BLOCK
: return "BLOCK";
1249 default: return "[UNKNOWN]";
1254 bfd_sym_unparse_symbol_scope (scope
)
1255 enum bfd_sym_symbol_scope scope
;
1259 case BFD_SYM_SYMBOL_SCOPE_LOCAL
: return "LOCAL";
1260 case BFD_SYM_SYMBOL_SCOPE_GLOBAL
: return "GLOBAL";
1267 bfd_sym_print_file_reference (abfd
, f
, entry
)
1270 bfd_sym_file_reference
*entry
;
1272 bfd_sym_file_references_table_entry frtentry
;
1275 ret
= bfd_sym_fetch_file_references_table_entry (abfd
, &frtentry
, entry
->fref_frte_index
);
1276 fprintf (f
, "FILE ");
1278 if ((ret
< 0) || (frtentry
.generic
.type
!= BFD_SYM_FILE_NAME_INDEX
))
1279 fprintf (f
, "[INVALID]");
1281 fprintf (f
, "\"%.*s\"",
1282 bfd_sym_symbol_name (abfd
, frtentry
.filename
.nte_index
)[0],
1283 &bfd_sym_symbol_name (abfd
, frtentry
.filename
.nte_index
)[1]);
1285 fprintf (f
, " (FRTE %lu)", entry
->fref_frte_index
);
1289 bfd_sym_print_resources_table_entry (abfd
, f
, entry
)
1292 bfd_sym_resources_table_entry
*entry
;
1294 fprintf (f
, " \"%.*s\" (NTE %lu), type \"%.4s\", num %u, size %lu, MTE %lu -- %lu",
1295 bfd_sym_symbol_name (abfd
, entry
->rte_nte_index
)[0],
1296 &bfd_sym_symbol_name (abfd
, entry
->rte_nte_index
)[1],
1297 entry
->rte_nte_index
, entry
->rte_res_type
, entry
->rte_res_number
,
1298 entry
->rte_res_size
, entry
->rte_mte_first
, entry
->rte_mte_last
);
1302 bfd_sym_print_modules_table_entry (abfd
, f
, entry
)
1305 bfd_sym_modules_table_entry
*entry
;
1307 fprintf (f
, "\"%.*s\" (NTE %lu)",
1308 bfd_sym_symbol_name (abfd
, entry
->mte_nte_index
)[0],
1309 &bfd_sym_symbol_name (abfd
, entry
->mte_nte_index
)[1],
1310 entry
->mte_nte_index
);
1314 bfd_sym_print_file_reference (abfd
, f
, &entry
->mte_imp_fref
);
1315 fprintf (f
, " range %lu -- %lu", entry
->mte_imp_fref
.fref_offset
, entry
->mte_imp_end
);
1319 fprintf (f
, "kind %s", bfd_sym_unparse_module_kind (entry
->mte_kind
));
1320 fprintf (f
, ", scope %s", bfd_sym_unparse_symbol_scope (entry
->mte_scope
));
1322 fprintf (f
, ", RTE %lu, offset %lu, size %lu",
1323 entry
->mte_rte_index
, entry
->mte_res_offset
, entry
->mte_size
);
1327 fprintf (f
, "CMTE %lu, CVTE %lu, CLTE %lu, CTTE %lu, CSNTE1 %lu, CSNTE2 %lu",
1328 entry
->mte_cmte_index
, entry
->mte_cvte_index
,
1329 entry
->mte_clte_index
, entry
->mte_ctte_index
,
1330 entry
->mte_csnte_idx_1
, entry
->mte_csnte_idx_2
);
1332 if (entry
->mte_parent
!= 0)
1333 fprintf (f
, ", parent %lu", entry
->mte_parent
);
1335 fprintf (f
, ", no parent");
1337 if (entry
->mte_cmte_index
!= 0)
1338 fprintf (f
, ", child %lu", entry
->mte_cmte_index
);
1340 fprintf (f
, ", no child");
1344 MTE bfd_sym_modules_table_entry pentry
;
1346 ret
= bfd_sym_fetch_modules_table_entry (abfd
, &pentry
, entry
->mte_parent
);
1348 fprintf (f
, " parent MTE %lu [INVALID]\n", entry
->mte_parent
);
1350 fprintf (f
, " parent MTE %lu \"%.*s\"\n",
1352 bfd_sym_symbol_name (abfd
, pentry
.mte_nte_index
)[0],
1353 &bfd_sym_symbol_name (abfd
, pentry
.mte_nte_index
)[1]);
1359 bfd_sym_print_file_references_table_entry (abfd
, f
, entry
)
1362 bfd_sym_file_references_table_entry
*entry
;
1364 switch (entry
->generic
.type
)
1366 case BFD_SYM_FILE_NAME_INDEX
:
1367 fprintf (f
, "FILE \"%.*s\" (NTE %lu), modtime ",
1368 bfd_sym_symbol_name (abfd
, entry
->filename
.nte_index
)[0],
1369 &bfd_sym_symbol_name (abfd
, entry
->filename
.nte_index
)[1],
1370 entry
->filename
.nte_index
);
1372 fprintf (f
, "[UNIMPLEMENTED]");
1373 /* printModDate (entry->filename.mod_date); */
1374 fprintf (f
, " (0x%lx)", entry
->filename
.mod_date
);
1377 case BFD_SYM_END_OF_LIST
:
1382 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu",
1383 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1384 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1385 entry
->entry
.mte_index
,
1386 entry
->entry
.file_offset
);
1392 bfd_sym_print_contained_modules_table_entry (abfd
, f
, entry
)
1395 bfd_sym_contained_modules_table_entry
*entry
;
1397 switch (entry
->generic
.type
)
1399 case BFD_SYM_END_OF_LIST
:
1404 fprintf (f
, "\"%.*s\" (MTE %lu, NTE %lu)",
1405 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1406 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1407 entry
->entry
.mte_index
,
1408 entry
->entry
.nte_index
);
1414 bfd_sym_print_contained_variables_table_entry (abfd
, f
, entry
)
1417 bfd_sym_contained_variables_table_entry
*entry
;
1419 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1425 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1427 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1428 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1432 fprintf (f
, "\"%.*s\" (NTE %lu)",
1433 bfd_sym_symbol_name (abfd
, entry
->entry
.nte_index
)[0],
1434 &bfd_sym_symbol_name (abfd
, entry
->entry
.nte_index
)[1],
1435 entry
->entry
.nte_index
);
1437 fprintf (f
, ", TTE %lu", entry
->entry
.tte_index
);
1438 fprintf (f
, ", offset %lu", entry
->entry
.file_delta
);
1439 fprintf (f
, ", scope %s", bfd_sym_unparse_symbol_scope (entry
->entry
.scope
));
1441 if (entry
->entry
.la_size
== BFD_SYM_CVTE_SCA
)
1442 fprintf (f
, ", latype %s, laclass %s, laoffset %lu",
1443 bfd_sym_unparse_storage_kind (entry
->entry
.address
.scstruct
.sca_kind
),
1444 bfd_sym_unparse_storage_class (entry
->entry
.address
.scstruct
.sca_class
),
1445 entry
->entry
.address
.scstruct
.sca_offset
);
1446 else if (entry
->entry
.la_size
<= BFD_SYM_CVTE_LA_MAX_SIZE
)
1450 fprintf (f
, ", la [");
1451 for (i
= 0; i
< entry
->entry
.la_size
; i
++)
1452 fprintf (f
, "0x%02x ", entry
->entry
.address
.lastruct
.la
[i
]);
1455 else if (entry
->entry
.la_size
== BFD_SYM_CVTE_BIG_LA
)
1456 fprintf (f
, ", bigla %lu, biglakind %u",
1457 entry
->entry
.address
.biglastruct
.big_la
,
1458 entry
->entry
.address
.biglastruct
.big_la_kind
);
1461 fprintf (f
, ", la [INVALID]");
1465 bfd_sym_print_contained_statements_table_entry (abfd
, f
, entry
)
1468 bfd_sym_contained_statements_table_entry
*entry
;
1470 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1476 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1478 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1479 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1483 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu, delta %lu",
1484 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1485 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1486 entry
->entry
.mte_index
,
1487 entry
->entry
.mte_offset
,
1488 entry
->entry
.file_delta
);
1492 bfd_sym_print_contained_labels_table_entry (abfd
, f
, entry
)
1495 bfd_sym_contained_labels_table_entry
*entry
;
1497 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1503 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1505 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1506 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1510 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu, delta %lu, scope %s",
1511 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1512 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1513 entry
->entry
.mte_index
,
1514 entry
->entry
.mte_offset
,
1515 entry
->entry
.file_delta
,
1516 bfd_sym_unparse_symbol_scope (entry
->entry
.scope
));
1520 bfd_sym_print_contained_types_table_entry (abfd
, f
, entry
)
1521 bfd
*abfd ATTRIBUTE_UNUSED
;
1523 bfd_sym_contained_types_table_entry
*entry ATTRIBUTE_UNUSED
;
1525 fprintf (f
, "[UNIMPLEMENTED]");
1529 bfd_sym_type_operator_name (num
)
1534 case 1: return "TTE";
1535 case 2: return "PointerTo";
1536 case 3: return "ScalarOf";
1537 case 4: return "ConstantOf";
1538 case 5: return "EnumerationOf";
1539 case 6: return "VectorOf";
1540 case 7: return "RecordOf";
1541 case 8: return "UnionOf";
1542 case 9: return "SubRangeOf";
1543 case 10: return "SetOf";
1544 case 11: return "NamedTypeOf";
1545 case 12: return "ProcOf";
1546 case 13: return "ValueOf";
1547 case 14: return "ArrayOf";
1548 default: return "[UNKNOWN OPERATOR]";
1553 bfd_sym_type_basic_name (num
)
1558 case 0: return "void";
1559 case 1: return "pascal string";
1560 case 2: return "unsigned long";
1561 case 3: return "signed long";
1562 case 4: return "extended (10 bytes)";
1563 case 5: return "pascal boolean (1 byte)";
1564 case 6: return "unsigned byte";
1565 case 7: return "signed byte";
1566 case 8: return "character (1 byte)";
1567 case 9: return "wide character (2 bytes)";
1568 case 10: return "unsigned short";
1569 case 11: return "signed short";
1570 case 12: return "singled";
1571 case 13: return "double";
1572 case 14: return "extended (12 bytes)";
1573 case 15: return "computational (8 bytes)";
1574 case 16: return "c string";
1575 case 17: return "as-is string";
1576 default: return "[UNKNOWN BASIC TYPE]";
1581 bfd_sym_fetch_long (buf
, len
, offset
, offsetptr
, value
)
1584 unsigned long offset
;
1585 unsigned long *offsetptr
;
1596 else if (! (buf
[offset
] & 0x80))
1598 *value
= buf
[offset
];
1602 else if (buf
[offset
] == 0xc0)
1604 if ((offset
+ 5) > len
)
1612 *value
= bfd_getb32 (buf
+ offset
+ 1);
1617 else if ((buf
[offset
] & 0xc0) == 0xc0)
1619 *value
= -(buf
[offset
] & 0x3f);
1623 else if ((buf
[offset
] & 0xc0) == 0x80)
1625 if ((offset
+ 2) > len
)
1633 *value
= bfd_getb16 (buf
+ offset
) & 0x3fff;
1641 if (offsetptr
!= NULL
)
1642 *offsetptr
= offset
;
1648 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, offsetptr
)
1653 unsigned long offset
;
1654 unsigned long *offsetptr
;
1660 fprintf (f
, "[NULL]");
1662 if (offsetptr
!= NULL
)
1663 *offsetptr
= offset
;
1670 if (! (type
& 0x80))
1672 fprintf (f
, "[%s] (0x%x)", bfd_sym_type_basic_name (type
& 0x7f), type
);
1674 if (offsetptr
!= NULL
)
1675 *offsetptr
= offset
;
1680 fprintf (f
, "[packed ");
1684 switch (type
& 0x3f)
1689 bfd_sym_type_information_table_entry tinfo
;
1691 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1693 fprintf (f
, "[INVALID]");
1696 if (bfd_sym_fetch_type_table_information (abfd
, &tinfo
, value
) < 0)
1697 fprintf (f
, "[INVALID]");
1699 fprintf (f
, "\"%.*s\"",
1700 bfd_sym_symbol_name (abfd
, tinfo
.nte_index
)[0],
1701 &bfd_sym_symbol_name (abfd
, tinfo
.nte_index
)[1]);
1703 fprintf (f
, " (TTE %lu)", value
);
1708 fprintf (f
, "pointer (0x%x) to ", type
);
1709 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1714 unsigned long value
;
1716 fprintf (f
, "scalar (0x%x) of ", type
);
1717 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1718 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1719 fprintf (f
, " (%lu)", value
);
1725 unsigned long lower
, upper
, nelem
;
1728 fprintf (f
, "enumeration (0x%x) of ", type
);
1729 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1730 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &lower
);
1731 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &upper
);
1732 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &nelem
);
1733 fprintf (f
, " from %lu to %lu with %lu elements: ", lower
, upper
, nelem
);
1735 for (i
= 0; i
< nelem
; i
++)
1738 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1744 fprintf (f
, "vector (0x%x)", type
);
1745 fprintf (f
, "\n index ");
1746 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1747 fprintf (f
, "\n target ");
1748 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1754 long nrec
, eloff
, i
;
1756 if ((type
& 0x3f) == 7)
1757 fprintf (f
, "record (0x%x) of ", type
);
1759 fprintf (f
, "union (0x%x) of ", type
);
1761 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &nrec
);
1762 fprintf (f
, "%lu elements: ", nrec
);
1764 for (i
= 0; i
< nrec
; i
++)
1766 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &eloff
);
1768 fprintf (f
, "offset %lu: ", eloff
);
1769 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1775 fprintf (f
, "subrange (0x%x) of ", type
);
1776 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1777 fprintf (f
, " lower ");
1778 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1779 fprintf (f
, " upper ");
1780 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1787 fprintf (f
, "named type (0x%x) ", type
);
1788 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1790 fprintf (f
, "[INVALID]");
1792 fprintf (f
, "\"%.*s\"",
1793 bfd_sym_symbol_name (abfd
, value
)[0],
1794 &bfd_sym_symbol_name (abfd
, value
)[1]);
1796 fprintf (f
, " (NTE %lu) with type ", value
);
1797 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1802 fprintf (f
, "%s (0x%x)", bfd_sym_type_operator_name (type
), type
);
1806 if (type
== (0x40 | 0x6))
1813 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &n
);
1814 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &width
);
1815 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &m
);
1816 /* fprintf (f, "\n "); */
1817 fprintf (f
, " N %ld, width %ld, M %ld, ", n
, width
, m
);
1818 for (i
= 0; i
< m
; i
++)
1820 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &l
);
1823 fprintf (f
, "%ld", l
);
1826 else if (type
& 0x40)
1828 /* Other packed type. */
1831 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &msb
);
1832 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &lsb
);
1833 /* fprintf (f, "\n "); */
1834 fprintf (f
, " msb %ld, lsb %ld", msb
, lsb
);
1839 if (offsetptr
!= NULL
)
1840 *offsetptr
= offset
;
1844 bfd_sym_print_type_information_table_entry (abfd
, f
, entry
)
1847 bfd_sym_type_information_table_entry
*entry
;
1850 unsigned long offset
;
1853 fprintf (f
, "\"%.*s\" (NTE %lu), %lu bytes at %lu, logical size %lu",
1854 bfd_sym_symbol_name (abfd
, entry
->nte_index
)[0],
1855 &bfd_sym_symbol_name (abfd
, entry
->nte_index
)[1],
1857 entry
->physical_size
, entry
->offset
, entry
->logical_size
);
1861 buf
= alloca (entry
->physical_size
);
1864 fprintf (f
, "[ERROR]\n");
1867 if (bfd_seek (abfd
, entry
->offset
, SEEK_SET
) < 0)
1869 fprintf (f
, "[ERROR]\n");
1872 if (bfd_bread (buf
, entry
->physical_size
, abfd
) != entry
->physical_size
)
1874 fprintf (f
, "[ERROR]\n");
1879 for (i
= 0; i
< entry
->physical_size
; i
++)
1882 fprintf (f
, "0x%02x", buf
[i
]);
1884 fprintf (f
, " 0x%02x", buf
[i
]);
1890 bfd_sym_print_type_information (abfd
, f
, buf
, entry
->physical_size
, 0, &offset
);
1892 if (offset
!= entry
->physical_size
)
1893 fprintf (f
, "\n [parser used %lu bytes instead of %lu]", offset
, entry
->physical_size
); }
1896 bfd_sym_print_file_references_index_table_entry (abfd
, f
, entry
)
1897 bfd
*abfd ATTRIBUTE_UNUSED
;
1899 bfd_sym_file_references_index_table_entry
*entry ATTRIBUTE_UNUSED
;
1901 fprintf (f
, "[UNIMPLEMENTED]");
1905 bfd_sym_print_constant_pool_entry (abfd
, f
, entry
)
1906 bfd
*abfd ATTRIBUTE_UNUSED
;
1908 bfd_sym_constant_pool_entry
*entry ATTRIBUTE_UNUSED
;
1910 fprintf (f
, "[UNIMPLEMENTED]");
1914 bfd_sym_display_name_table_entry (abfd
, f
, entry
)
1917 unsigned char *entry
;
1919 unsigned long index
;
1920 unsigned long offset
;
1921 bfd_sym_data_struct
*sdata
= NULL
;
1923 BFD_ASSERT (bfd_sym_valid (abfd
));
1924 sdata
= abfd
->tdata
.sym_data
;
1925 index
= (entry
- sdata
->name_table
) / 2;
1927 if ((sdata
->version
>= BFD_SYM_VERSION_3_4
) && (entry
[0] == 255) && (entry
[1] == 0))
1929 unsigned short length
= bfd_getb16 (entry
+ 2);
1930 fprintf (f
, "[%8lu] \"%.*s\"\n", index
, length
, entry
+ 4);
1931 offset
= 2 + length
+ 1;
1935 if (! ((entry
[0] == 0) || ((entry
[0] == 1) && (entry
[1] == '\0'))))
1936 fprintf (f
, "[%8lu] \"%.*s\"\n", index
, entry
[0], entry
+ 1);
1938 if (sdata
->version
>= BFD_SYM_VERSION_3_4
)
1939 offset
= entry
[0] + 2;
1941 offset
= entry
[0] + 1;
1944 return (entry
+ offset
+ (offset
% 2));
1948 bfd_sym_display_name_table (abfd
, f
)
1952 unsigned long name_table_len
;
1953 unsigned char *name_table
, *name_table_end
, *cur
;
1954 bfd_sym_data_struct
*sdata
= NULL
;
1956 BFD_ASSERT (bfd_sym_valid (abfd
));
1957 sdata
= abfd
->tdata
.sym_data
;
1959 name_table_len
= sdata
->header
.dshb_nte
.dti_page_count
* sdata
->header
.dshb_page_size
;
1960 name_table
= sdata
->name_table
;
1961 name_table_end
= name_table
+ name_table_len
;
1963 fprintf (f
, "name table (NTE) contains %lu bytes:\n\n", name_table_len
);
1968 cur
= bfd_sym_display_name_table_entry (abfd
, f
, cur
);
1969 if (cur
>= name_table_end
)
1975 bfd_sym_display_resources_table (abfd
, f
)
1980 bfd_sym_resources_table_entry entry
;
1981 bfd_sym_data_struct
*sdata
= NULL
;
1983 BFD_ASSERT (bfd_sym_valid (abfd
));
1984 sdata
= abfd
->tdata
.sym_data
;
1986 fprintf (f
, "resource table (RTE) contains %lu objects:\n\n",
1987 sdata
->header
.dshb_rte
.dti_object_count
);
1989 for (i
= 1; i
<= sdata
->header
.dshb_rte
.dti_object_count
; i
++)
1991 if (bfd_sym_fetch_resources_table_entry (abfd
, &entry
, i
) < 0)
1992 fprintf (f
, " [%8lu] [INVALID]\n", i
);
1995 fprintf (f
, " [%8lu] ", i
);
1996 bfd_sym_print_resources_table_entry (abfd
, f
, &entry
);
2003 bfd_sym_display_modules_table (abfd
, f
)
2008 bfd_sym_modules_table_entry entry
;
2009 bfd_sym_data_struct
*sdata
= NULL
;
2011 BFD_ASSERT (bfd_sym_valid (abfd
));
2012 sdata
= abfd
->tdata
.sym_data
;
2014 fprintf (f
, "module table (MTE) contains %lu objects:\n\n",
2015 sdata
->header
.dshb_mte
.dti_object_count
);
2017 for (i
= 1; i
<= sdata
->header
.dshb_mte
.dti_object_count
; i
++)
2019 if (bfd_sym_fetch_modules_table_entry (abfd
, &entry
, i
) < 0)
2020 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2023 fprintf (f
, " [%8lu] ", i
);
2024 bfd_sym_print_modules_table_entry (abfd
, f
, &entry
);
2031 bfd_sym_display_file_references_table (abfd
, f
)
2036 bfd_sym_file_references_table_entry entry
;
2037 bfd_sym_data_struct
*sdata
= NULL
;
2039 BFD_ASSERT (bfd_sym_valid (abfd
));
2040 sdata
= abfd
->tdata
.sym_data
;
2042 fprintf (f
, "file reference table (FRTE) contains %lu objects:\n\n",
2043 sdata
->header
.dshb_frte
.dti_object_count
);
2045 for (i
= 1; i
<= sdata
->header
.dshb_frte
.dti_object_count
; i
++)
2047 if (bfd_sym_fetch_file_references_table_entry (abfd
, &entry
, i
) < 0)
2048 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2051 fprintf (f
, " [%8lu] ", i
);
2052 bfd_sym_print_file_references_table_entry (abfd
, f
, &entry
);
2059 bfd_sym_display_contained_modules_table (abfd
, f
)
2064 bfd_sym_contained_modules_table_entry entry
;
2065 bfd_sym_data_struct
*sdata
= NULL
;
2067 BFD_ASSERT (bfd_sym_valid (abfd
));
2068 sdata
= abfd
->tdata
.sym_data
;
2070 fprintf (f
, "contained modules table (CMTE) contains %lu objects:\n\n",
2071 sdata
->header
.dshb_cmte
.dti_object_count
);
2073 for (i
= 1; i
<= sdata
->header
.dshb_cmte
.dti_object_count
; i
++)
2075 if (bfd_sym_fetch_contained_modules_table_entry (abfd
, &entry
, i
) < 0)
2076 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2079 fprintf (f
, " [%8lu] ", i
);
2080 bfd_sym_print_contained_modules_table_entry (abfd
, f
, &entry
);
2087 bfd_sym_display_contained_variables_table (abfd
, f
)
2092 bfd_sym_contained_variables_table_entry entry
;
2093 bfd_sym_data_struct
*sdata
= NULL
;
2095 BFD_ASSERT (bfd_sym_valid (abfd
));
2096 sdata
= abfd
->tdata
.sym_data
;
2098 fprintf (f
, "contained variables table (CVTE) contains %lu objects:\n\n",
2099 sdata
->header
.dshb_cvte
.dti_object_count
);
2101 for (i
= 1; i
<= sdata
->header
.dshb_cvte
.dti_object_count
; i
++)
2103 if (bfd_sym_fetch_contained_variables_table_entry (abfd
, &entry
, i
) < 0)
2104 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2107 fprintf (f
, " [%8lu] ", i
);
2108 bfd_sym_print_contained_variables_table_entry (abfd
, f
, &entry
);
2117 bfd_sym_display_contained_statements_table (abfd
, f
)
2122 bfd_sym_contained_statements_table_entry entry
;
2123 bfd_sym_data_struct
*sdata
= NULL
;
2125 BFD_ASSERT (bfd_sym_valid (abfd
));
2126 sdata
= abfd
->tdata
.sym_data
;
2128 fprintf (f
, "contained statements table (CSNTE) contains %lu objects:\n\n",
2129 sdata
->header
.dshb_csnte
.dti_object_count
);
2131 for (i
= 1; i
<= sdata
->header
.dshb_csnte
.dti_object_count
; i
++)
2133 if (bfd_sym_fetch_contained_statements_table_entry (abfd
, &entry
, i
) < 0)
2134 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2137 fprintf (f
, " [%8lu] ", i
);
2138 bfd_sym_print_contained_statements_table_entry (abfd
, f
, &entry
);
2145 bfd_sym_display_contained_labels_table (abfd
, f
)
2150 bfd_sym_contained_labels_table_entry entry
;
2151 bfd_sym_data_struct
*sdata
= NULL
;
2153 BFD_ASSERT (bfd_sym_valid (abfd
));
2154 sdata
= abfd
->tdata
.sym_data
;
2156 fprintf (f
, "contained labels table (CLTE) contains %lu objects:\n\n",
2157 sdata
->header
.dshb_clte
.dti_object_count
);
2159 for (i
= 1; i
<= sdata
->header
.dshb_clte
.dti_object_count
; i
++)
2161 if (bfd_sym_fetch_contained_labels_table_entry (abfd
, &entry
, i
) < 0)
2162 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2165 fprintf (f
, " [%8lu] ", i
);
2166 bfd_sym_print_contained_labels_table_entry (abfd
, f
, &entry
);
2173 bfd_sym_display_contained_types_table (abfd
, f
)
2178 bfd_sym_contained_types_table_entry entry
;
2179 bfd_sym_data_struct
*sdata
= NULL
;
2181 BFD_ASSERT (bfd_sym_valid (abfd
));
2182 sdata
= abfd
->tdata
.sym_data
;
2184 fprintf (f
, "contained types table (CTTE) contains %lu objects:\n\n",
2185 sdata
->header
.dshb_ctte
.dti_object_count
);
2187 for (i
= 1; i
<= sdata
->header
.dshb_ctte
.dti_object_count
; i
++)
2189 if (bfd_sym_fetch_contained_types_table_entry (abfd
, &entry
, i
) < 0)
2190 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2193 fprintf (f
, " [%8lu] ", i
);
2194 bfd_sym_print_contained_types_table_entry (abfd
, f
, &entry
);
2201 bfd_sym_display_file_references_index_table (abfd
, f
)
2206 bfd_sym_file_references_index_table_entry entry
;
2207 bfd_sym_data_struct
*sdata
= NULL
;
2209 BFD_ASSERT (bfd_sym_valid (abfd
));
2210 sdata
= abfd
->tdata
.sym_data
;
2212 fprintf (f
, "file references index table (FITE) contains %lu objects:\n\n",
2213 sdata
->header
.dshb_fite
.dti_object_count
);
2215 for (i
= 1; i
<= sdata
->header
.dshb_fite
.dti_object_count
; i
++)
2217 if (bfd_sym_fetch_file_references_index_table_entry (abfd
, &entry
, i
) < 0)
2218 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2221 fprintf (f
, " [%8lu] ", i
);
2222 bfd_sym_print_file_references_index_table_entry (abfd
, f
, &entry
);
2229 bfd_sym_display_constant_pool (abfd
, f
)
2234 bfd_sym_constant_pool_entry entry
;
2235 bfd_sym_data_struct
*sdata
= NULL
;
2237 BFD_ASSERT (bfd_sym_valid (abfd
));
2238 sdata
= abfd
->tdata
.sym_data
;
2240 fprintf (f
, "constant pool (CONST) contains %lu objects:\n\n",
2241 sdata
->header
.dshb_const
.dti_object_count
);
2243 for (i
= 1; i
<= sdata
->header
.dshb_const
.dti_object_count
; i
++)
2245 if (bfd_sym_fetch_constant_pool_entry (abfd
, &entry
, i
) < 0)
2246 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2249 fprintf (f
, " [%8lu] ", i
);
2250 bfd_sym_print_constant_pool_entry (abfd
, f
, &entry
);
2257 bfd_sym_display_type_information_table (abfd
, f
)
2262 bfd_sym_type_table_entry index
;
2263 bfd_sym_type_information_table_entry entry
;
2264 bfd_sym_data_struct
*sdata
= NULL
;
2266 BFD_ASSERT (bfd_sym_valid (abfd
));
2267 sdata
= abfd
->tdata
.sym_data
;
2269 if (sdata
->header
.dshb_tte
.dti_object_count
> 99)
2270 fprintf (f
, "type table (TINFO) contains %lu objects:\n\n",
2271 sdata
->header
.dshb_tte
.dti_object_count
- 99);
2274 fprintf (f
, "type table (TINFO) contains [INVALID] objects:\n\n");
2278 for (i
= 100; i
<= sdata
->header
.dshb_tte
.dti_object_count
; i
++)
2280 if (bfd_sym_fetch_type_table_entry (abfd
, &index
, i
- 100) < 0)
2281 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2284 fprintf (f
, " [%8lu] (TINFO %lu) ", i
, index
);
2286 if (bfd_sym_fetch_type_information_table_entry (abfd
, &entry
, index
) < 0)
2287 fprintf (f
, "[INVALID]");
2289 bfd_sym_print_type_information_table_entry (abfd
, f
, &entry
);
2297 bfd_sym_object_p (abfd
)
2300 bfd_sym_data_struct
*mdata
= NULL
;
2302 const char *name
= "symbols";
2304 mdata
= ((bfd_sym_data_struct
*)
2305 bfd_alloc (abfd
, sizeof (bfd_sym_data_struct
)));
2309 abfd
->tdata
.sym_data
= mdata
;
2311 mdata
->name_table
= 0;
2314 bfd_seek (abfd
, 0, SEEK_SET
);
2315 if (bfd_sym_read_version (abfd
, &mdata
->version
) != 0)
2317 abfd
->tdata
.sym_data
= NULL
;
2318 bfd_set_error (bfd_error_wrong_format
);
2322 bfd_seek (abfd
, 0, SEEK_SET
);
2323 if (bfd_sym_read_header (abfd
, &mdata
->header
, mdata
->version
) != 0)
2325 abfd
->tdata
.sym_data
= NULL
;
2326 bfd_set_error (bfd_error_wrong_format
);
2330 mdata
->name_table
= bfd_sym_read_name_table (abfd
, &mdata
->header
);
2331 if (mdata
->name_table
== NULL
)
2333 abfd
->tdata
.sym_data
= NULL
;
2334 bfd_set_error (bfd_error_wrong_format
);
2338 bfdsec
= bfd_make_section_anyway (abfd
, name
);
2341 abfd
->tdata
.sym_data
= NULL
;
2342 bfd_set_error (bfd_error_wrong_format
);
2348 bfdsec
->_raw_size
= 0;
2349 bfdsec
->filepos
= 0;
2350 bfdsec
->alignment_power
= 0;
2352 bfdsec
->flags
= SEC_HAS_CONTENTS
;
2358 bfd_sym_make_empty_symbol (abfd
)
2361 return (asymbol
*) bfd_alloc (abfd
, sizeof (asymbol
));
2365 bfd_sym_get_symbol_info (abfd
, symbol
, ret
)
2366 bfd
*abfd ATTRIBUTE_UNUSED
;
2370 bfd_symbol_info (symbol
, ret
);
2374 bfd_sym_get_symtab_upper_bound (abfd
)
2375 bfd
*abfd ATTRIBUTE_UNUSED
;
2381 bfd_sym_get_symtab (abfd
, sym
)
2382 bfd
*abfd ATTRIBUTE_UNUSED
;
2383 asymbol
**sym ATTRIBUTE_UNUSED
;
2389 bfd_sym_sizeof_headers (abfd
, exec
)
2390 bfd
*abfd ATTRIBUTE_UNUSED
;
2391 boolean exec ATTRIBUTE_UNUSED
;
2396 const bfd_target sym_vec
=
2399 bfd_target_sym_flavour
, /* flavour */
2400 BFD_ENDIAN_BIG
, /* byteorder */
2401 BFD_ENDIAN_BIG
, /* header_byteorder */
2402 (HAS_RELOC
| EXEC_P
| /* object flags */
2403 HAS_LINENO
| HAS_DEBUG
|
2404 HAS_SYMS
| HAS_LOCALS
| DYNAMIC
| WP_TEXT
| D_PAGED
),
2405 (SEC_ALLOC
| SEC_LOAD
| SEC_READONLY
| SEC_CODE
| SEC_DATA
2406 | SEC_ROM
| SEC_HAS_CONTENTS
), /* section_flags */
2407 0, /* symbol_leading_char */
2408 ' ', /* ar_pad_char */
2409 16, /* ar_max_namelen */
2410 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2411 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2412 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* data */
2413 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2414 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2415 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* hdrs */
2416 { /* bfd_check_format */
2418 bfd_sym_object_p
, /* bfd_check_format */
2422 { /* bfd_set_format */
2428 { /* bfd_write_contents */
2435 BFD_JUMP_TABLE_GENERIC (bfd_sym
),
2436 BFD_JUMP_TABLE_COPY (_bfd_generic
),
2437 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
2438 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive
),
2439 BFD_JUMP_TABLE_SYMBOLS (bfd_sym
),
2440 BFD_JUMP_TABLE_RELOCS (bfd_sym
),
2441 BFD_JUMP_TABLE_WRITE (bfd_sym
),
2442 BFD_JUMP_TABLE_LINK (bfd_sym
),
2443 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),