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 #include "alloca-conf.h"
28 #define bfd_sym_close_and_cleanup _bfd_generic_close_and_cleanup
29 #define bfd_sym_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
30 #define bfd_sym_new_section_hook _bfd_generic_new_section_hook
31 #define bfd_sym_bfd_is_local_label_name bfd_generic_is_local_label_name
32 #define bfd_sym_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
33 #define bfd_sym_get_lineno _bfd_nosymbols_get_lineno
34 #define bfd_sym_find_nearest_line _bfd_nosymbols_find_nearest_line
35 #define bfd_sym_find_inliner_info _bfd_nosymbols_find_inliner_info
36 #define bfd_sym_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
37 #define bfd_sym_read_minisymbols _bfd_generic_read_minisymbols
38 #define bfd_sym_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
39 #define bfd_sym_set_arch_mach _bfd_generic_set_arch_mach
40 #define bfd_sym_get_section_contents _bfd_generic_get_section_contents
41 #define bfd_sym_set_section_contents _bfd_generic_set_section_contents
42 #define bfd_sym_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
43 #define bfd_sym_bfd_relax_section bfd_generic_relax_section
44 #define bfd_sym_bfd_gc_sections bfd_generic_gc_sections
45 #define bfd_sym_bfd_lookup_section_flags bfd_generic_lookup_section_flags
46 #define bfd_sym_bfd_merge_sections bfd_generic_merge_sections
47 #define bfd_sym_bfd_is_group_section bfd_generic_is_group_section
48 #define bfd_sym_bfd_discard_group bfd_generic_discard_group
49 #define bfd_sym_section_already_linked _bfd_generic_section_already_linked
50 #define bfd_sym_bfd_define_common_symbol bfd_generic_define_common_symbol
51 #define bfd_sym_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
52 #define bfd_sym_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
53 #define bfd_sym_bfd_link_add_symbols _bfd_generic_link_add_symbols
54 #define bfd_sym_bfd_link_just_syms _bfd_generic_link_just_syms
55 #define bfd_sym_bfd_copy_link_hash_symbol_type \
56 _bfd_generic_copy_link_hash_symbol_type
57 #define bfd_sym_bfd_final_link _bfd_generic_final_link
58 #define bfd_sym_bfd_link_split_section _bfd_generic_link_split_section
59 #define bfd_sym_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
61 extern const bfd_target sym_vec
;
64 pstrcmp (const char *as
, const char *bs
)
66 const unsigned char *a
= (const unsigned char *) as
;
67 const unsigned char *b
= (const unsigned char *) bs
;
71 clen
= (a
[0] > b
[0]) ? b
[0] : a
[0];
72 ret
= memcmp (a
+ 1, b
+ 1, clen
);
85 compute_offset (unsigned long first_page
,
86 unsigned long page_size
,
87 unsigned long entry_size
,
88 unsigned long sym_index
)
90 unsigned long entries_per_page
= page_size
/ entry_size
;
91 unsigned long page_number
= first_page
+ (sym_index
/ entries_per_page
);
92 unsigned long page_offset
= (sym_index
% entries_per_page
) * entry_size
;
94 return (page_number
* page_size
) + page_offset
;
98 bfd_sym_mkobject (bfd
*abfd ATTRIBUTE_UNUSED
)
104 bfd_sym_print_symbol (bfd
*abfd ATTRIBUTE_UNUSED
,
105 void * afile ATTRIBUTE_UNUSED
,
106 asymbol
*symbol ATTRIBUTE_UNUSED
,
107 bfd_print_symbol_type how ATTRIBUTE_UNUSED
)
113 bfd_sym_valid (bfd
*abfd
)
115 if (abfd
== NULL
|| abfd
->xvec
== NULL
)
118 return abfd
->xvec
== &sym_vec
;
122 bfd_sym_read_name_table (bfd
*abfd
, bfd_sym_header_block
*dshb
)
126 size_t table_size
= dshb
->dshb_nte
.dti_page_count
* dshb
->dshb_page_size
;
127 size_t table_offset
= dshb
->dshb_nte
.dti_first_page
* dshb
->dshb_page_size
;
129 rstr
= bfd_alloc (abfd
, table_size
);
133 bfd_seek (abfd
, table_offset
, SEEK_SET
);
134 ret
= bfd_bread (rstr
, table_size
, abfd
);
135 if (ret
< 0 || (unsigned long) ret
!= table_size
)
137 bfd_release (abfd
, rstr
);
145 bfd_sym_parse_file_reference_v32 (unsigned char *buf
,
147 bfd_sym_file_reference
*entry
)
149 BFD_ASSERT (len
== 6);
151 entry
->fref_frte_index
= bfd_getb16 (buf
);
152 entry
->fref_offset
= bfd_getb32 (buf
+ 2);
156 bfd_sym_parse_disk_table_v32 (unsigned char *buf
,
158 bfd_sym_table_info
*table
)
160 BFD_ASSERT (len
== 8);
162 table
->dti_first_page
= bfd_getb16 (buf
);
163 table
->dti_page_count
= bfd_getb16 (buf
+ 2);
164 table
->dti_object_count
= bfd_getb32 (buf
+ 4);
168 bfd_sym_parse_header_v32 (unsigned char *buf
,
170 bfd_sym_header_block
*header
)
172 BFD_ASSERT (len
== 154);
174 memcpy (header
->dshb_id
, buf
, 32);
175 header
->dshb_page_size
= bfd_getb16 (buf
+ 32);
176 header
->dshb_hash_page
= bfd_getb16 (buf
+ 34);
177 header
->dshb_root_mte
= bfd_getb16 (buf
+ 36);
178 header
->dshb_mod_date
= bfd_getb32 (buf
+ 38);
180 bfd_sym_parse_disk_table_v32 (buf
+ 42, 8, &header
->dshb_frte
);
181 bfd_sym_parse_disk_table_v32 (buf
+ 50, 8, &header
->dshb_rte
);
182 bfd_sym_parse_disk_table_v32 (buf
+ 58, 8, &header
->dshb_mte
);
183 bfd_sym_parse_disk_table_v32 (buf
+ 66, 8, &header
->dshb_cmte
);
184 bfd_sym_parse_disk_table_v32 (buf
+ 74, 8, &header
->dshb_cvte
);
185 bfd_sym_parse_disk_table_v32 (buf
+ 82, 8, &header
->dshb_csnte
);
186 bfd_sym_parse_disk_table_v32 (buf
+ 90, 8, &header
->dshb_clte
);
187 bfd_sym_parse_disk_table_v32 (buf
+ 98, 8, &header
->dshb_ctte
);
188 bfd_sym_parse_disk_table_v32 (buf
+ 106, 8, &header
->dshb_tte
);
189 bfd_sym_parse_disk_table_v32 (buf
+ 114, 8, &header
->dshb_nte
);
190 bfd_sym_parse_disk_table_v32 (buf
+ 122, 8, &header
->dshb_tinfo
);
191 bfd_sym_parse_disk_table_v32 (buf
+ 130, 8, &header
->dshb_fite
);
192 bfd_sym_parse_disk_table_v32 (buf
+ 138, 8, &header
->dshb_const
);
194 memcpy (&header
->dshb_file_creator
, buf
+ 146, 4);
195 memcpy (&header
->dshb_file_type
, buf
+ 150, 4);
199 bfd_sym_read_header_v32 (bfd
*abfd
, bfd_sym_header_block
*header
)
201 unsigned char buf
[154];
204 ret
= bfd_bread (buf
, 154, abfd
);
208 bfd_sym_parse_header_v32 (buf
, 154, header
);
214 bfd_sym_read_header_v34 (bfd
*abfd ATTRIBUTE_UNUSED
,
215 bfd_sym_header_block
*header ATTRIBUTE_UNUSED
)
221 bfd_sym_read_header (bfd
*abfd
,
222 bfd_sym_header_block
*header
,
223 bfd_sym_version version
)
227 case BFD_SYM_VERSION_3_5
:
228 case BFD_SYM_VERSION_3_4
:
229 return bfd_sym_read_header_v34 (abfd
, header
);
230 case BFD_SYM_VERSION_3_3
:
231 case BFD_SYM_VERSION_3_2
:
232 return bfd_sym_read_header_v32 (abfd
, header
);
233 case BFD_SYM_VERSION_3_1
:
240 bfd_sym_read_version (bfd
*abfd
, bfd_sym_version
*version
)
242 char version_string
[32];
245 ret
= bfd_bread (version_string
, sizeof (version_string
), abfd
);
246 if (ret
!= sizeof (version_string
))
249 if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_1
) == 0)
250 *version
= BFD_SYM_VERSION_3_1
;
251 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_2
) == 0)
252 *version
= BFD_SYM_VERSION_3_2
;
253 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_3
) == 0)
254 *version
= BFD_SYM_VERSION_3_3
;
255 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_4
) == 0)
256 *version
= BFD_SYM_VERSION_3_4
;
257 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_5
) == 0)
258 *version
= BFD_SYM_VERSION_3_5
;
266 bfd_sym_display_table_summary (FILE *f
,
267 bfd_sym_table_info
*dti
,
270 fprintf (f
, "%-6s %13ld %13ld %13ld\n",
274 dti
->dti_object_count
);
278 bfd_sym_display_header (FILE *f
, bfd_sym_header_block
*dshb
)
280 fprintf (f
, " Version: %.*s\n", dshb
->dshb_id
[0], dshb
->dshb_id
+ 1);
281 fprintf (f
, " Page Size: 0x%x\n", dshb
->dshb_page_size
);
282 fprintf (f
, " Hash Page: %lu\n", dshb
->dshb_hash_page
);
283 fprintf (f
, " Root MTE: %lu\n", dshb
->dshb_root_mte
);
284 fprintf (f
, " Modification Date: ");
285 fprintf (f
, "[unimplemented]");
286 fprintf (f
, " (0x%lx)\n", dshb
->dshb_mod_date
);
288 fprintf (f
, " File Creator: %.4s Type: %.4s\n\n",
289 dshb
->dshb_file_creator
, dshb
->dshb_file_type
);
291 fprintf (f
, "Table Name First Page Page Count Object Count\n");
292 fprintf (f
, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
294 bfd_sym_display_table_summary (f
, &dshb
->dshb_nte
, "NTE");
295 bfd_sym_display_table_summary (f
, &dshb
->dshb_rte
, "RTE");
296 bfd_sym_display_table_summary (f
, &dshb
->dshb_mte
, "MTE");
297 bfd_sym_display_table_summary (f
, &dshb
->dshb_frte
, "FRTE");
298 bfd_sym_display_table_summary (f
, &dshb
->dshb_cmte
, "CMTE");
299 bfd_sym_display_table_summary (f
, &dshb
->dshb_cvte
, "CVTE");
300 bfd_sym_display_table_summary (f
, &dshb
->dshb_csnte
, "CSNTE");
301 bfd_sym_display_table_summary (f
, &dshb
->dshb_clte
, "CLTE");
302 bfd_sym_display_table_summary (f
, &dshb
->dshb_ctte
, "CTTE");
303 bfd_sym_display_table_summary (f
, &dshb
->dshb_tte
, "TTE");
304 bfd_sym_display_table_summary (f
, &dshb
->dshb_tinfo
, "TINFO");
305 bfd_sym_display_table_summary (f
, &dshb
->dshb_fite
, "FITE");
306 bfd_sym_display_table_summary (f
, &dshb
->dshb_const
, "CONST");
312 bfd_sym_parse_resources_table_entry_v32 (unsigned char *buf
,
314 bfd_sym_resources_table_entry
*entry
)
316 BFD_ASSERT (len
== 18);
318 memcpy (&entry
->rte_res_type
, buf
, 4);
319 entry
->rte_res_number
= bfd_getb16 (buf
+ 4);
320 entry
->rte_nte_index
= bfd_getb32 (buf
+ 6);
321 entry
->rte_mte_first
= bfd_getb16 (buf
+ 10);
322 entry
->rte_mte_last
= bfd_getb16 (buf
+ 12);
323 entry
->rte_res_size
= bfd_getb32 (buf
+ 14);
327 bfd_sym_parse_modules_table_entry_v33 (unsigned char *buf
,
329 bfd_sym_modules_table_entry
*entry
)
331 BFD_ASSERT (len
== 46);
333 entry
->mte_rte_index
= bfd_getb16 (buf
);
334 entry
->mte_res_offset
= bfd_getb32 (buf
+ 2);
335 entry
->mte_size
= bfd_getb32 (buf
+ 6);
336 entry
->mte_kind
= buf
[10];
337 entry
->mte_scope
= buf
[11];
338 entry
->mte_parent
= bfd_getb16 (buf
+ 12);
339 bfd_sym_parse_file_reference_v32 (buf
+ 14, 6, &entry
->mte_imp_fref
);
340 entry
->mte_imp_end
= bfd_getb32 (buf
+ 20);
341 entry
->mte_nte_index
= bfd_getb32 (buf
+ 24);
342 entry
->mte_cmte_index
= bfd_getb16 (buf
+ 28);
343 entry
->mte_cvte_index
= bfd_getb32 (buf
+ 30);
344 entry
->mte_clte_index
= bfd_getb16 (buf
+ 34);
345 entry
->mte_ctte_index
= bfd_getb16 (buf
+ 36);
346 entry
->mte_csnte_idx_1
= bfd_getb32 (buf
+ 38);
347 entry
->mte_csnte_idx_2
= bfd_getb32 (buf
+ 42);
351 bfd_sym_parse_file_references_table_entry_v32 (unsigned char *buf
,
353 bfd_sym_file_references_table_entry
*entry
)
357 BFD_ASSERT (len
== 10);
359 memset (entry
, 0, sizeof (bfd_sym_file_references_table_entry
));
360 type
= bfd_getb16 (buf
);
364 case BFD_SYM_END_OF_LIST_3_2
:
365 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
368 case BFD_SYM_FILE_NAME_INDEX_3_2
:
369 entry
->filename
.type
= BFD_SYM_FILE_NAME_INDEX
;
370 entry
->filename
.nte_index
= bfd_getb32 (buf
+ 2);
371 entry
->filename
.mod_date
= bfd_getb32 (buf
+ 6);
375 entry
->entry
.mte_index
= type
;
376 entry
->entry
.file_offset
= bfd_getb32 (buf
+ 2);
381 bfd_sym_parse_contained_modules_table_entry_v32 (unsigned char *buf
,
383 bfd_sym_contained_modules_table_entry
*entry
)
387 BFD_ASSERT (len
== 6);
389 memset (entry
, 0, sizeof (bfd_sym_contained_modules_table_entry
));
390 type
= bfd_getb16 (buf
);
394 case BFD_SYM_END_OF_LIST_3_2
:
395 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
399 entry
->entry
.mte_index
= type
;
400 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 2);
406 bfd_sym_parse_contained_variables_table_entry_v32 (unsigned char *buf
,
408 bfd_sym_contained_variables_table_entry
*entry
)
412 BFD_ASSERT (len
== 26);
414 memset (entry
, 0, sizeof (bfd_sym_contained_variables_table_entry
));
415 type
= bfd_getb16 (buf
);
419 case BFD_SYM_END_OF_LIST_3_2
:
420 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
423 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
424 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
425 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
429 entry
->entry
.tte_index
= type
;
430 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 2);
431 entry
->entry
.file_delta
= bfd_getb16 (buf
+ 6);
432 entry
->entry
.scope
= buf
[8];
433 entry
->entry
.la_size
= buf
[9];
435 if (entry
->entry
.la_size
== BFD_SYM_CVTE_SCA
)
437 entry
->entry
.address
.scstruct
.sca_kind
= buf
[10];
438 entry
->entry
.address
.scstruct
.sca_class
= buf
[11];
439 entry
->entry
.address
.scstruct
.sca_offset
= bfd_getb32 (buf
+ 12);
441 else if (entry
->entry
.la_size
<= BFD_SYM_CVTE_SCA
)
443 #if BFD_SYM_CVTE_SCA > 0
444 memcpy (&entry
->entry
.address
.lastruct
.la
, buf
+ 10,
447 entry
->entry
.address
.lastruct
.la_kind
= buf
[23];
449 else if (entry
->entry
.la_size
== BFD_SYM_CVTE_BIG_LA
)
451 entry
->entry
.address
.biglastruct
.big_la
= bfd_getb32 (buf
+ 10);
452 entry
->entry
.address
.biglastruct
.big_la_kind
= buf
[12];
458 bfd_sym_parse_contained_statements_table_entry_v32 (unsigned char *buf
,
460 bfd_sym_contained_statements_table_entry
*entry
)
464 BFD_ASSERT (len
== 8);
466 memset (entry
, 0, sizeof (bfd_sym_contained_statements_table_entry
));
467 type
= bfd_getb16 (buf
);
471 case BFD_SYM_END_OF_LIST_3_2
:
472 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
475 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
476 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
477 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
481 entry
->entry
.mte_index
= type
;
482 entry
->entry
.mte_offset
= bfd_getb16 (buf
+ 2);
483 entry
->entry
.file_delta
= bfd_getb32 (buf
+ 4);
489 bfd_sym_parse_contained_labels_table_entry_v32 (unsigned char *buf
,
491 bfd_sym_contained_labels_table_entry
*entry
)
495 BFD_ASSERT (len
== 12);
497 memset (entry
, 0, sizeof (bfd_sym_contained_labels_table_entry
));
498 type
= bfd_getb16 (buf
);
502 case BFD_SYM_END_OF_LIST_3_2
:
503 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
506 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
507 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
508 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
512 entry
->entry
.mte_index
= type
;
513 entry
->entry
.mte_offset
= bfd_getb16 (buf
+ 2);
514 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 4);
515 entry
->entry
.file_delta
= bfd_getb16 (buf
+ 8);
516 entry
->entry
.scope
= bfd_getb16 (buf
+ 10);
522 bfd_sym_parse_type_table_entry_v32 (unsigned char *buf
,
524 bfd_sym_type_table_entry
*entry
)
526 BFD_ASSERT (len
== 4);
528 *entry
= bfd_getb32 (buf
);
532 bfd_sym_fetch_resources_table_entry (bfd
*abfd
,
533 bfd_sym_resources_table_entry
*entry
,
534 unsigned long sym_index
)
536 void (*parser
) (unsigned char *, size_t, bfd_sym_resources_table_entry
*);
537 unsigned long offset
;
538 unsigned long entry_size
;
539 unsigned char buf
[18];
540 bfd_sym_data_struct
*sdata
= NULL
;
543 BFD_ASSERT (bfd_sym_valid (abfd
));
544 sdata
= abfd
->tdata
.sym_data
;
549 switch (sdata
->version
)
551 case BFD_SYM_VERSION_3_5
:
552 case BFD_SYM_VERSION_3_4
:
555 case BFD_SYM_VERSION_3_3
:
556 case BFD_SYM_VERSION_3_2
:
558 parser
= bfd_sym_parse_resources_table_entry_v32
;
561 case BFD_SYM_VERSION_3_1
:
568 offset
= compute_offset (sdata
->header
.dshb_rte
.dti_first_page
,
569 sdata
->header
.dshb_page_size
,
570 entry_size
, sym_index
);
572 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
574 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
577 (*parser
) (buf
, entry_size
, entry
);
583 bfd_sym_fetch_modules_table_entry (bfd
*abfd
,
584 bfd_sym_modules_table_entry
*entry
,
585 unsigned long sym_index
)
587 void (*parser
) (unsigned char *, size_t, bfd_sym_modules_table_entry
*);
588 unsigned long offset
;
589 unsigned long entry_size
;
590 unsigned char buf
[46];
591 bfd_sym_data_struct
*sdata
= NULL
;
594 BFD_ASSERT (bfd_sym_valid (abfd
));
595 sdata
= abfd
->tdata
.sym_data
;
600 switch (sdata
->version
)
602 case BFD_SYM_VERSION_3_5
:
603 case BFD_SYM_VERSION_3_4
:
606 case BFD_SYM_VERSION_3_3
:
608 parser
= bfd_sym_parse_modules_table_entry_v33
;
611 case BFD_SYM_VERSION_3_2
:
612 case BFD_SYM_VERSION_3_1
:
619 offset
= compute_offset (sdata
->header
.dshb_mte
.dti_first_page
,
620 sdata
->header
.dshb_page_size
,
621 entry_size
, sym_index
);
623 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
625 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
628 (*parser
) (buf
, entry_size
, entry
);
634 bfd_sym_fetch_file_references_table_entry (bfd
*abfd
,
635 bfd_sym_file_references_table_entry
*entry
,
636 unsigned long sym_index
)
638 void (*parser
) (unsigned char *, size_t, bfd_sym_file_references_table_entry
*);
639 unsigned long offset
;
640 unsigned long entry_size
= 0;
641 unsigned char buf
[8];
642 bfd_sym_data_struct
*sdata
= NULL
;
645 BFD_ASSERT (bfd_sym_valid (abfd
));
646 sdata
= abfd
->tdata
.sym_data
;
651 switch (sdata
->version
)
653 case BFD_SYM_VERSION_3_3
:
654 case BFD_SYM_VERSION_3_2
:
656 parser
= bfd_sym_parse_file_references_table_entry_v32
;
659 case BFD_SYM_VERSION_3_5
:
660 case BFD_SYM_VERSION_3_4
:
661 case BFD_SYM_VERSION_3_1
:
669 offset
= compute_offset (sdata
->header
.dshb_frte
.dti_first_page
,
670 sdata
->header
.dshb_page_size
,
671 entry_size
, sym_index
);
673 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
675 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
678 (*parser
) (buf
, entry_size
, entry
);
684 bfd_sym_fetch_contained_modules_table_entry (bfd
*abfd
,
685 bfd_sym_contained_modules_table_entry
*entry
,
686 unsigned long sym_index
)
688 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_modules_table_entry
*);
689 unsigned long offset
;
690 unsigned long entry_size
= 0;
691 unsigned char buf
[6];
692 bfd_sym_data_struct
*sdata
= NULL
;
695 BFD_ASSERT (bfd_sym_valid (abfd
));
696 sdata
= abfd
->tdata
.sym_data
;
701 switch (sdata
->version
)
703 case BFD_SYM_VERSION_3_3
:
704 case BFD_SYM_VERSION_3_2
:
706 parser
= bfd_sym_parse_contained_modules_table_entry_v32
;
709 case BFD_SYM_VERSION_3_5
:
710 case BFD_SYM_VERSION_3_4
:
711 case BFD_SYM_VERSION_3_1
:
719 offset
= compute_offset (sdata
->header
.dshb_cmte
.dti_first_page
,
720 sdata
->header
.dshb_page_size
,
721 entry_size
, sym_index
);
723 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
725 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
728 (*parser
) (buf
, entry_size
, entry
);
734 bfd_sym_fetch_contained_variables_table_entry (bfd
*abfd
,
735 bfd_sym_contained_variables_table_entry
*entry
,
736 unsigned long sym_index
)
738 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_variables_table_entry
*);
739 unsigned long offset
;
740 unsigned long entry_size
= 0;
741 unsigned char buf
[26];
742 bfd_sym_data_struct
*sdata
= NULL
;
745 BFD_ASSERT (bfd_sym_valid (abfd
));
746 sdata
= abfd
->tdata
.sym_data
;
751 switch (sdata
->version
)
753 case BFD_SYM_VERSION_3_3
:
754 case BFD_SYM_VERSION_3_2
:
756 parser
= bfd_sym_parse_contained_variables_table_entry_v32
;
759 case BFD_SYM_VERSION_3_5
:
760 case BFD_SYM_VERSION_3_4
:
761 case BFD_SYM_VERSION_3_1
:
769 offset
= compute_offset (sdata
->header
.dshb_cvte
.dti_first_page
,
770 sdata
->header
.dshb_page_size
,
771 entry_size
, sym_index
);
773 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
775 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
778 (*parser
) (buf
, entry_size
, entry
);
784 bfd_sym_fetch_contained_statements_table_entry (bfd
*abfd
,
785 bfd_sym_contained_statements_table_entry
*entry
,
786 unsigned long sym_index
)
788 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_statements_table_entry
*);
789 unsigned long offset
;
790 unsigned long entry_size
= 0;
791 unsigned char buf
[8];
792 bfd_sym_data_struct
*sdata
= NULL
;
795 BFD_ASSERT (bfd_sym_valid (abfd
));
796 sdata
= abfd
->tdata
.sym_data
;
801 switch (sdata
->version
)
803 case BFD_SYM_VERSION_3_3
:
804 case BFD_SYM_VERSION_3_2
:
806 parser
= bfd_sym_parse_contained_statements_table_entry_v32
;
809 case BFD_SYM_VERSION_3_5
:
810 case BFD_SYM_VERSION_3_4
:
811 case BFD_SYM_VERSION_3_1
:
819 offset
= compute_offset (sdata
->header
.dshb_csnte
.dti_first_page
,
820 sdata
->header
.dshb_page_size
,
821 entry_size
, sym_index
);
823 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
825 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
828 (*parser
) (buf
, entry_size
, entry
);
834 bfd_sym_fetch_contained_labels_table_entry (bfd
*abfd
,
835 bfd_sym_contained_labels_table_entry
*entry
,
836 unsigned long sym_index
)
838 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_labels_table_entry
*);
839 unsigned long offset
;
840 unsigned long entry_size
= 0;
841 unsigned char buf
[12];
842 bfd_sym_data_struct
*sdata
= NULL
;
845 BFD_ASSERT (bfd_sym_valid (abfd
));
846 sdata
= abfd
->tdata
.sym_data
;
851 switch (sdata
->version
)
853 case BFD_SYM_VERSION_3_3
:
854 case BFD_SYM_VERSION_3_2
:
856 parser
= bfd_sym_parse_contained_labels_table_entry_v32
;
859 case BFD_SYM_VERSION_3_5
:
860 case BFD_SYM_VERSION_3_4
:
861 case BFD_SYM_VERSION_3_1
:
869 offset
= compute_offset (sdata
->header
.dshb_clte
.dti_first_page
,
870 sdata
->header
.dshb_page_size
,
871 entry_size
, sym_index
);
873 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
875 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
878 (*parser
) (buf
, entry_size
, entry
);
884 bfd_sym_fetch_contained_types_table_entry (bfd
*abfd
,
885 bfd_sym_contained_types_table_entry
*entry
,
886 unsigned long sym_index
)
888 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_types_table_entry
*);
889 unsigned long offset
;
890 unsigned long entry_size
= 0;
891 unsigned char buf
[0];
892 bfd_sym_data_struct
*sdata
= NULL
;
895 BFD_ASSERT (bfd_sym_valid (abfd
));
896 sdata
= abfd
->tdata
.sym_data
;
901 switch (sdata
->version
)
903 case BFD_SYM_VERSION_3_3
:
904 case BFD_SYM_VERSION_3_2
:
909 case BFD_SYM_VERSION_3_5
:
910 case BFD_SYM_VERSION_3_4
:
911 case BFD_SYM_VERSION_3_1
:
919 offset
= compute_offset (sdata
->header
.dshb_ctte
.dti_first_page
,
920 sdata
->header
.dshb_page_size
,
921 entry_size
, sym_index
);
923 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
925 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
928 (*parser
) (buf
, entry_size
, entry
);
934 bfd_sym_fetch_file_references_index_table_entry (bfd
*abfd
,
935 bfd_sym_file_references_index_table_entry
*entry
,
936 unsigned long sym_index
)
938 void (*parser
) (unsigned char *, size_t, bfd_sym_file_references_index_table_entry
*);
939 unsigned long offset
;
940 unsigned long entry_size
= 0;
941 unsigned char buf
[0];
942 bfd_sym_data_struct
*sdata
= NULL
;
945 BFD_ASSERT (bfd_sym_valid (abfd
));
946 sdata
= abfd
->tdata
.sym_data
;
951 switch (sdata
->version
)
953 case BFD_SYM_VERSION_3_3
:
954 case BFD_SYM_VERSION_3_2
:
959 case BFD_SYM_VERSION_3_5
:
960 case BFD_SYM_VERSION_3_4
:
961 case BFD_SYM_VERSION_3_1
:
969 offset
= compute_offset (sdata
->header
.dshb_fite
.dti_first_page
,
970 sdata
->header
.dshb_page_size
,
971 entry_size
, sym_index
);
973 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
975 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
978 (*parser
) (buf
, entry_size
, entry
);
984 bfd_sym_fetch_constant_pool_entry (bfd
*abfd
,
985 bfd_sym_constant_pool_entry
*entry
,
986 unsigned long sym_index
)
988 void (*parser
) (unsigned char *, size_t, bfd_sym_constant_pool_entry
*);
989 unsigned long offset
;
990 unsigned long entry_size
= 0;
991 unsigned char buf
[0];
992 bfd_sym_data_struct
*sdata
= NULL
;
995 BFD_ASSERT (bfd_sym_valid (abfd
));
996 sdata
= abfd
->tdata
.sym_data
;
1001 switch (sdata
->version
)
1003 case BFD_SYM_VERSION_3_3
:
1004 case BFD_SYM_VERSION_3_2
:
1009 case BFD_SYM_VERSION_3_5
:
1010 case BFD_SYM_VERSION_3_4
:
1011 case BFD_SYM_VERSION_3_1
:
1019 offset
= compute_offset (sdata
->header
.dshb_fite
.dti_first_page
,
1020 sdata
->header
.dshb_page_size
,
1021 entry_size
, sym_index
);
1023 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1025 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1028 (*parser
) (buf
, entry_size
, entry
);
1034 bfd_sym_fetch_type_table_entry (bfd
*abfd
,
1035 bfd_sym_type_table_entry
*entry
,
1036 unsigned long sym_index
)
1038 void (*parser
) (unsigned char *, size_t, bfd_sym_type_table_entry
*);
1039 unsigned long offset
;
1040 unsigned long entry_size
= 0;
1041 unsigned char buf
[4];
1042 bfd_sym_data_struct
*sdata
= NULL
;
1045 BFD_ASSERT (bfd_sym_valid (abfd
));
1046 sdata
= abfd
->tdata
.sym_data
;
1048 switch (sdata
->version
)
1050 case BFD_SYM_VERSION_3_3
:
1051 case BFD_SYM_VERSION_3_2
:
1053 parser
= bfd_sym_parse_type_table_entry_v32
;
1056 case BFD_SYM_VERSION_3_5
:
1057 case BFD_SYM_VERSION_3_4
:
1058 case BFD_SYM_VERSION_3_1
:
1066 offset
= compute_offset (sdata
->header
.dshb_tte
.dti_first_page
,
1067 sdata
->header
.dshb_page_size
,
1068 entry_size
, sym_index
);
1070 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1072 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1075 (*parser
) (buf
, entry_size
, entry
);
1081 bfd_sym_fetch_type_information_table_entry (bfd
*abfd
,
1082 bfd_sym_type_information_table_entry
*entry
,
1083 unsigned long offset
)
1085 unsigned char buf
[4];
1087 BFD_ASSERT (bfd_sym_valid (abfd
));
1092 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1095 if (bfd_bread (buf
, 4, abfd
) != 4)
1097 entry
->nte_index
= bfd_getb32 (buf
);
1099 if (bfd_bread (buf
, 2, abfd
) != 2)
1101 entry
->physical_size
= bfd_getb16 (buf
);
1103 if (entry
->physical_size
& 0x8000)
1105 if (bfd_bread (buf
, 4, abfd
) != 4)
1107 entry
->physical_size
&= 0x7fff;
1108 entry
->logical_size
= bfd_getb32 (buf
);
1109 entry
->offset
= offset
+ 10;
1113 if (bfd_bread (buf
, 2, abfd
) != 2)
1115 entry
->physical_size
&= 0x7fff;
1116 entry
->logical_size
= bfd_getb16 (buf
);
1117 entry
->offset
= offset
+ 8;
1124 bfd_sym_fetch_type_table_information (bfd
*abfd
,
1125 bfd_sym_type_information_table_entry
*entry
,
1126 unsigned long sym_index
)
1128 bfd_sym_type_table_entry tindex
;
1129 bfd_sym_data_struct
*sdata
= NULL
;
1131 BFD_ASSERT (bfd_sym_valid (abfd
));
1132 sdata
= abfd
->tdata
.sym_data
;
1134 if (sdata
->header
.dshb_tte
.dti_object_count
<= 99)
1136 if (sym_index
< 100)
1139 if (bfd_sym_fetch_type_table_entry (abfd
, &tindex
, sym_index
- 100) < 0)
1141 if (bfd_sym_fetch_type_information_table_entry (abfd
, entry
, tindex
) < 0)
1147 const unsigned char *
1148 bfd_sym_symbol_name (bfd
*abfd
, unsigned long sym_index
)
1150 bfd_sym_data_struct
*sdata
= NULL
;
1152 BFD_ASSERT (bfd_sym_valid (abfd
));
1153 sdata
= abfd
->tdata
.sym_data
;
1156 return (const unsigned char *) "";
1159 if ((sym_index
/ sdata
->header
.dshb_page_size
)
1160 > sdata
->header
.dshb_nte
.dti_page_count
)
1161 return (const unsigned char *) "\09[INVALID]";
1163 return (const unsigned char *) sdata
->name_table
+ sym_index
;
1166 const unsigned char *
1167 bfd_sym_module_name (bfd
*abfd
, unsigned long sym_index
)
1169 bfd_sym_modules_table_entry entry
;
1171 if (bfd_sym_fetch_modules_table_entry (abfd
, &entry
, sym_index
) < 0)
1172 return (const unsigned char *) "\09[INVALID]";
1174 return bfd_sym_symbol_name (abfd
, entry
.mte_nte_index
);
1178 bfd_sym_unparse_storage_kind (enum bfd_sym_storage_kind kind
)
1182 case BFD_SYM_STORAGE_KIND_LOCAL
: return "LOCAL";
1183 case BFD_SYM_STORAGE_KIND_VALUE
: return "VALUE";
1184 case BFD_SYM_STORAGE_KIND_REFERENCE
: return "REFERENCE";
1185 case BFD_SYM_STORAGE_KIND_WITH
: return "WITH";
1186 default: return "[UNKNOWN]";
1191 bfd_sym_unparse_storage_class (enum bfd_sym_storage_class kind
)
1195 case BFD_SYM_STORAGE_CLASS_REGISTER
: return "REGISTER";
1196 case BFD_SYM_STORAGE_CLASS_GLOBAL
: return "GLOBAL";
1197 case BFD_SYM_STORAGE_CLASS_FRAME_RELATIVE
: return "FRAME_RELATIVE";
1198 case BFD_SYM_STORAGE_CLASS_STACK_RELATIVE
: return "STACK_RELATIVE";
1199 case BFD_SYM_STORAGE_CLASS_ABSOLUTE
: return "ABSOLUTE";
1200 case BFD_SYM_STORAGE_CLASS_CONSTANT
: return "CONSTANT";
1201 case BFD_SYM_STORAGE_CLASS_RESOURCE
: return "RESOURCE";
1202 case BFD_SYM_STORAGE_CLASS_BIGCONSTANT
: return "BIGCONSTANT";
1203 default: return "[UNKNOWN]";
1208 bfd_sym_unparse_module_kind (enum bfd_sym_module_kind kind
)
1212 case BFD_SYM_MODULE_KIND_NONE
: return "NONE";
1213 case BFD_SYM_MODULE_KIND_PROGRAM
: return "PROGRAM";
1214 case BFD_SYM_MODULE_KIND_UNIT
: return "UNIT";
1215 case BFD_SYM_MODULE_KIND_PROCEDURE
: return "PROCEDURE";
1216 case BFD_SYM_MODULE_KIND_FUNCTION
: return "FUNCTION";
1217 case BFD_SYM_MODULE_KIND_DATA
: return "DATA";
1218 case BFD_SYM_MODULE_KIND_BLOCK
: return "BLOCK";
1219 default: return "[UNKNOWN]";
1224 bfd_sym_unparse_symbol_scope (enum bfd_sym_symbol_scope scope
)
1228 case BFD_SYM_SYMBOL_SCOPE_LOCAL
: return "LOCAL";
1229 case BFD_SYM_SYMBOL_SCOPE_GLOBAL
: return "GLOBAL";
1236 bfd_sym_print_file_reference (bfd
*abfd
,
1238 bfd_sym_file_reference
*entry
)
1240 bfd_sym_file_references_table_entry frtentry
;
1243 ret
= bfd_sym_fetch_file_references_table_entry (abfd
, &frtentry
,
1244 entry
->fref_frte_index
);
1245 fprintf (f
, "FILE ");
1247 if ((ret
< 0) || (frtentry
.generic
.type
!= BFD_SYM_FILE_NAME_INDEX
))
1248 fprintf (f
, "[INVALID]");
1250 fprintf (f
, "\"%.*s\"",
1251 bfd_sym_symbol_name (abfd
, frtentry
.filename
.nte_index
)[0],
1252 &bfd_sym_symbol_name (abfd
, frtentry
.filename
.nte_index
)[1]);
1254 fprintf (f
, " (FRTE %lu)", entry
->fref_frte_index
);
1258 bfd_sym_print_resources_table_entry (bfd
*abfd
,
1260 bfd_sym_resources_table_entry
*entry
)
1262 fprintf (f
, " \"%.*s\" (NTE %lu), type \"%.4s\", num %u, size %lu, MTE %lu -- %lu",
1263 bfd_sym_symbol_name (abfd
, entry
->rte_nte_index
)[0],
1264 &bfd_sym_symbol_name (abfd
, entry
->rte_nte_index
)[1],
1265 entry
->rte_nte_index
, entry
->rte_res_type
, entry
->rte_res_number
,
1266 entry
->rte_res_size
, entry
->rte_mte_first
, entry
->rte_mte_last
);
1270 bfd_sym_print_modules_table_entry (bfd
*abfd
,
1272 bfd_sym_modules_table_entry
*entry
)
1274 fprintf (f
, "\"%.*s\" (NTE %lu)",
1275 bfd_sym_symbol_name (abfd
, entry
->mte_nte_index
)[0],
1276 &bfd_sym_symbol_name (abfd
, entry
->mte_nte_index
)[1],
1277 entry
->mte_nte_index
);
1281 bfd_sym_print_file_reference (abfd
, f
, &entry
->mte_imp_fref
);
1282 fprintf (f
, " range %lu -- %lu",
1283 entry
->mte_imp_fref
.fref_offset
, entry
->mte_imp_end
);
1287 fprintf (f
, "kind %s", bfd_sym_unparse_module_kind (entry
->mte_kind
));
1288 fprintf (f
, ", scope %s", bfd_sym_unparse_symbol_scope (entry
->mte_scope
));
1290 fprintf (f
, ", RTE %lu, offset %lu, size %lu",
1291 entry
->mte_rte_index
, entry
->mte_res_offset
, entry
->mte_size
);
1295 fprintf (f
, "CMTE %lu, CVTE %lu, CLTE %lu, CTTE %lu, CSNTE1 %lu, CSNTE2 %lu",
1296 entry
->mte_cmte_index
, entry
->mte_cvte_index
,
1297 entry
->mte_clte_index
, entry
->mte_ctte_index
,
1298 entry
->mte_csnte_idx_1
, entry
->mte_csnte_idx_2
);
1300 if (entry
->mte_parent
!= 0)
1301 fprintf (f
, ", parent %lu", entry
->mte_parent
);
1303 fprintf (f
, ", no parent");
1305 if (entry
->mte_cmte_index
!= 0)
1306 fprintf (f
, ", child %lu", entry
->mte_cmte_index
);
1308 fprintf (f
, ", no child");
1312 bfd_sym_print_file_references_table_entry (bfd
*abfd
,
1314 bfd_sym_file_references_table_entry
*entry
)
1316 switch (entry
->generic
.type
)
1318 case BFD_SYM_FILE_NAME_INDEX
:
1319 fprintf (f
, "FILE \"%.*s\" (NTE %lu), modtime ",
1320 bfd_sym_symbol_name (abfd
, entry
->filename
.nte_index
)[0],
1321 &bfd_sym_symbol_name (abfd
, entry
->filename
.nte_index
)[1],
1322 entry
->filename
.nte_index
);
1324 fprintf (f
, "[UNIMPLEMENTED]");
1325 /* printModDate (entry->filename.mod_date); */
1326 fprintf (f
, " (0x%lx)", entry
->filename
.mod_date
);
1329 case BFD_SYM_END_OF_LIST
:
1334 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu",
1335 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1336 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1337 entry
->entry
.mte_index
,
1338 entry
->entry
.file_offset
);
1344 bfd_sym_print_contained_modules_table_entry (bfd
*abfd
,
1346 bfd_sym_contained_modules_table_entry
*entry
)
1348 switch (entry
->generic
.type
)
1350 case BFD_SYM_END_OF_LIST
:
1355 fprintf (f
, "\"%.*s\" (MTE %lu, NTE %lu)",
1356 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1357 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1358 entry
->entry
.mte_index
,
1359 entry
->entry
.nte_index
);
1365 bfd_sym_print_contained_variables_table_entry (bfd
*abfd
,
1367 bfd_sym_contained_variables_table_entry
*entry
)
1369 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1375 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1377 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1378 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1382 fprintf (f
, "\"%.*s\" (NTE %lu)",
1383 bfd_sym_symbol_name (abfd
, entry
->entry
.nte_index
)[0],
1384 &bfd_sym_symbol_name (abfd
, entry
->entry
.nte_index
)[1],
1385 entry
->entry
.nte_index
);
1387 fprintf (f
, ", TTE %lu", entry
->entry
.tte_index
);
1388 fprintf (f
, ", offset %lu", entry
->entry
.file_delta
);
1389 fprintf (f
, ", scope %s", bfd_sym_unparse_symbol_scope (entry
->entry
.scope
));
1391 if (entry
->entry
.la_size
== BFD_SYM_CVTE_SCA
)
1392 fprintf (f
, ", latype %s, laclass %s, laoffset %lu",
1393 bfd_sym_unparse_storage_kind (entry
->entry
.address
.scstruct
.sca_kind
),
1394 bfd_sym_unparse_storage_class (entry
->entry
.address
.scstruct
.sca_class
),
1395 entry
->entry
.address
.scstruct
.sca_offset
);
1396 else if (entry
->entry
.la_size
<= BFD_SYM_CVTE_LA_MAX_SIZE
)
1400 fprintf (f
, ", la [");
1401 for (i
= 0; i
< entry
->entry
.la_size
; i
++)
1402 fprintf (f
, "0x%02x ", entry
->entry
.address
.lastruct
.la
[i
]);
1405 else if (entry
->entry
.la_size
== BFD_SYM_CVTE_BIG_LA
)
1406 fprintf (f
, ", bigla %lu, biglakind %u",
1407 entry
->entry
.address
.biglastruct
.big_la
,
1408 entry
->entry
.address
.biglastruct
.big_la_kind
);
1411 fprintf (f
, ", la [INVALID]");
1415 bfd_sym_print_contained_statements_table_entry (bfd
*abfd
,
1417 bfd_sym_contained_statements_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\" (MTE %lu), offset %lu, delta %lu",
1433 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1434 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1435 entry
->entry
.mte_index
,
1436 entry
->entry
.mte_offset
,
1437 entry
->entry
.file_delta
);
1441 bfd_sym_print_contained_labels_table_entry (bfd
*abfd
,
1443 bfd_sym_contained_labels_table_entry
*entry
)
1445 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1451 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1453 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1454 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1458 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu, delta %lu, scope %s",
1459 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1460 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1461 entry
->entry
.mte_index
,
1462 entry
->entry
.mte_offset
,
1463 entry
->entry
.file_delta
,
1464 bfd_sym_unparse_symbol_scope (entry
->entry
.scope
));
1468 bfd_sym_print_contained_types_table_entry (bfd
*abfd ATTRIBUTE_UNUSED
,
1470 bfd_sym_contained_types_table_entry
*entry ATTRIBUTE_UNUSED
)
1472 fprintf (f
, "[UNIMPLEMENTED]");
1476 bfd_sym_type_operator_name (unsigned char num
)
1480 case 1: return "TTE";
1481 case 2: return "PointerTo";
1482 case 3: return "ScalarOf";
1483 case 4: return "ConstantOf";
1484 case 5: return "EnumerationOf";
1485 case 6: return "VectorOf";
1486 case 7: return "RecordOf";
1487 case 8: return "UnionOf";
1488 case 9: return "SubRangeOf";
1489 case 10: return "SetOf";
1490 case 11: return "NamedTypeOf";
1491 case 12: return "ProcOf";
1492 case 13: return "ValueOf";
1493 case 14: return "ArrayOf";
1494 default: return "[UNKNOWN OPERATOR]";
1499 bfd_sym_type_basic_name (unsigned char num
)
1503 case 0: return "void";
1504 case 1: return "pascal string";
1505 case 2: return "unsigned long";
1506 case 3: return "signed long";
1507 case 4: return "extended (10 bytes)";
1508 case 5: return "pascal boolean (1 byte)";
1509 case 6: return "unsigned byte";
1510 case 7: return "signed byte";
1511 case 8: return "character (1 byte)";
1512 case 9: return "wide character (2 bytes)";
1513 case 10: return "unsigned short";
1514 case 11: return "signed short";
1515 case 12: return "singled";
1516 case 13: return "double";
1517 case 14: return "extended (12 bytes)";
1518 case 15: return "computational (8 bytes)";
1519 case 16: return "c string";
1520 case 17: return "as-is string";
1521 default: return "[UNKNOWN BASIC TYPE]";
1526 bfd_sym_fetch_long (unsigned char *buf
,
1528 unsigned long offset
,
1529 unsigned long *offsetptr
,
1540 else if (! (buf
[offset
] & 0x80))
1542 *value
= buf
[offset
];
1546 else if (buf
[offset
] == 0xc0)
1548 if ((offset
+ 5) > len
)
1556 *value
= bfd_getb32 (buf
+ offset
+ 1);
1561 else if ((buf
[offset
] & 0xc0) == 0xc0)
1563 *value
= -(buf
[offset
] & 0x3f);
1567 else if ((buf
[offset
] & 0xc0) == 0x80)
1569 if ((offset
+ 2) > len
)
1577 *value
= bfd_getb16 (buf
+ offset
) & 0x3fff;
1585 if (offsetptr
!= NULL
)
1586 *offsetptr
= offset
;
1592 bfd_sym_print_type_information (bfd
*abfd
,
1596 unsigned long offset
,
1597 unsigned long *offsetptr
)
1603 fprintf (f
, "[NULL]");
1605 if (offsetptr
!= NULL
)
1606 *offsetptr
= offset
;
1613 if (! (type
& 0x80))
1615 fprintf (f
, "[%s] (0x%x)", bfd_sym_type_basic_name (type
& 0x7f), type
);
1617 if (offsetptr
!= NULL
)
1618 *offsetptr
= offset
;
1623 fprintf (f
, "[packed ");
1627 switch (type
& 0x3f)
1632 bfd_sym_type_information_table_entry tinfo
;
1634 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1636 fprintf (f
, "[INVALID]");
1639 if (bfd_sym_fetch_type_table_information (abfd
, &tinfo
, value
) < 0)
1640 fprintf (f
, "[INVALID]");
1642 fprintf (f
, "\"%.*s\"",
1643 bfd_sym_symbol_name (abfd
, tinfo
.nte_index
)[0],
1644 &bfd_sym_symbol_name (abfd
, tinfo
.nte_index
)[1]);
1646 fprintf (f
, " (TTE %lu)", (unsigned long) value
);
1651 fprintf (f
, "pointer (0x%x) to ", type
);
1652 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1659 fprintf (f
, "scalar (0x%x) of ", type
);
1660 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1661 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1662 fprintf (f
, " (%lu)", (unsigned long) value
);
1668 long lower
, upper
, nelem
;
1671 fprintf (f
, "enumeration (0x%x) of ", type
);
1672 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1673 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &lower
);
1674 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &upper
);
1675 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &nelem
);
1676 fprintf (f
, " from %lu to %lu with %lu elements: ",
1677 (unsigned long) lower
, (unsigned long) upper
,
1678 (unsigned long) nelem
);
1680 for (i
= 0; i
< nelem
; i
++)
1683 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1689 fprintf (f
, "vector (0x%x)", type
);
1690 fprintf (f
, "\n index ");
1691 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1692 fprintf (f
, "\n target ");
1693 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1699 long nrec
, eloff
, i
;
1701 if ((type
& 0x3f) == 7)
1702 fprintf (f
, "record (0x%x) of ", type
);
1704 fprintf (f
, "union (0x%x) of ", type
);
1706 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &nrec
);
1707 fprintf (f
, "%lu elements: ", (unsigned long) nrec
);
1709 for (i
= 0; i
< nrec
; i
++)
1711 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &eloff
);
1713 fprintf (f
, "offset %lu: ", (unsigned long) eloff
);
1714 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1720 fprintf (f
, "subrange (0x%x) of ", type
);
1721 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1722 fprintf (f
, " lower ");
1723 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1724 fprintf (f
, " upper ");
1725 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1732 fprintf (f
, "named type (0x%x) ", type
);
1733 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1735 fprintf (f
, "[INVALID]");
1737 fprintf (f
, "\"%.*s\"",
1738 bfd_sym_symbol_name (abfd
, value
)[0],
1739 &bfd_sym_symbol_name (abfd
, value
)[1]);
1741 fprintf (f
, " (NTE %lu) with type ", (unsigned long) value
);
1742 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1747 fprintf (f
, "%s (0x%x)", bfd_sym_type_operator_name (type
), type
);
1751 if (type
== (0x40 | 0x6))
1758 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &n
);
1759 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &width
);
1760 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &m
);
1761 /* fprintf (f, "\n "); */
1762 fprintf (f
, " N %ld, width %ld, M %ld, ", n
, width
, m
);
1763 for (i
= 0; i
< m
; i
++)
1765 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &l
);
1768 fprintf (f
, "%ld", l
);
1771 else if (type
& 0x40)
1773 /* Other packed type. */
1776 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &msb
);
1777 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &lsb
);
1778 /* fprintf (f, "\n "); */
1779 fprintf (f
, " msb %ld, lsb %ld", msb
, lsb
);
1784 if (offsetptr
!= NULL
)
1785 *offsetptr
= offset
;
1789 bfd_sym_print_type_information_table_entry (bfd
*abfd
,
1791 bfd_sym_type_information_table_entry
*entry
)
1794 unsigned long offset
;
1797 fprintf (f
, "\"%.*s\" (NTE %lu), %lu bytes at %lu, logical size %lu",
1798 bfd_sym_symbol_name (abfd
, entry
->nte_index
)[0],
1799 &bfd_sym_symbol_name (abfd
, entry
->nte_index
)[1],
1801 entry
->physical_size
, entry
->offset
, entry
->logical_size
);
1805 buf
= alloca (entry
->physical_size
);
1808 fprintf (f
, "[ERROR]\n");
1811 if (bfd_seek (abfd
, entry
->offset
, SEEK_SET
) < 0)
1813 fprintf (f
, "[ERROR]\n");
1816 if (bfd_bread (buf
, entry
->physical_size
, abfd
) != entry
->physical_size
)
1818 fprintf (f
, "[ERROR]\n");
1823 for (i
= 0; i
< entry
->physical_size
; i
++)
1826 fprintf (f
, "0x%02x", buf
[i
]);
1828 fprintf (f
, " 0x%02x", buf
[i
]);
1834 bfd_sym_print_type_information (abfd
, f
, buf
, entry
->physical_size
, 0, &offset
);
1836 if (offset
!= entry
->physical_size
)
1837 fprintf (f
, "\n [parser used %lu bytes instead of %lu]", offset
, entry
->physical_size
);
1841 bfd_sym_print_file_references_index_table_entry (bfd
*abfd ATTRIBUTE_UNUSED
,
1843 bfd_sym_file_references_index_table_entry
*entry ATTRIBUTE_UNUSED
)
1845 fprintf (f
, "[UNIMPLEMENTED]");
1849 bfd_sym_print_constant_pool_entry (bfd
*abfd ATTRIBUTE_UNUSED
,
1851 bfd_sym_constant_pool_entry
*entry ATTRIBUTE_UNUSED
)
1853 fprintf (f
, "[UNIMPLEMENTED]");
1857 bfd_sym_display_name_table_entry (bfd
*abfd
,
1859 unsigned char *entry
)
1861 unsigned long sym_index
;
1862 unsigned long offset
;
1863 bfd_sym_data_struct
*sdata
= NULL
;
1865 BFD_ASSERT (bfd_sym_valid (abfd
));
1866 sdata
= abfd
->tdata
.sym_data
;
1867 sym_index
= (entry
- sdata
->name_table
) / 2;
1869 if (sdata
->version
>= BFD_SYM_VERSION_3_4
&& entry
[0] == 255 && entry
[1] == 0)
1871 unsigned short length
= bfd_getb16 (entry
+ 2);
1872 fprintf (f
, "[%8lu] \"%.*s\"\n", sym_index
, length
, entry
+ 4);
1873 offset
= 2 + length
+ 1;
1877 if (! (entry
[0] == 0 || (entry
[0] == 1 && entry
[1] == '\0')))
1878 fprintf (f
, "[%8lu] \"%.*s\"\n", sym_index
, entry
[0], entry
+ 1);
1880 if (sdata
->version
>= BFD_SYM_VERSION_3_4
)
1881 offset
= entry
[0] + 2;
1883 offset
= entry
[0] + 1;
1886 return (entry
+ offset
+ (offset
% 2));
1890 bfd_sym_display_name_table (bfd
*abfd
, FILE *f
)
1892 unsigned long name_table_len
;
1893 unsigned char *name_table
, *name_table_end
, *cur
;
1894 bfd_sym_data_struct
*sdata
= NULL
;
1896 BFD_ASSERT (bfd_sym_valid (abfd
));
1897 sdata
= abfd
->tdata
.sym_data
;
1899 name_table_len
= sdata
->header
.dshb_nte
.dti_page_count
* sdata
->header
.dshb_page_size
;
1900 name_table
= sdata
->name_table
;
1901 name_table_end
= name_table
+ name_table_len
;
1903 fprintf (f
, "name table (NTE) contains %lu bytes:\n\n", name_table_len
);
1908 cur
= bfd_sym_display_name_table_entry (abfd
, f
, cur
);
1909 if (cur
>= name_table_end
)
1915 bfd_sym_display_resources_table (bfd
*abfd
, FILE *f
)
1918 bfd_sym_resources_table_entry entry
;
1919 bfd_sym_data_struct
*sdata
= NULL
;
1921 BFD_ASSERT (bfd_sym_valid (abfd
));
1922 sdata
= abfd
->tdata
.sym_data
;
1924 fprintf (f
, "resource table (RTE) contains %lu objects:\n\n",
1925 sdata
->header
.dshb_rte
.dti_object_count
);
1927 for (i
= 1; i
<= sdata
->header
.dshb_rte
.dti_object_count
; i
++)
1929 if (bfd_sym_fetch_resources_table_entry (abfd
, &entry
, i
) < 0)
1930 fprintf (f
, " [%8lu] [INVALID]\n", i
);
1933 fprintf (f
, " [%8lu] ", i
);
1934 bfd_sym_print_resources_table_entry (abfd
, f
, &entry
);
1941 bfd_sym_display_modules_table (bfd
*abfd
, FILE *f
)
1944 bfd_sym_modules_table_entry entry
;
1945 bfd_sym_data_struct
*sdata
= NULL
;
1947 BFD_ASSERT (bfd_sym_valid (abfd
));
1948 sdata
= abfd
->tdata
.sym_data
;
1950 fprintf (f
, "module table (MTE) contains %lu objects:\n\n",
1951 sdata
->header
.dshb_mte
.dti_object_count
);
1953 for (i
= 1; i
<= sdata
->header
.dshb_mte
.dti_object_count
; i
++)
1955 if (bfd_sym_fetch_modules_table_entry (abfd
, &entry
, i
) < 0)
1956 fprintf (f
, " [%8lu] [INVALID]\n", i
);
1959 fprintf (f
, " [%8lu] ", i
);
1960 bfd_sym_print_modules_table_entry (abfd
, f
, &entry
);
1967 bfd_sym_display_file_references_table (bfd
*abfd
, FILE *f
)
1970 bfd_sym_file_references_table_entry entry
;
1971 bfd_sym_data_struct
*sdata
= NULL
;
1973 BFD_ASSERT (bfd_sym_valid (abfd
));
1974 sdata
= abfd
->tdata
.sym_data
;
1976 fprintf (f
, "file reference table (FRTE) contains %lu objects:\n\n",
1977 sdata
->header
.dshb_frte
.dti_object_count
);
1979 for (i
= 1; i
<= sdata
->header
.dshb_frte
.dti_object_count
; i
++)
1981 if (bfd_sym_fetch_file_references_table_entry (abfd
, &entry
, i
) < 0)
1982 fprintf (f
, " [%8lu] [INVALID]\n", i
);
1985 fprintf (f
, " [%8lu] ", i
);
1986 bfd_sym_print_file_references_table_entry (abfd
, f
, &entry
);
1993 bfd_sym_display_contained_modules_table (bfd
*abfd
, FILE *f
)
1996 bfd_sym_contained_modules_table_entry entry
;
1997 bfd_sym_data_struct
*sdata
= NULL
;
1999 BFD_ASSERT (bfd_sym_valid (abfd
));
2000 sdata
= abfd
->tdata
.sym_data
;
2002 fprintf (f
, "contained modules table (CMTE) contains %lu objects:\n\n",
2003 sdata
->header
.dshb_cmte
.dti_object_count
);
2005 for (i
= 1; i
<= sdata
->header
.dshb_cmte
.dti_object_count
; i
++)
2007 if (bfd_sym_fetch_contained_modules_table_entry (abfd
, &entry
, i
) < 0)
2008 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2011 fprintf (f
, " [%8lu] ", i
);
2012 bfd_sym_print_contained_modules_table_entry (abfd
, f
, &entry
);
2019 bfd_sym_display_contained_variables_table (bfd
*abfd
, FILE *f
)
2022 bfd_sym_contained_variables_table_entry entry
;
2023 bfd_sym_data_struct
*sdata
= NULL
;
2025 BFD_ASSERT (bfd_sym_valid (abfd
));
2026 sdata
= abfd
->tdata
.sym_data
;
2028 fprintf (f
, "contained variables table (CVTE) contains %lu objects:\n\n",
2029 sdata
->header
.dshb_cvte
.dti_object_count
);
2031 for (i
= 1; i
<= sdata
->header
.dshb_cvte
.dti_object_count
; i
++)
2033 if (bfd_sym_fetch_contained_variables_table_entry (abfd
, &entry
, i
) < 0)
2034 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2037 fprintf (f
, " [%8lu] ", i
);
2038 bfd_sym_print_contained_variables_table_entry (abfd
, f
, &entry
);
2047 bfd_sym_display_contained_statements_table (bfd
*abfd
, FILE *f
)
2050 bfd_sym_contained_statements_table_entry entry
;
2051 bfd_sym_data_struct
*sdata
= NULL
;
2053 BFD_ASSERT (bfd_sym_valid (abfd
));
2054 sdata
= abfd
->tdata
.sym_data
;
2056 fprintf (f
, "contained statements table (CSNTE) contains %lu objects:\n\n",
2057 sdata
->header
.dshb_csnte
.dti_object_count
);
2059 for (i
= 1; i
<= sdata
->header
.dshb_csnte
.dti_object_count
; i
++)
2061 if (bfd_sym_fetch_contained_statements_table_entry (abfd
, &entry
, i
) < 0)
2062 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2065 fprintf (f
, " [%8lu] ", i
);
2066 bfd_sym_print_contained_statements_table_entry (abfd
, f
, &entry
);
2073 bfd_sym_display_contained_labels_table (bfd
*abfd
, FILE *f
)
2076 bfd_sym_contained_labels_table_entry entry
;
2077 bfd_sym_data_struct
*sdata
= NULL
;
2079 BFD_ASSERT (bfd_sym_valid (abfd
));
2080 sdata
= abfd
->tdata
.sym_data
;
2082 fprintf (f
, "contained labels table (CLTE) contains %lu objects:\n\n",
2083 sdata
->header
.dshb_clte
.dti_object_count
);
2085 for (i
= 1; i
<= sdata
->header
.dshb_clte
.dti_object_count
; i
++)
2087 if (bfd_sym_fetch_contained_labels_table_entry (abfd
, &entry
, i
) < 0)
2088 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2091 fprintf (f
, " [%8lu] ", i
);
2092 bfd_sym_print_contained_labels_table_entry (abfd
, f
, &entry
);
2099 bfd_sym_display_contained_types_table (bfd
*abfd
, FILE *f
)
2102 bfd_sym_contained_types_table_entry entry
;
2103 bfd_sym_data_struct
*sdata
= NULL
;
2105 BFD_ASSERT (bfd_sym_valid (abfd
));
2106 sdata
= abfd
->tdata
.sym_data
;
2108 fprintf (f
, "contained types table (CTTE) contains %lu objects:\n\n",
2109 sdata
->header
.dshb_ctte
.dti_object_count
);
2111 for (i
= 1; i
<= sdata
->header
.dshb_ctte
.dti_object_count
; i
++)
2113 if (bfd_sym_fetch_contained_types_table_entry (abfd
, &entry
, i
) < 0)
2114 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2117 fprintf (f
, " [%8lu] ", i
);
2118 bfd_sym_print_contained_types_table_entry (abfd
, f
, &entry
);
2125 bfd_sym_display_file_references_index_table (bfd
*abfd
, FILE *f
)
2128 bfd_sym_file_references_index_table_entry entry
;
2129 bfd_sym_data_struct
*sdata
= NULL
;
2131 BFD_ASSERT (bfd_sym_valid (abfd
));
2132 sdata
= abfd
->tdata
.sym_data
;
2134 fprintf (f
, "file references index table (FITE) contains %lu objects:\n\n",
2135 sdata
->header
.dshb_fite
.dti_object_count
);
2137 for (i
= 1; i
<= sdata
->header
.dshb_fite
.dti_object_count
; i
++)
2139 if (bfd_sym_fetch_file_references_index_table_entry (abfd
, &entry
, i
) < 0)
2140 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2143 fprintf (f
, " [%8lu] ", i
);
2144 bfd_sym_print_file_references_index_table_entry (abfd
, f
, &entry
);
2151 bfd_sym_display_constant_pool (bfd
*abfd
, FILE *f
)
2154 bfd_sym_constant_pool_entry entry
;
2155 bfd_sym_data_struct
*sdata
= NULL
;
2157 BFD_ASSERT (bfd_sym_valid (abfd
));
2158 sdata
= abfd
->tdata
.sym_data
;
2160 fprintf (f
, "constant pool (CONST) contains %lu objects:\n\n",
2161 sdata
->header
.dshb_const
.dti_object_count
);
2163 for (i
= 1; i
<= sdata
->header
.dshb_const
.dti_object_count
; i
++)
2165 if (bfd_sym_fetch_constant_pool_entry (abfd
, &entry
, i
) < 0)
2166 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2169 fprintf (f
, " [%8lu] ", i
);
2170 bfd_sym_print_constant_pool_entry (abfd
, f
, &entry
);
2177 bfd_sym_display_type_information_table (bfd
*abfd
, FILE *f
)
2180 bfd_sym_type_table_entry sym_index
;
2181 bfd_sym_type_information_table_entry entry
;
2182 bfd_sym_data_struct
*sdata
= NULL
;
2184 BFD_ASSERT (bfd_sym_valid (abfd
));
2185 sdata
= abfd
->tdata
.sym_data
;
2187 if (sdata
->header
.dshb_tte
.dti_object_count
> 99)
2188 fprintf (f
, "type table (TINFO) contains %lu objects:\n\n",
2189 sdata
->header
.dshb_tte
.dti_object_count
- 99);
2192 fprintf (f
, "type table (TINFO) contains [INVALID] objects:\n\n");
2196 for (i
= 100; i
<= sdata
->header
.dshb_tte
.dti_object_count
; i
++)
2198 if (bfd_sym_fetch_type_table_entry (abfd
, &sym_index
, i
- 100) < 0)
2199 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2202 fprintf (f
, " [%8lu] (TINFO %lu) ", i
, sym_index
);
2204 if (bfd_sym_fetch_type_information_table_entry (abfd
, &entry
, sym_index
) < 0)
2205 fprintf (f
, "[INVALID]");
2207 bfd_sym_print_type_information_table_entry (abfd
, f
, &entry
);
2215 bfd_sym_scan (bfd
*abfd
, bfd_sym_version version
, bfd_sym_data_struct
*mdata
)
2218 const char *name
= "symbols";
2220 mdata
->name_table
= 0;
2222 mdata
->version
= version
;
2224 bfd_seek (abfd
, 0, SEEK_SET
);
2225 if (bfd_sym_read_header (abfd
, &mdata
->header
, mdata
->version
) != 0)
2228 mdata
->name_table
= bfd_sym_read_name_table (abfd
, &mdata
->header
);
2229 if (mdata
->name_table
== NULL
)
2232 bfdsec
= bfd_make_section_anyway_with_flags (abfd
, name
, SEC_HAS_CONTENTS
);
2239 bfdsec
->filepos
= 0;
2240 bfdsec
->alignment_power
= 0;
2242 abfd
->tdata
.sym_data
= mdata
;
2248 bfd_sym_object_p (bfd
*abfd
)
2250 struct bfd_preserve preserve
;
2251 bfd_sym_version version
= -1;
2253 preserve
.marker
= NULL
;
2254 bfd_seek (abfd
, 0, SEEK_SET
);
2255 if (bfd_sym_read_version (abfd
, &version
) != 0)
2258 preserve
.marker
= bfd_alloc (abfd
, sizeof (bfd_sym_data_struct
));
2259 if (preserve
.marker
== NULL
2260 || ! bfd_preserve_save (abfd
, &preserve
))
2263 if (bfd_sym_scan (abfd
, version
,
2264 (bfd_sym_data_struct
*) preserve
.marker
) != 0)
2267 bfd_preserve_finish (abfd
, &preserve
);
2271 bfd_set_error (bfd_error_wrong_format
);
2274 if (preserve
.marker
!= NULL
)
2275 bfd_preserve_restore (abfd
, &preserve
);
2279 #define bfd_sym_make_empty_symbol _bfd_generic_make_empty_symbol
2282 bfd_sym_get_symbol_info (bfd
*abfd ATTRIBUTE_UNUSED
, asymbol
*symbol
, symbol_info
*ret
)
2284 bfd_symbol_info (symbol
, ret
);
2288 bfd_sym_get_symtab_upper_bound (bfd
*abfd ATTRIBUTE_UNUSED
)
2294 bfd_sym_canonicalize_symtab (bfd
*abfd ATTRIBUTE_UNUSED
, asymbol
**sym ATTRIBUTE_UNUSED
)
2300 bfd_sym_sizeof_headers (bfd
*abfd ATTRIBUTE_UNUSED
,
2301 struct bfd_link_info
*info ATTRIBUTE_UNUSED
)
2306 const bfd_target sym_vec
=
2309 bfd_target_sym_flavour
, /* Flavour. */
2310 BFD_ENDIAN_BIG
, /* Byteorder. */
2311 BFD_ENDIAN_BIG
, /* Header byteorder. */
2312 (HAS_RELOC
| EXEC_P
| /* Object flags. */
2313 HAS_LINENO
| HAS_DEBUG
|
2314 HAS_SYMS
| HAS_LOCALS
| DYNAMIC
| WP_TEXT
| D_PAGED
),
2315 (SEC_ALLOC
| SEC_LOAD
| SEC_READONLY
| SEC_CODE
| SEC_DATA
2316 | SEC_ROM
| SEC_HAS_CONTENTS
), /* Section_flags. */
2317 0, /* Symbol_leading_char. */
2318 ' ', /* AR_pad_char. */
2319 16, /* AR_max_namelen. */
2320 0, /* match priority. */
2321 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2322 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2323 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* Data. */
2324 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2325 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2326 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* Hdrs. */
2327 { /* bfd_check_format. */
2329 bfd_sym_object_p
, /* bfd_check_format. */
2333 { /* bfd_set_format. */
2339 { /* bfd_write_contents. */
2346 BFD_JUMP_TABLE_GENERIC (bfd_sym
),
2347 BFD_JUMP_TABLE_COPY (_bfd_generic
),
2348 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
2349 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive
),
2350 BFD_JUMP_TABLE_SYMBOLS (bfd_sym
),
2351 BFD_JUMP_TABLE_RELOCS (_bfd_norelocs
),
2352 BFD_JUMP_TABLE_WRITE (bfd_sym
),
2353 BFD_JUMP_TABLE_LINK (bfd_sym
),
2354 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),