1 /* xSYM symbol-file support for BFD.
2 Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
3 2009, 2010 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_merge_sections bfd_generic_merge_sections
46 #define bfd_sym_bfd_is_group_section bfd_generic_is_group_section
47 #define bfd_sym_bfd_discard_group bfd_generic_discard_group
48 #define bfd_sym_section_already_linked _bfd_generic_section_already_linked
49 #define bfd_sym_bfd_define_common_symbol bfd_generic_define_common_symbol
50 #define bfd_sym_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
51 #define bfd_sym_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
52 #define bfd_sym_bfd_link_add_symbols _bfd_generic_link_add_symbols
53 #define bfd_sym_bfd_link_just_syms _bfd_generic_link_just_syms
54 #define bfd_sym_bfd_copy_link_hash_symbol_type \
55 _bfd_generic_copy_link_hash_symbol_type
56 #define bfd_sym_bfd_final_link _bfd_generic_final_link
57 #define bfd_sym_bfd_link_split_section _bfd_generic_link_split_section
58 #define bfd_sym_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
60 extern const bfd_target sym_vec
;
63 pstrcmp (const char *as
, const char *bs
)
65 const unsigned char *a
= (const unsigned char *) as
;
66 const unsigned char *b
= (const unsigned char *) bs
;
70 clen
= (a
[0] > b
[0]) ? b
[0] : a
[0];
71 ret
= memcmp (a
+ 1, b
+ 1, clen
);
84 compute_offset (unsigned long first_page
,
85 unsigned long page_size
,
86 unsigned long entry_size
,
87 unsigned long sym_index
)
89 unsigned long entries_per_page
= page_size
/ entry_size
;
90 unsigned long page_number
= first_page
+ (sym_index
/ entries_per_page
);
91 unsigned long page_offset
= (sym_index
% entries_per_page
) * entry_size
;
93 return (page_number
* page_size
) + page_offset
;
97 bfd_sym_mkobject (bfd
*abfd ATTRIBUTE_UNUSED
)
103 bfd_sym_print_symbol (bfd
*abfd ATTRIBUTE_UNUSED
,
104 void * afile ATTRIBUTE_UNUSED
,
105 asymbol
*symbol ATTRIBUTE_UNUSED
,
106 bfd_print_symbol_type how ATTRIBUTE_UNUSED
)
112 bfd_sym_valid (bfd
*abfd
)
114 if (abfd
== NULL
|| abfd
->xvec
== NULL
)
117 return abfd
->xvec
== &sym_vec
;
121 bfd_sym_read_name_table (bfd
*abfd
, bfd_sym_header_block
*dshb
)
125 size_t table_size
= dshb
->dshb_nte
.dti_page_count
* dshb
->dshb_page_size
;
126 size_t table_offset
= dshb
->dshb_nte
.dti_first_page
* dshb
->dshb_page_size
;
128 rstr
= bfd_alloc (abfd
, table_size
);
132 bfd_seek (abfd
, table_offset
, SEEK_SET
);
133 ret
= bfd_bread (rstr
, table_size
, abfd
);
134 if (ret
< 0 || (unsigned long) ret
!= table_size
)
136 bfd_release (abfd
, rstr
);
144 bfd_sym_parse_file_reference_v32 (unsigned char *buf
,
146 bfd_sym_file_reference
*entry
)
148 BFD_ASSERT (len
== 6);
150 entry
->fref_frte_index
= bfd_getb16 (buf
);
151 entry
->fref_offset
= bfd_getb32 (buf
+ 2);
155 bfd_sym_parse_disk_table_v32 (unsigned char *buf
,
157 bfd_sym_table_info
*table
)
159 BFD_ASSERT (len
== 8);
161 table
->dti_first_page
= bfd_getb16 (buf
);
162 table
->dti_page_count
= bfd_getb16 (buf
+ 2);
163 table
->dti_object_count
= bfd_getb32 (buf
+ 4);
167 bfd_sym_parse_header_v32 (unsigned char *buf
,
169 bfd_sym_header_block
*header
)
171 BFD_ASSERT (len
== 154);
173 memcpy (header
->dshb_id
, buf
, 32);
174 header
->dshb_page_size
= bfd_getb16 (buf
+ 32);
175 header
->dshb_hash_page
= bfd_getb16 (buf
+ 34);
176 header
->dshb_root_mte
= bfd_getb16 (buf
+ 36);
177 header
->dshb_mod_date
= bfd_getb32 (buf
+ 38);
179 bfd_sym_parse_disk_table_v32 (buf
+ 42, 8, &header
->dshb_frte
);
180 bfd_sym_parse_disk_table_v32 (buf
+ 50, 8, &header
->dshb_rte
);
181 bfd_sym_parse_disk_table_v32 (buf
+ 58, 8, &header
->dshb_mte
);
182 bfd_sym_parse_disk_table_v32 (buf
+ 66, 8, &header
->dshb_cmte
);
183 bfd_sym_parse_disk_table_v32 (buf
+ 74, 8, &header
->dshb_cvte
);
184 bfd_sym_parse_disk_table_v32 (buf
+ 82, 8, &header
->dshb_csnte
);
185 bfd_sym_parse_disk_table_v32 (buf
+ 90, 8, &header
->dshb_clte
);
186 bfd_sym_parse_disk_table_v32 (buf
+ 98, 8, &header
->dshb_ctte
);
187 bfd_sym_parse_disk_table_v32 (buf
+ 106, 8, &header
->dshb_tte
);
188 bfd_sym_parse_disk_table_v32 (buf
+ 114, 8, &header
->dshb_nte
);
189 bfd_sym_parse_disk_table_v32 (buf
+ 122, 8, &header
->dshb_tinfo
);
190 bfd_sym_parse_disk_table_v32 (buf
+ 130, 8, &header
->dshb_fite
);
191 bfd_sym_parse_disk_table_v32 (buf
+ 138, 8, &header
->dshb_const
);
193 memcpy (&header
->dshb_file_creator
, buf
+ 146, 4);
194 memcpy (&header
->dshb_file_type
, buf
+ 150, 4);
198 bfd_sym_read_header_v32 (bfd
*abfd
, bfd_sym_header_block
*header
)
200 unsigned char buf
[154];
203 ret
= bfd_bread (buf
, 154, abfd
);
207 bfd_sym_parse_header_v32 (buf
, 154, header
);
213 bfd_sym_read_header_v34 (bfd
*abfd ATTRIBUTE_UNUSED
,
214 bfd_sym_header_block
*header ATTRIBUTE_UNUSED
)
220 bfd_sym_read_header (bfd
*abfd
,
221 bfd_sym_header_block
*header
,
222 bfd_sym_version version
)
226 case BFD_SYM_VERSION_3_5
:
227 case BFD_SYM_VERSION_3_4
:
228 return bfd_sym_read_header_v34 (abfd
, header
);
229 case BFD_SYM_VERSION_3_3
:
230 case BFD_SYM_VERSION_3_2
:
231 return bfd_sym_read_header_v32 (abfd
, header
);
232 case BFD_SYM_VERSION_3_1
:
239 bfd_sym_read_version (bfd
*abfd
, bfd_sym_version
*version
)
241 char version_string
[32];
244 ret
= bfd_bread (version_string
, sizeof (version_string
), abfd
);
245 if (ret
!= sizeof (version_string
))
248 if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_1
) == 0)
249 *version
= BFD_SYM_VERSION_3_1
;
250 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_2
) == 0)
251 *version
= BFD_SYM_VERSION_3_2
;
252 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_3
) == 0)
253 *version
= BFD_SYM_VERSION_3_3
;
254 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_4
) == 0)
255 *version
= BFD_SYM_VERSION_3_4
;
256 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_5
) == 0)
257 *version
= BFD_SYM_VERSION_3_5
;
265 bfd_sym_display_table_summary (FILE *f
,
266 bfd_sym_table_info
*dti
,
269 fprintf (f
, "%-6s %13ld %13ld %13ld\n",
273 dti
->dti_object_count
);
277 bfd_sym_display_header (FILE *f
, bfd_sym_header_block
*dshb
)
279 fprintf (f
, " Version: %.*s\n", dshb
->dshb_id
[0], dshb
->dshb_id
+ 1);
280 fprintf (f
, " Page Size: 0x%x\n", dshb
->dshb_page_size
);
281 fprintf (f
, " Hash Page: %lu\n", dshb
->dshb_hash_page
);
282 fprintf (f
, " Root MTE: %lu\n", dshb
->dshb_root_mte
);
283 fprintf (f
, " Modification Date: ");
284 fprintf (f
, "[unimplemented]");
285 fprintf (f
, " (0x%lx)\n", dshb
->dshb_mod_date
);
287 fprintf (f
, " File Creator: %.4s Type: %.4s\n\n",
288 dshb
->dshb_file_creator
, dshb
->dshb_file_type
);
290 fprintf (f
, "Table Name First Page Page Count Object Count\n");
291 fprintf (f
, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
293 bfd_sym_display_table_summary (f
, &dshb
->dshb_nte
, "NTE");
294 bfd_sym_display_table_summary (f
, &dshb
->dshb_rte
, "RTE");
295 bfd_sym_display_table_summary (f
, &dshb
->dshb_mte
, "MTE");
296 bfd_sym_display_table_summary (f
, &dshb
->dshb_frte
, "FRTE");
297 bfd_sym_display_table_summary (f
, &dshb
->dshb_cmte
, "CMTE");
298 bfd_sym_display_table_summary (f
, &dshb
->dshb_cvte
, "CVTE");
299 bfd_sym_display_table_summary (f
, &dshb
->dshb_csnte
, "CSNTE");
300 bfd_sym_display_table_summary (f
, &dshb
->dshb_clte
, "CLTE");
301 bfd_sym_display_table_summary (f
, &dshb
->dshb_ctte
, "CTTE");
302 bfd_sym_display_table_summary (f
, &dshb
->dshb_tte
, "TTE");
303 bfd_sym_display_table_summary (f
, &dshb
->dshb_tinfo
, "TINFO");
304 bfd_sym_display_table_summary (f
, &dshb
->dshb_fite
, "FITE");
305 bfd_sym_display_table_summary (f
, &dshb
->dshb_const
, "CONST");
311 bfd_sym_parse_resources_table_entry_v32 (unsigned char *buf
,
313 bfd_sym_resources_table_entry
*entry
)
315 BFD_ASSERT (len
== 18);
317 memcpy (&entry
->rte_res_type
, buf
, 4);
318 entry
->rte_res_number
= bfd_getb16 (buf
+ 4);
319 entry
->rte_nte_index
= bfd_getb32 (buf
+ 6);
320 entry
->rte_mte_first
= bfd_getb16 (buf
+ 10);
321 entry
->rte_mte_last
= bfd_getb16 (buf
+ 12);
322 entry
->rte_res_size
= bfd_getb32 (buf
+ 14);
326 bfd_sym_parse_modules_table_entry_v33 (unsigned char *buf
,
328 bfd_sym_modules_table_entry
*entry
)
330 BFD_ASSERT (len
== 46);
332 entry
->mte_rte_index
= bfd_getb16 (buf
);
333 entry
->mte_res_offset
= bfd_getb32 (buf
+ 2);
334 entry
->mte_size
= bfd_getb32 (buf
+ 6);
335 entry
->mte_kind
= buf
[10];
336 entry
->mte_scope
= buf
[11];
337 entry
->mte_parent
= bfd_getb16 (buf
+ 12);
338 bfd_sym_parse_file_reference_v32 (buf
+ 14, 6, &entry
->mte_imp_fref
);
339 entry
->mte_imp_end
= bfd_getb32 (buf
+ 20);
340 entry
->mte_nte_index
= bfd_getb32 (buf
+ 24);
341 entry
->mte_cmte_index
= bfd_getb16 (buf
+ 28);
342 entry
->mte_cvte_index
= bfd_getb32 (buf
+ 30);
343 entry
->mte_clte_index
= bfd_getb16 (buf
+ 34);
344 entry
->mte_ctte_index
= bfd_getb16 (buf
+ 36);
345 entry
->mte_csnte_idx_1
= bfd_getb32 (buf
+ 38);
346 entry
->mte_csnte_idx_2
= bfd_getb32 (buf
+ 42);
350 bfd_sym_parse_file_references_table_entry_v32 (unsigned char *buf
,
352 bfd_sym_file_references_table_entry
*entry
)
356 BFD_ASSERT (len
== 10);
358 memset (entry
, 0, sizeof (bfd_sym_file_references_table_entry
));
359 type
= bfd_getb16 (buf
);
363 case BFD_SYM_END_OF_LIST_3_2
:
364 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
367 case BFD_SYM_FILE_NAME_INDEX_3_2
:
368 entry
->filename
.type
= BFD_SYM_FILE_NAME_INDEX
;
369 entry
->filename
.nte_index
= bfd_getb32 (buf
+ 2);
370 entry
->filename
.mod_date
= bfd_getb32 (buf
+ 6);
374 entry
->entry
.mte_index
= type
;
375 entry
->entry
.file_offset
= bfd_getb32 (buf
+ 2);
380 bfd_sym_parse_contained_modules_table_entry_v32 (unsigned char *buf
,
382 bfd_sym_contained_modules_table_entry
*entry
)
386 BFD_ASSERT (len
== 6);
388 memset (entry
, 0, sizeof (bfd_sym_contained_modules_table_entry
));
389 type
= bfd_getb16 (buf
);
393 case BFD_SYM_END_OF_LIST_3_2
:
394 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
398 entry
->entry
.mte_index
= type
;
399 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 2);
405 bfd_sym_parse_contained_variables_table_entry_v32 (unsigned char *buf
,
407 bfd_sym_contained_variables_table_entry
*entry
)
411 BFD_ASSERT (len
== 26);
413 memset (entry
, 0, sizeof (bfd_sym_contained_variables_table_entry
));
414 type
= bfd_getb16 (buf
);
418 case BFD_SYM_END_OF_LIST_3_2
:
419 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
422 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
423 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
424 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
428 entry
->entry
.tte_index
= type
;
429 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 2);
430 entry
->entry
.file_delta
= bfd_getb16 (buf
+ 6);
431 entry
->entry
.scope
= buf
[8];
432 entry
->entry
.la_size
= buf
[9];
434 if (entry
->entry
.la_size
== BFD_SYM_CVTE_SCA
)
436 entry
->entry
.address
.scstruct
.sca_kind
= buf
[10];
437 entry
->entry
.address
.scstruct
.sca_class
= buf
[11];
438 entry
->entry
.address
.scstruct
.sca_offset
= bfd_getb32 (buf
+ 12);
440 else if (entry
->entry
.la_size
<= BFD_SYM_CVTE_SCA
)
442 #if BFD_SYM_CVTE_SCA > 0
443 memcpy (&entry
->entry
.address
.lastruct
.la
, buf
+ 10,
446 entry
->entry
.address
.lastruct
.la_kind
= buf
[23];
448 else if (entry
->entry
.la_size
== BFD_SYM_CVTE_BIG_LA
)
450 entry
->entry
.address
.biglastruct
.big_la
= bfd_getb32 (buf
+ 10);
451 entry
->entry
.address
.biglastruct
.big_la_kind
= buf
[12];
457 bfd_sym_parse_contained_statements_table_entry_v32 (unsigned char *buf
,
459 bfd_sym_contained_statements_table_entry
*entry
)
463 BFD_ASSERT (len
== 8);
465 memset (entry
, 0, sizeof (bfd_sym_contained_statements_table_entry
));
466 type
= bfd_getb16 (buf
);
470 case BFD_SYM_END_OF_LIST_3_2
:
471 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
474 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
475 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
476 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
480 entry
->entry
.mte_index
= type
;
481 entry
->entry
.mte_offset
= bfd_getb16 (buf
+ 2);
482 entry
->entry
.file_delta
= bfd_getb32 (buf
+ 4);
488 bfd_sym_parse_contained_labels_table_entry_v32 (unsigned char *buf
,
490 bfd_sym_contained_labels_table_entry
*entry
)
494 BFD_ASSERT (len
== 12);
496 memset (entry
, 0, sizeof (bfd_sym_contained_labels_table_entry
));
497 type
= bfd_getb16 (buf
);
501 case BFD_SYM_END_OF_LIST_3_2
:
502 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
505 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
506 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
507 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
511 entry
->entry
.mte_index
= type
;
512 entry
->entry
.mte_offset
= bfd_getb16 (buf
+ 2);
513 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 4);
514 entry
->entry
.file_delta
= bfd_getb16 (buf
+ 8);
515 entry
->entry
.scope
= bfd_getb16 (buf
+ 10);
521 bfd_sym_parse_type_table_entry_v32 (unsigned char *buf
,
523 bfd_sym_type_table_entry
*entry
)
525 BFD_ASSERT (len
== 4);
527 *entry
= bfd_getb32 (buf
);
531 bfd_sym_fetch_resources_table_entry (bfd
*abfd
,
532 bfd_sym_resources_table_entry
*entry
,
533 unsigned long sym_index
)
535 void (*parser
) (unsigned char *, size_t, bfd_sym_resources_table_entry
*);
536 unsigned long offset
;
537 unsigned long entry_size
;
538 unsigned char buf
[18];
539 bfd_sym_data_struct
*sdata
= NULL
;
542 BFD_ASSERT (bfd_sym_valid (abfd
));
543 sdata
= abfd
->tdata
.sym_data
;
548 switch (sdata
->version
)
550 case BFD_SYM_VERSION_3_5
:
551 case BFD_SYM_VERSION_3_4
:
554 case BFD_SYM_VERSION_3_3
:
555 case BFD_SYM_VERSION_3_2
:
557 parser
= bfd_sym_parse_resources_table_entry_v32
;
560 case BFD_SYM_VERSION_3_1
:
567 offset
= compute_offset (sdata
->header
.dshb_rte
.dti_first_page
,
568 sdata
->header
.dshb_page_size
,
569 entry_size
, sym_index
);
571 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
573 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
576 (*parser
) (buf
, entry_size
, entry
);
582 bfd_sym_fetch_modules_table_entry (bfd
*abfd
,
583 bfd_sym_modules_table_entry
*entry
,
584 unsigned long sym_index
)
586 void (*parser
) (unsigned char *, size_t, bfd_sym_modules_table_entry
*);
587 unsigned long offset
;
588 unsigned long entry_size
;
589 unsigned char buf
[46];
590 bfd_sym_data_struct
*sdata
= NULL
;
593 BFD_ASSERT (bfd_sym_valid (abfd
));
594 sdata
= abfd
->tdata
.sym_data
;
599 switch (sdata
->version
)
601 case BFD_SYM_VERSION_3_5
:
602 case BFD_SYM_VERSION_3_4
:
605 case BFD_SYM_VERSION_3_3
:
607 parser
= bfd_sym_parse_modules_table_entry_v33
;
610 case BFD_SYM_VERSION_3_2
:
611 case BFD_SYM_VERSION_3_1
:
618 offset
= compute_offset (sdata
->header
.dshb_mte
.dti_first_page
,
619 sdata
->header
.dshb_page_size
,
620 entry_size
, sym_index
);
622 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
624 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
627 (*parser
) (buf
, entry_size
, entry
);
633 bfd_sym_fetch_file_references_table_entry (bfd
*abfd
,
634 bfd_sym_file_references_table_entry
*entry
,
635 unsigned long sym_index
)
637 void (*parser
) (unsigned char *, size_t, bfd_sym_file_references_table_entry
*);
638 unsigned long offset
;
639 unsigned long entry_size
= 0;
640 unsigned char buf
[8];
641 bfd_sym_data_struct
*sdata
= NULL
;
644 BFD_ASSERT (bfd_sym_valid (abfd
));
645 sdata
= abfd
->tdata
.sym_data
;
650 switch (sdata
->version
)
652 case BFD_SYM_VERSION_3_3
:
653 case BFD_SYM_VERSION_3_2
:
655 parser
= bfd_sym_parse_file_references_table_entry_v32
;
658 case BFD_SYM_VERSION_3_5
:
659 case BFD_SYM_VERSION_3_4
:
660 case BFD_SYM_VERSION_3_1
:
668 offset
= compute_offset (sdata
->header
.dshb_frte
.dti_first_page
,
669 sdata
->header
.dshb_page_size
,
670 entry_size
, sym_index
);
672 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
674 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
677 (*parser
) (buf
, entry_size
, entry
);
683 bfd_sym_fetch_contained_modules_table_entry (bfd
*abfd
,
684 bfd_sym_contained_modules_table_entry
*entry
,
685 unsigned long sym_index
)
687 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_modules_table_entry
*);
688 unsigned long offset
;
689 unsigned long entry_size
= 0;
690 unsigned char buf
[6];
691 bfd_sym_data_struct
*sdata
= NULL
;
694 BFD_ASSERT (bfd_sym_valid (abfd
));
695 sdata
= abfd
->tdata
.sym_data
;
700 switch (sdata
->version
)
702 case BFD_SYM_VERSION_3_3
:
703 case BFD_SYM_VERSION_3_2
:
705 parser
= bfd_sym_parse_contained_modules_table_entry_v32
;
708 case BFD_SYM_VERSION_3_5
:
709 case BFD_SYM_VERSION_3_4
:
710 case BFD_SYM_VERSION_3_1
:
718 offset
= compute_offset (sdata
->header
.dshb_cmte
.dti_first_page
,
719 sdata
->header
.dshb_page_size
,
720 entry_size
, sym_index
);
722 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
724 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
727 (*parser
) (buf
, entry_size
, entry
);
733 bfd_sym_fetch_contained_variables_table_entry (bfd
*abfd
,
734 bfd_sym_contained_variables_table_entry
*entry
,
735 unsigned long sym_index
)
737 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_variables_table_entry
*);
738 unsigned long offset
;
739 unsigned long entry_size
= 0;
740 unsigned char buf
[26];
741 bfd_sym_data_struct
*sdata
= NULL
;
744 BFD_ASSERT (bfd_sym_valid (abfd
));
745 sdata
= abfd
->tdata
.sym_data
;
750 switch (sdata
->version
)
752 case BFD_SYM_VERSION_3_3
:
753 case BFD_SYM_VERSION_3_2
:
755 parser
= bfd_sym_parse_contained_variables_table_entry_v32
;
758 case BFD_SYM_VERSION_3_5
:
759 case BFD_SYM_VERSION_3_4
:
760 case BFD_SYM_VERSION_3_1
:
768 offset
= compute_offset (sdata
->header
.dshb_cvte
.dti_first_page
,
769 sdata
->header
.dshb_page_size
,
770 entry_size
, sym_index
);
772 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
774 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
777 (*parser
) (buf
, entry_size
, entry
);
783 bfd_sym_fetch_contained_statements_table_entry (bfd
*abfd
,
784 bfd_sym_contained_statements_table_entry
*entry
,
785 unsigned long sym_index
)
787 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_statements_table_entry
*);
788 unsigned long offset
;
789 unsigned long entry_size
= 0;
790 unsigned char buf
[8];
791 bfd_sym_data_struct
*sdata
= NULL
;
794 BFD_ASSERT (bfd_sym_valid (abfd
));
795 sdata
= abfd
->tdata
.sym_data
;
800 switch (sdata
->version
)
802 case BFD_SYM_VERSION_3_3
:
803 case BFD_SYM_VERSION_3_2
:
805 parser
= bfd_sym_parse_contained_statements_table_entry_v32
;
808 case BFD_SYM_VERSION_3_5
:
809 case BFD_SYM_VERSION_3_4
:
810 case BFD_SYM_VERSION_3_1
:
818 offset
= compute_offset (sdata
->header
.dshb_csnte
.dti_first_page
,
819 sdata
->header
.dshb_page_size
,
820 entry_size
, sym_index
);
822 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
824 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
827 (*parser
) (buf
, entry_size
, entry
);
833 bfd_sym_fetch_contained_labels_table_entry (bfd
*abfd
,
834 bfd_sym_contained_labels_table_entry
*entry
,
835 unsigned long sym_index
)
837 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_labels_table_entry
*);
838 unsigned long offset
;
839 unsigned long entry_size
= 0;
840 unsigned char buf
[12];
841 bfd_sym_data_struct
*sdata
= NULL
;
844 BFD_ASSERT (bfd_sym_valid (abfd
));
845 sdata
= abfd
->tdata
.sym_data
;
850 switch (sdata
->version
)
852 case BFD_SYM_VERSION_3_3
:
853 case BFD_SYM_VERSION_3_2
:
855 parser
= bfd_sym_parse_contained_labels_table_entry_v32
;
858 case BFD_SYM_VERSION_3_5
:
859 case BFD_SYM_VERSION_3_4
:
860 case BFD_SYM_VERSION_3_1
:
868 offset
= compute_offset (sdata
->header
.dshb_clte
.dti_first_page
,
869 sdata
->header
.dshb_page_size
,
870 entry_size
, sym_index
);
872 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
874 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
877 (*parser
) (buf
, entry_size
, entry
);
883 bfd_sym_fetch_contained_types_table_entry (bfd
*abfd
,
884 bfd_sym_contained_types_table_entry
*entry
,
885 unsigned long sym_index
)
887 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_types_table_entry
*);
888 unsigned long offset
;
889 unsigned long entry_size
= 0;
890 unsigned char buf
[0];
891 bfd_sym_data_struct
*sdata
= NULL
;
894 BFD_ASSERT (bfd_sym_valid (abfd
));
895 sdata
= abfd
->tdata
.sym_data
;
900 switch (sdata
->version
)
902 case BFD_SYM_VERSION_3_3
:
903 case BFD_SYM_VERSION_3_2
:
908 case BFD_SYM_VERSION_3_5
:
909 case BFD_SYM_VERSION_3_4
:
910 case BFD_SYM_VERSION_3_1
:
918 offset
= compute_offset (sdata
->header
.dshb_ctte
.dti_first_page
,
919 sdata
->header
.dshb_page_size
,
920 entry_size
, sym_index
);
922 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
924 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
927 (*parser
) (buf
, entry_size
, entry
);
933 bfd_sym_fetch_file_references_index_table_entry (bfd
*abfd
,
934 bfd_sym_file_references_index_table_entry
*entry
,
935 unsigned long sym_index
)
937 void (*parser
) (unsigned char *, size_t, bfd_sym_file_references_index_table_entry
*);
938 unsigned long offset
;
939 unsigned long entry_size
= 0;
940 unsigned char buf
[0];
941 bfd_sym_data_struct
*sdata
= NULL
;
944 BFD_ASSERT (bfd_sym_valid (abfd
));
945 sdata
= abfd
->tdata
.sym_data
;
950 switch (sdata
->version
)
952 case BFD_SYM_VERSION_3_3
:
953 case BFD_SYM_VERSION_3_2
:
958 case BFD_SYM_VERSION_3_5
:
959 case BFD_SYM_VERSION_3_4
:
960 case BFD_SYM_VERSION_3_1
:
968 offset
= compute_offset (sdata
->header
.dshb_fite
.dti_first_page
,
969 sdata
->header
.dshb_page_size
,
970 entry_size
, sym_index
);
972 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
974 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
977 (*parser
) (buf
, entry_size
, entry
);
983 bfd_sym_fetch_constant_pool_entry (bfd
*abfd
,
984 bfd_sym_constant_pool_entry
*entry
,
985 unsigned long sym_index
)
987 void (*parser
) (unsigned char *, size_t, bfd_sym_constant_pool_entry
*);
988 unsigned long offset
;
989 unsigned long entry_size
= 0;
990 unsigned char buf
[0];
991 bfd_sym_data_struct
*sdata
= NULL
;
994 BFD_ASSERT (bfd_sym_valid (abfd
));
995 sdata
= abfd
->tdata
.sym_data
;
1000 switch (sdata
->version
)
1002 case BFD_SYM_VERSION_3_3
:
1003 case BFD_SYM_VERSION_3_2
:
1008 case BFD_SYM_VERSION_3_5
:
1009 case BFD_SYM_VERSION_3_4
:
1010 case BFD_SYM_VERSION_3_1
:
1018 offset
= compute_offset (sdata
->header
.dshb_fite
.dti_first_page
,
1019 sdata
->header
.dshb_page_size
,
1020 entry_size
, sym_index
);
1022 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1024 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1027 (*parser
) (buf
, entry_size
, entry
);
1033 bfd_sym_fetch_type_table_entry (bfd
*abfd
,
1034 bfd_sym_type_table_entry
*entry
,
1035 unsigned long sym_index
)
1037 void (*parser
) (unsigned char *, size_t, bfd_sym_type_table_entry
*);
1038 unsigned long offset
;
1039 unsigned long entry_size
= 0;
1040 unsigned char buf
[4];
1041 bfd_sym_data_struct
*sdata
= NULL
;
1044 BFD_ASSERT (bfd_sym_valid (abfd
));
1045 sdata
= abfd
->tdata
.sym_data
;
1047 switch (sdata
->version
)
1049 case BFD_SYM_VERSION_3_3
:
1050 case BFD_SYM_VERSION_3_2
:
1052 parser
= bfd_sym_parse_type_table_entry_v32
;
1055 case BFD_SYM_VERSION_3_5
:
1056 case BFD_SYM_VERSION_3_4
:
1057 case BFD_SYM_VERSION_3_1
:
1065 offset
= compute_offset (sdata
->header
.dshb_tte
.dti_first_page
,
1066 sdata
->header
.dshb_page_size
,
1067 entry_size
, sym_index
);
1069 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1071 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1074 (*parser
) (buf
, entry_size
, entry
);
1080 bfd_sym_fetch_type_information_table_entry (bfd
*abfd
,
1081 bfd_sym_type_information_table_entry
*entry
,
1082 unsigned long offset
)
1084 unsigned char buf
[4];
1086 BFD_ASSERT (bfd_sym_valid (abfd
));
1091 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1094 if (bfd_bread (buf
, 4, abfd
) != 4)
1096 entry
->nte_index
= bfd_getb32 (buf
);
1098 if (bfd_bread (buf
, 2, abfd
) != 2)
1100 entry
->physical_size
= bfd_getb16 (buf
);
1102 if (entry
->physical_size
& 0x8000)
1104 if (bfd_bread (buf
, 4, abfd
) != 4)
1106 entry
->physical_size
&= 0x7fff;
1107 entry
->logical_size
= bfd_getb32 (buf
);
1108 entry
->offset
= offset
+ 10;
1112 if (bfd_bread (buf
, 2, abfd
) != 2)
1114 entry
->physical_size
&= 0x7fff;
1115 entry
->logical_size
= bfd_getb16 (buf
);
1116 entry
->offset
= offset
+ 8;
1123 bfd_sym_fetch_type_table_information (bfd
*abfd
,
1124 bfd_sym_type_information_table_entry
*entry
,
1125 unsigned long sym_index
)
1127 bfd_sym_type_table_entry tindex
;
1128 bfd_sym_data_struct
*sdata
= NULL
;
1130 BFD_ASSERT (bfd_sym_valid (abfd
));
1131 sdata
= abfd
->tdata
.sym_data
;
1133 if (sdata
->header
.dshb_tte
.dti_object_count
<= 99)
1135 if (sym_index
< 100)
1138 if (bfd_sym_fetch_type_table_entry (abfd
, &tindex
, sym_index
- 100) < 0)
1140 if (bfd_sym_fetch_type_information_table_entry (abfd
, entry
, tindex
) < 0)
1146 const unsigned char *
1147 bfd_sym_symbol_name (bfd
*abfd
, unsigned long sym_index
)
1149 bfd_sym_data_struct
*sdata
= NULL
;
1151 BFD_ASSERT (bfd_sym_valid (abfd
));
1152 sdata
= abfd
->tdata
.sym_data
;
1155 return (const unsigned char *) "";
1158 if ((sym_index
/ sdata
->header
.dshb_page_size
)
1159 > sdata
->header
.dshb_nte
.dti_page_count
)
1160 return (const unsigned char *) "\09[INVALID]";
1162 return (const unsigned char *) sdata
->name_table
+ sym_index
;
1165 const unsigned char *
1166 bfd_sym_module_name (bfd
*abfd
, unsigned long sym_index
)
1168 bfd_sym_modules_table_entry entry
;
1170 if (bfd_sym_fetch_modules_table_entry (abfd
, &entry
, sym_index
) < 0)
1171 return (const unsigned char *) "\09[INVALID]";
1173 return bfd_sym_symbol_name (abfd
, entry
.mte_nte_index
);
1177 bfd_sym_unparse_storage_kind (enum bfd_sym_storage_kind kind
)
1181 case BFD_SYM_STORAGE_KIND_LOCAL
: return "LOCAL";
1182 case BFD_SYM_STORAGE_KIND_VALUE
: return "VALUE";
1183 case BFD_SYM_STORAGE_KIND_REFERENCE
: return "REFERENCE";
1184 case BFD_SYM_STORAGE_KIND_WITH
: return "WITH";
1185 default: return "[UNKNOWN]";
1190 bfd_sym_unparse_storage_class (enum bfd_sym_storage_class kind
)
1194 case BFD_SYM_STORAGE_CLASS_REGISTER
: return "REGISTER";
1195 case BFD_SYM_STORAGE_CLASS_GLOBAL
: return "GLOBAL";
1196 case BFD_SYM_STORAGE_CLASS_FRAME_RELATIVE
: return "FRAME_RELATIVE";
1197 case BFD_SYM_STORAGE_CLASS_STACK_RELATIVE
: return "STACK_RELATIVE";
1198 case BFD_SYM_STORAGE_CLASS_ABSOLUTE
: return "ABSOLUTE";
1199 case BFD_SYM_STORAGE_CLASS_CONSTANT
: return "CONSTANT";
1200 case BFD_SYM_STORAGE_CLASS_RESOURCE
: return "RESOURCE";
1201 case BFD_SYM_STORAGE_CLASS_BIGCONSTANT
: return "BIGCONSTANT";
1202 default: return "[UNKNOWN]";
1207 bfd_sym_unparse_module_kind (enum bfd_sym_module_kind kind
)
1211 case BFD_SYM_MODULE_KIND_NONE
: return "NONE";
1212 case BFD_SYM_MODULE_KIND_PROGRAM
: return "PROGRAM";
1213 case BFD_SYM_MODULE_KIND_UNIT
: return "UNIT";
1214 case BFD_SYM_MODULE_KIND_PROCEDURE
: return "PROCEDURE";
1215 case BFD_SYM_MODULE_KIND_FUNCTION
: return "FUNCTION";
1216 case BFD_SYM_MODULE_KIND_DATA
: return "DATA";
1217 case BFD_SYM_MODULE_KIND_BLOCK
: return "BLOCK";
1218 default: return "[UNKNOWN]";
1223 bfd_sym_unparse_symbol_scope (enum bfd_sym_symbol_scope scope
)
1227 case BFD_SYM_SYMBOL_SCOPE_LOCAL
: return "LOCAL";
1228 case BFD_SYM_SYMBOL_SCOPE_GLOBAL
: return "GLOBAL";
1235 bfd_sym_print_file_reference (bfd
*abfd
,
1237 bfd_sym_file_reference
*entry
)
1239 bfd_sym_file_references_table_entry frtentry
;
1242 ret
= bfd_sym_fetch_file_references_table_entry (abfd
, &frtentry
,
1243 entry
->fref_frte_index
);
1244 fprintf (f
, "FILE ");
1246 if ((ret
< 0) || (frtentry
.generic
.type
!= BFD_SYM_FILE_NAME_INDEX
))
1247 fprintf (f
, "[INVALID]");
1249 fprintf (f
, "\"%.*s\"",
1250 bfd_sym_symbol_name (abfd
, frtentry
.filename
.nte_index
)[0],
1251 &bfd_sym_symbol_name (abfd
, frtentry
.filename
.nte_index
)[1]);
1253 fprintf (f
, " (FRTE %lu)", entry
->fref_frte_index
);
1257 bfd_sym_print_resources_table_entry (bfd
*abfd
,
1259 bfd_sym_resources_table_entry
*entry
)
1261 fprintf (f
, " \"%.*s\" (NTE %lu), type \"%.4s\", num %u, size %lu, MTE %lu -- %lu",
1262 bfd_sym_symbol_name (abfd
, entry
->rte_nte_index
)[0],
1263 &bfd_sym_symbol_name (abfd
, entry
->rte_nte_index
)[1],
1264 entry
->rte_nte_index
, entry
->rte_res_type
, entry
->rte_res_number
,
1265 entry
->rte_res_size
, entry
->rte_mte_first
, entry
->rte_mte_last
);
1269 bfd_sym_print_modules_table_entry (bfd
*abfd
,
1271 bfd_sym_modules_table_entry
*entry
)
1273 fprintf (f
, "\"%.*s\" (NTE %lu)",
1274 bfd_sym_symbol_name (abfd
, entry
->mte_nte_index
)[0],
1275 &bfd_sym_symbol_name (abfd
, entry
->mte_nte_index
)[1],
1276 entry
->mte_nte_index
);
1280 bfd_sym_print_file_reference (abfd
, f
, &entry
->mte_imp_fref
);
1281 fprintf (f
, " range %lu -- %lu",
1282 entry
->mte_imp_fref
.fref_offset
, entry
->mte_imp_end
);
1286 fprintf (f
, "kind %s", bfd_sym_unparse_module_kind (entry
->mte_kind
));
1287 fprintf (f
, ", scope %s", bfd_sym_unparse_symbol_scope (entry
->mte_scope
));
1289 fprintf (f
, ", RTE %lu, offset %lu, size %lu",
1290 entry
->mte_rte_index
, entry
->mte_res_offset
, entry
->mte_size
);
1294 fprintf (f
, "CMTE %lu, CVTE %lu, CLTE %lu, CTTE %lu, CSNTE1 %lu, CSNTE2 %lu",
1295 entry
->mte_cmte_index
, entry
->mte_cvte_index
,
1296 entry
->mte_clte_index
, entry
->mte_ctte_index
,
1297 entry
->mte_csnte_idx_1
, entry
->mte_csnte_idx_2
);
1299 if (entry
->mte_parent
!= 0)
1300 fprintf (f
, ", parent %lu", entry
->mte_parent
);
1302 fprintf (f
, ", no parent");
1304 if (entry
->mte_cmte_index
!= 0)
1305 fprintf (f
, ", child %lu", entry
->mte_cmte_index
);
1307 fprintf (f
, ", no child");
1311 bfd_sym_print_file_references_table_entry (bfd
*abfd
,
1313 bfd_sym_file_references_table_entry
*entry
)
1315 switch (entry
->generic
.type
)
1317 case BFD_SYM_FILE_NAME_INDEX
:
1318 fprintf (f
, "FILE \"%.*s\" (NTE %lu), modtime ",
1319 bfd_sym_symbol_name (abfd
, entry
->filename
.nte_index
)[0],
1320 &bfd_sym_symbol_name (abfd
, entry
->filename
.nte_index
)[1],
1321 entry
->filename
.nte_index
);
1323 fprintf (f
, "[UNIMPLEMENTED]");
1324 /* printModDate (entry->filename.mod_date); */
1325 fprintf (f
, " (0x%lx)", entry
->filename
.mod_date
);
1328 case BFD_SYM_END_OF_LIST
:
1333 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu",
1334 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1335 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1336 entry
->entry
.mte_index
,
1337 entry
->entry
.file_offset
);
1343 bfd_sym_print_contained_modules_table_entry (bfd
*abfd
,
1345 bfd_sym_contained_modules_table_entry
*entry
)
1347 switch (entry
->generic
.type
)
1349 case BFD_SYM_END_OF_LIST
:
1354 fprintf (f
, "\"%.*s\" (MTE %lu, NTE %lu)",
1355 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1356 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1357 entry
->entry
.mte_index
,
1358 entry
->entry
.nte_index
);
1364 bfd_sym_print_contained_variables_table_entry (bfd
*abfd
,
1366 bfd_sym_contained_variables_table_entry
*entry
)
1368 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1374 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1376 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1377 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1381 fprintf (f
, "\"%.*s\" (NTE %lu)",
1382 bfd_sym_symbol_name (abfd
, entry
->entry
.nte_index
)[0],
1383 &bfd_sym_symbol_name (abfd
, entry
->entry
.nte_index
)[1],
1384 entry
->entry
.nte_index
);
1386 fprintf (f
, ", TTE %lu", entry
->entry
.tte_index
);
1387 fprintf (f
, ", offset %lu", entry
->entry
.file_delta
);
1388 fprintf (f
, ", scope %s", bfd_sym_unparse_symbol_scope (entry
->entry
.scope
));
1390 if (entry
->entry
.la_size
== BFD_SYM_CVTE_SCA
)
1391 fprintf (f
, ", latype %s, laclass %s, laoffset %lu",
1392 bfd_sym_unparse_storage_kind (entry
->entry
.address
.scstruct
.sca_kind
),
1393 bfd_sym_unparse_storage_class (entry
->entry
.address
.scstruct
.sca_class
),
1394 entry
->entry
.address
.scstruct
.sca_offset
);
1395 else if (entry
->entry
.la_size
<= BFD_SYM_CVTE_LA_MAX_SIZE
)
1399 fprintf (f
, ", la [");
1400 for (i
= 0; i
< entry
->entry
.la_size
; i
++)
1401 fprintf (f
, "0x%02x ", entry
->entry
.address
.lastruct
.la
[i
]);
1404 else if (entry
->entry
.la_size
== BFD_SYM_CVTE_BIG_LA
)
1405 fprintf (f
, ", bigla %lu, biglakind %u",
1406 entry
->entry
.address
.biglastruct
.big_la
,
1407 entry
->entry
.address
.biglastruct
.big_la_kind
);
1410 fprintf (f
, ", la [INVALID]");
1414 bfd_sym_print_contained_statements_table_entry (bfd
*abfd
,
1416 bfd_sym_contained_statements_table_entry
*entry
)
1418 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1424 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1426 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1427 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1431 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu, delta %lu",
1432 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1433 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1434 entry
->entry
.mte_index
,
1435 entry
->entry
.mte_offset
,
1436 entry
->entry
.file_delta
);
1440 bfd_sym_print_contained_labels_table_entry (bfd
*abfd
,
1442 bfd_sym_contained_labels_table_entry
*entry
)
1444 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1450 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1452 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1453 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1457 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu, delta %lu, scope %s",
1458 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1459 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1460 entry
->entry
.mte_index
,
1461 entry
->entry
.mte_offset
,
1462 entry
->entry
.file_delta
,
1463 bfd_sym_unparse_symbol_scope (entry
->entry
.scope
));
1467 bfd_sym_print_contained_types_table_entry (bfd
*abfd ATTRIBUTE_UNUSED
,
1469 bfd_sym_contained_types_table_entry
*entry ATTRIBUTE_UNUSED
)
1471 fprintf (f
, "[UNIMPLEMENTED]");
1475 bfd_sym_type_operator_name (unsigned char num
)
1479 case 1: return "TTE";
1480 case 2: return "PointerTo";
1481 case 3: return "ScalarOf";
1482 case 4: return "ConstantOf";
1483 case 5: return "EnumerationOf";
1484 case 6: return "VectorOf";
1485 case 7: return "RecordOf";
1486 case 8: return "UnionOf";
1487 case 9: return "SubRangeOf";
1488 case 10: return "SetOf";
1489 case 11: return "NamedTypeOf";
1490 case 12: return "ProcOf";
1491 case 13: return "ValueOf";
1492 case 14: return "ArrayOf";
1493 default: return "[UNKNOWN OPERATOR]";
1498 bfd_sym_type_basic_name (unsigned char num
)
1502 case 0: return "void";
1503 case 1: return "pascal string";
1504 case 2: return "unsigned long";
1505 case 3: return "signed long";
1506 case 4: return "extended (10 bytes)";
1507 case 5: return "pascal boolean (1 byte)";
1508 case 6: return "unsigned byte";
1509 case 7: return "signed byte";
1510 case 8: return "character (1 byte)";
1511 case 9: return "wide character (2 bytes)";
1512 case 10: return "unsigned short";
1513 case 11: return "signed short";
1514 case 12: return "singled";
1515 case 13: return "double";
1516 case 14: return "extended (12 bytes)";
1517 case 15: return "computational (8 bytes)";
1518 case 16: return "c string";
1519 case 17: return "as-is string";
1520 default: return "[UNKNOWN BASIC TYPE]";
1525 bfd_sym_fetch_long (unsigned char *buf
,
1527 unsigned long offset
,
1528 unsigned long *offsetptr
,
1539 else if (! (buf
[offset
] & 0x80))
1541 *value
= buf
[offset
];
1545 else if (buf
[offset
] == 0xc0)
1547 if ((offset
+ 5) > len
)
1555 *value
= bfd_getb32 (buf
+ offset
+ 1);
1560 else if ((buf
[offset
] & 0xc0) == 0xc0)
1562 *value
= -(buf
[offset
] & 0x3f);
1566 else if ((buf
[offset
] & 0xc0) == 0x80)
1568 if ((offset
+ 2) > len
)
1576 *value
= bfd_getb16 (buf
+ offset
) & 0x3fff;
1584 if (offsetptr
!= NULL
)
1585 *offsetptr
= offset
;
1591 bfd_sym_print_type_information (bfd
*abfd
,
1595 unsigned long offset
,
1596 unsigned long *offsetptr
)
1602 fprintf (f
, "[NULL]");
1604 if (offsetptr
!= NULL
)
1605 *offsetptr
= offset
;
1612 if (! (type
& 0x80))
1614 fprintf (f
, "[%s] (0x%x)", bfd_sym_type_basic_name (type
& 0x7f), type
);
1616 if (offsetptr
!= NULL
)
1617 *offsetptr
= offset
;
1622 fprintf (f
, "[packed ");
1626 switch (type
& 0x3f)
1631 bfd_sym_type_information_table_entry tinfo
;
1633 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1635 fprintf (f
, "[INVALID]");
1638 if (bfd_sym_fetch_type_table_information (abfd
, &tinfo
, value
) < 0)
1639 fprintf (f
, "[INVALID]");
1641 fprintf (f
, "\"%.*s\"",
1642 bfd_sym_symbol_name (abfd
, tinfo
.nte_index
)[0],
1643 &bfd_sym_symbol_name (abfd
, tinfo
.nte_index
)[1]);
1645 fprintf (f
, " (TTE %lu)", (unsigned long) value
);
1650 fprintf (f
, "pointer (0x%x) to ", type
);
1651 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1658 fprintf (f
, "scalar (0x%x) of ", type
);
1659 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1660 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1661 fprintf (f
, " (%lu)", (unsigned long) value
);
1667 long lower
, upper
, nelem
;
1670 fprintf (f
, "enumeration (0x%x) of ", type
);
1671 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1672 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &lower
);
1673 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &upper
);
1674 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &nelem
);
1675 fprintf (f
, " from %lu to %lu with %lu elements: ",
1676 (unsigned long) lower
, (unsigned long) upper
,
1677 (unsigned long) nelem
);
1679 for (i
= 0; i
< nelem
; i
++)
1682 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1688 fprintf (f
, "vector (0x%x)", type
);
1689 fprintf (f
, "\n index ");
1690 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1691 fprintf (f
, "\n target ");
1692 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1698 long nrec
, eloff
, i
;
1700 if ((type
& 0x3f) == 7)
1701 fprintf (f
, "record (0x%x) of ", type
);
1703 fprintf (f
, "union (0x%x) of ", type
);
1705 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &nrec
);
1706 fprintf (f
, "%lu elements: ", (unsigned long) nrec
);
1708 for (i
= 0; i
< nrec
; i
++)
1710 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &eloff
);
1712 fprintf (f
, "offset %lu: ", (unsigned long) eloff
);
1713 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1719 fprintf (f
, "subrange (0x%x) of ", type
);
1720 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1721 fprintf (f
, " lower ");
1722 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1723 fprintf (f
, " upper ");
1724 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1731 fprintf (f
, "named type (0x%x) ", type
);
1732 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1734 fprintf (f
, "[INVALID]");
1736 fprintf (f
, "\"%.*s\"",
1737 bfd_sym_symbol_name (abfd
, value
)[0],
1738 &bfd_sym_symbol_name (abfd
, value
)[1]);
1740 fprintf (f
, " (NTE %lu) with type ", (unsigned long) value
);
1741 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1746 fprintf (f
, "%s (0x%x)", bfd_sym_type_operator_name (type
), type
);
1750 if (type
== (0x40 | 0x6))
1757 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &n
);
1758 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &width
);
1759 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &m
);
1760 /* fprintf (f, "\n "); */
1761 fprintf (f
, " N %ld, width %ld, M %ld, ", n
, width
, m
);
1762 for (i
= 0; i
< m
; i
++)
1764 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &l
);
1767 fprintf (f
, "%ld", l
);
1770 else if (type
& 0x40)
1772 /* Other packed type. */
1775 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &msb
);
1776 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &lsb
);
1777 /* fprintf (f, "\n "); */
1778 fprintf (f
, " msb %ld, lsb %ld", msb
, lsb
);
1783 if (offsetptr
!= NULL
)
1784 *offsetptr
= offset
;
1788 bfd_sym_print_type_information_table_entry (bfd
*abfd
,
1790 bfd_sym_type_information_table_entry
*entry
)
1793 unsigned long offset
;
1796 fprintf (f
, "\"%.*s\" (NTE %lu), %lu bytes at %lu, logical size %lu",
1797 bfd_sym_symbol_name (abfd
, entry
->nte_index
)[0],
1798 &bfd_sym_symbol_name (abfd
, entry
->nte_index
)[1],
1800 entry
->physical_size
, entry
->offset
, entry
->logical_size
);
1804 buf
= alloca (entry
->physical_size
);
1807 fprintf (f
, "[ERROR]\n");
1810 if (bfd_seek (abfd
, entry
->offset
, SEEK_SET
) < 0)
1812 fprintf (f
, "[ERROR]\n");
1815 if (bfd_bread (buf
, entry
->physical_size
, abfd
) != entry
->physical_size
)
1817 fprintf (f
, "[ERROR]\n");
1822 for (i
= 0; i
< entry
->physical_size
; i
++)
1825 fprintf (f
, "0x%02x", buf
[i
]);
1827 fprintf (f
, " 0x%02x", buf
[i
]);
1833 bfd_sym_print_type_information (abfd
, f
, buf
, entry
->physical_size
, 0, &offset
);
1835 if (offset
!= entry
->physical_size
)
1836 fprintf (f
, "\n [parser used %lu bytes instead of %lu]", offset
, entry
->physical_size
);
1840 bfd_sym_print_file_references_index_table_entry (bfd
*abfd ATTRIBUTE_UNUSED
,
1842 bfd_sym_file_references_index_table_entry
*entry ATTRIBUTE_UNUSED
)
1844 fprintf (f
, "[UNIMPLEMENTED]");
1848 bfd_sym_print_constant_pool_entry (bfd
*abfd ATTRIBUTE_UNUSED
,
1850 bfd_sym_constant_pool_entry
*entry ATTRIBUTE_UNUSED
)
1852 fprintf (f
, "[UNIMPLEMENTED]");
1856 bfd_sym_display_name_table_entry (bfd
*abfd
,
1858 unsigned char *entry
)
1860 unsigned long sym_index
;
1861 unsigned long offset
;
1862 bfd_sym_data_struct
*sdata
= NULL
;
1864 BFD_ASSERT (bfd_sym_valid (abfd
));
1865 sdata
= abfd
->tdata
.sym_data
;
1866 sym_index
= (entry
- sdata
->name_table
) / 2;
1868 if (sdata
->version
>= BFD_SYM_VERSION_3_4
&& entry
[0] == 255 && entry
[1] == 0)
1870 unsigned short length
= bfd_getb16 (entry
+ 2);
1871 fprintf (f
, "[%8lu] \"%.*s\"\n", sym_index
, length
, entry
+ 4);
1872 offset
= 2 + length
+ 1;
1876 if (! (entry
[0] == 0 || (entry
[0] == 1 && entry
[1] == '\0')))
1877 fprintf (f
, "[%8lu] \"%.*s\"\n", sym_index
, entry
[0], entry
+ 1);
1879 if (sdata
->version
>= BFD_SYM_VERSION_3_4
)
1880 offset
= entry
[0] + 2;
1882 offset
= entry
[0] + 1;
1885 return (entry
+ offset
+ (offset
% 2));
1889 bfd_sym_display_name_table (bfd
*abfd
, FILE *f
)
1891 unsigned long name_table_len
;
1892 unsigned char *name_table
, *name_table_end
, *cur
;
1893 bfd_sym_data_struct
*sdata
= NULL
;
1895 BFD_ASSERT (bfd_sym_valid (abfd
));
1896 sdata
= abfd
->tdata
.sym_data
;
1898 name_table_len
= sdata
->header
.dshb_nte
.dti_page_count
* sdata
->header
.dshb_page_size
;
1899 name_table
= sdata
->name_table
;
1900 name_table_end
= name_table
+ name_table_len
;
1902 fprintf (f
, "name table (NTE) contains %lu bytes:\n\n", name_table_len
);
1907 cur
= bfd_sym_display_name_table_entry (abfd
, f
, cur
);
1908 if (cur
>= name_table_end
)
1914 bfd_sym_display_resources_table (bfd
*abfd
, FILE *f
)
1917 bfd_sym_resources_table_entry entry
;
1918 bfd_sym_data_struct
*sdata
= NULL
;
1920 BFD_ASSERT (bfd_sym_valid (abfd
));
1921 sdata
= abfd
->tdata
.sym_data
;
1923 fprintf (f
, "resource table (RTE) contains %lu objects:\n\n",
1924 sdata
->header
.dshb_rte
.dti_object_count
);
1926 for (i
= 1; i
<= sdata
->header
.dshb_rte
.dti_object_count
; i
++)
1928 if (bfd_sym_fetch_resources_table_entry (abfd
, &entry
, i
) < 0)
1929 fprintf (f
, " [%8lu] [INVALID]\n", i
);
1932 fprintf (f
, " [%8lu] ", i
);
1933 bfd_sym_print_resources_table_entry (abfd
, f
, &entry
);
1940 bfd_sym_display_modules_table (bfd
*abfd
, FILE *f
)
1943 bfd_sym_modules_table_entry entry
;
1944 bfd_sym_data_struct
*sdata
= NULL
;
1946 BFD_ASSERT (bfd_sym_valid (abfd
));
1947 sdata
= abfd
->tdata
.sym_data
;
1949 fprintf (f
, "module table (MTE) contains %lu objects:\n\n",
1950 sdata
->header
.dshb_mte
.dti_object_count
);
1952 for (i
= 1; i
<= sdata
->header
.dshb_mte
.dti_object_count
; i
++)
1954 if (bfd_sym_fetch_modules_table_entry (abfd
, &entry
, i
) < 0)
1955 fprintf (f
, " [%8lu] [INVALID]\n", i
);
1958 fprintf (f
, " [%8lu] ", i
);
1959 bfd_sym_print_modules_table_entry (abfd
, f
, &entry
);
1966 bfd_sym_display_file_references_table (bfd
*abfd
, FILE *f
)
1969 bfd_sym_file_references_table_entry entry
;
1970 bfd_sym_data_struct
*sdata
= NULL
;
1972 BFD_ASSERT (bfd_sym_valid (abfd
));
1973 sdata
= abfd
->tdata
.sym_data
;
1975 fprintf (f
, "file reference table (FRTE) contains %lu objects:\n\n",
1976 sdata
->header
.dshb_frte
.dti_object_count
);
1978 for (i
= 1; i
<= sdata
->header
.dshb_frte
.dti_object_count
; i
++)
1980 if (bfd_sym_fetch_file_references_table_entry (abfd
, &entry
, i
) < 0)
1981 fprintf (f
, " [%8lu] [INVALID]\n", i
);
1984 fprintf (f
, " [%8lu] ", i
);
1985 bfd_sym_print_file_references_table_entry (abfd
, f
, &entry
);
1992 bfd_sym_display_contained_modules_table (bfd
*abfd
, FILE *f
)
1995 bfd_sym_contained_modules_table_entry entry
;
1996 bfd_sym_data_struct
*sdata
= NULL
;
1998 BFD_ASSERT (bfd_sym_valid (abfd
));
1999 sdata
= abfd
->tdata
.sym_data
;
2001 fprintf (f
, "contained modules table (CMTE) contains %lu objects:\n\n",
2002 sdata
->header
.dshb_cmte
.dti_object_count
);
2004 for (i
= 1; i
<= sdata
->header
.dshb_cmte
.dti_object_count
; i
++)
2006 if (bfd_sym_fetch_contained_modules_table_entry (abfd
, &entry
, i
) < 0)
2007 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2010 fprintf (f
, " [%8lu] ", i
);
2011 bfd_sym_print_contained_modules_table_entry (abfd
, f
, &entry
);
2018 bfd_sym_display_contained_variables_table (bfd
*abfd
, FILE *f
)
2021 bfd_sym_contained_variables_table_entry entry
;
2022 bfd_sym_data_struct
*sdata
= NULL
;
2024 BFD_ASSERT (bfd_sym_valid (abfd
));
2025 sdata
= abfd
->tdata
.sym_data
;
2027 fprintf (f
, "contained variables table (CVTE) contains %lu objects:\n\n",
2028 sdata
->header
.dshb_cvte
.dti_object_count
);
2030 for (i
= 1; i
<= sdata
->header
.dshb_cvte
.dti_object_count
; i
++)
2032 if (bfd_sym_fetch_contained_variables_table_entry (abfd
, &entry
, i
) < 0)
2033 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2036 fprintf (f
, " [%8lu] ", i
);
2037 bfd_sym_print_contained_variables_table_entry (abfd
, f
, &entry
);
2046 bfd_sym_display_contained_statements_table (bfd
*abfd
, FILE *f
)
2049 bfd_sym_contained_statements_table_entry entry
;
2050 bfd_sym_data_struct
*sdata
= NULL
;
2052 BFD_ASSERT (bfd_sym_valid (abfd
));
2053 sdata
= abfd
->tdata
.sym_data
;
2055 fprintf (f
, "contained statements table (CSNTE) contains %lu objects:\n\n",
2056 sdata
->header
.dshb_csnte
.dti_object_count
);
2058 for (i
= 1; i
<= sdata
->header
.dshb_csnte
.dti_object_count
; i
++)
2060 if (bfd_sym_fetch_contained_statements_table_entry (abfd
, &entry
, i
) < 0)
2061 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2064 fprintf (f
, " [%8lu] ", i
);
2065 bfd_sym_print_contained_statements_table_entry (abfd
, f
, &entry
);
2072 bfd_sym_display_contained_labels_table (bfd
*abfd
, FILE *f
)
2075 bfd_sym_contained_labels_table_entry entry
;
2076 bfd_sym_data_struct
*sdata
= NULL
;
2078 BFD_ASSERT (bfd_sym_valid (abfd
));
2079 sdata
= abfd
->tdata
.sym_data
;
2081 fprintf (f
, "contained labels table (CLTE) contains %lu objects:\n\n",
2082 sdata
->header
.dshb_clte
.dti_object_count
);
2084 for (i
= 1; i
<= sdata
->header
.dshb_clte
.dti_object_count
; i
++)
2086 if (bfd_sym_fetch_contained_labels_table_entry (abfd
, &entry
, i
) < 0)
2087 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2090 fprintf (f
, " [%8lu] ", i
);
2091 bfd_sym_print_contained_labels_table_entry (abfd
, f
, &entry
);
2098 bfd_sym_display_contained_types_table (bfd
*abfd
, FILE *f
)
2101 bfd_sym_contained_types_table_entry entry
;
2102 bfd_sym_data_struct
*sdata
= NULL
;
2104 BFD_ASSERT (bfd_sym_valid (abfd
));
2105 sdata
= abfd
->tdata
.sym_data
;
2107 fprintf (f
, "contained types table (CTTE) contains %lu objects:\n\n",
2108 sdata
->header
.dshb_ctte
.dti_object_count
);
2110 for (i
= 1; i
<= sdata
->header
.dshb_ctte
.dti_object_count
; i
++)
2112 if (bfd_sym_fetch_contained_types_table_entry (abfd
, &entry
, i
) < 0)
2113 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2116 fprintf (f
, " [%8lu] ", i
);
2117 bfd_sym_print_contained_types_table_entry (abfd
, f
, &entry
);
2124 bfd_sym_display_file_references_index_table (bfd
*abfd
, FILE *f
)
2127 bfd_sym_file_references_index_table_entry entry
;
2128 bfd_sym_data_struct
*sdata
= NULL
;
2130 BFD_ASSERT (bfd_sym_valid (abfd
));
2131 sdata
= abfd
->tdata
.sym_data
;
2133 fprintf (f
, "file references index table (FITE) contains %lu objects:\n\n",
2134 sdata
->header
.dshb_fite
.dti_object_count
);
2136 for (i
= 1; i
<= sdata
->header
.dshb_fite
.dti_object_count
; i
++)
2138 if (bfd_sym_fetch_file_references_index_table_entry (abfd
, &entry
, i
) < 0)
2139 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2142 fprintf (f
, " [%8lu] ", i
);
2143 bfd_sym_print_file_references_index_table_entry (abfd
, f
, &entry
);
2150 bfd_sym_display_constant_pool (bfd
*abfd
, FILE *f
)
2153 bfd_sym_constant_pool_entry entry
;
2154 bfd_sym_data_struct
*sdata
= NULL
;
2156 BFD_ASSERT (bfd_sym_valid (abfd
));
2157 sdata
= abfd
->tdata
.sym_data
;
2159 fprintf (f
, "constant pool (CONST) contains %lu objects:\n\n",
2160 sdata
->header
.dshb_const
.dti_object_count
);
2162 for (i
= 1; i
<= sdata
->header
.dshb_const
.dti_object_count
; i
++)
2164 if (bfd_sym_fetch_constant_pool_entry (abfd
, &entry
, i
) < 0)
2165 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2168 fprintf (f
, " [%8lu] ", i
);
2169 bfd_sym_print_constant_pool_entry (abfd
, f
, &entry
);
2176 bfd_sym_display_type_information_table (bfd
*abfd
, FILE *f
)
2179 bfd_sym_type_table_entry sym_index
;
2180 bfd_sym_type_information_table_entry entry
;
2181 bfd_sym_data_struct
*sdata
= NULL
;
2183 BFD_ASSERT (bfd_sym_valid (abfd
));
2184 sdata
= abfd
->tdata
.sym_data
;
2186 if (sdata
->header
.dshb_tte
.dti_object_count
> 99)
2187 fprintf (f
, "type table (TINFO) contains %lu objects:\n\n",
2188 sdata
->header
.dshb_tte
.dti_object_count
- 99);
2191 fprintf (f
, "type table (TINFO) contains [INVALID] objects:\n\n");
2195 for (i
= 100; i
<= sdata
->header
.dshb_tte
.dti_object_count
; i
++)
2197 if (bfd_sym_fetch_type_table_entry (abfd
, &sym_index
, i
- 100) < 0)
2198 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2201 fprintf (f
, " [%8lu] (TINFO %lu) ", i
, sym_index
);
2203 if (bfd_sym_fetch_type_information_table_entry (abfd
, &entry
, sym_index
) < 0)
2204 fprintf (f
, "[INVALID]");
2206 bfd_sym_print_type_information_table_entry (abfd
, f
, &entry
);
2214 bfd_sym_scan (bfd
*abfd
, bfd_sym_version version
, bfd_sym_data_struct
*mdata
)
2217 const char *name
= "symbols";
2219 mdata
->name_table
= 0;
2221 mdata
->version
= version
;
2223 bfd_seek (abfd
, 0, SEEK_SET
);
2224 if (bfd_sym_read_header (abfd
, &mdata
->header
, mdata
->version
) != 0)
2227 mdata
->name_table
= bfd_sym_read_name_table (abfd
, &mdata
->header
);
2228 if (mdata
->name_table
== NULL
)
2231 bfdsec
= bfd_make_section_anyway_with_flags (abfd
, name
, SEC_HAS_CONTENTS
);
2238 bfdsec
->filepos
= 0;
2239 bfdsec
->alignment_power
= 0;
2241 abfd
->tdata
.sym_data
= mdata
;
2247 bfd_sym_object_p (bfd
*abfd
)
2249 struct bfd_preserve preserve
;
2250 bfd_sym_version version
= -1;
2252 preserve
.marker
= NULL
;
2253 bfd_seek (abfd
, 0, SEEK_SET
);
2254 if (bfd_sym_read_version (abfd
, &version
) != 0)
2257 preserve
.marker
= bfd_alloc (abfd
, sizeof (bfd_sym_data_struct
));
2258 if (preserve
.marker
== NULL
2259 || ! bfd_preserve_save (abfd
, &preserve
))
2262 if (bfd_sym_scan (abfd
, version
,
2263 (bfd_sym_data_struct
*) preserve
.marker
) != 0)
2266 bfd_preserve_finish (abfd
, &preserve
);
2270 bfd_set_error (bfd_error_wrong_format
);
2273 if (preserve
.marker
!= NULL
)
2274 bfd_preserve_restore (abfd
, &preserve
);
2278 #define bfd_sym_make_empty_symbol _bfd_generic_make_empty_symbol
2281 bfd_sym_get_symbol_info (bfd
*abfd ATTRIBUTE_UNUSED
, asymbol
*symbol
, symbol_info
*ret
)
2283 bfd_symbol_info (symbol
, ret
);
2287 bfd_sym_get_symtab_upper_bound (bfd
*abfd ATTRIBUTE_UNUSED
)
2293 bfd_sym_canonicalize_symtab (bfd
*abfd ATTRIBUTE_UNUSED
, asymbol
**sym ATTRIBUTE_UNUSED
)
2299 bfd_sym_sizeof_headers (bfd
*abfd ATTRIBUTE_UNUSED
,
2300 struct bfd_link_info
*info ATTRIBUTE_UNUSED
)
2305 const bfd_target sym_vec
=
2308 bfd_target_sym_flavour
, /* Flavour. */
2309 BFD_ENDIAN_BIG
, /* Byteorder. */
2310 BFD_ENDIAN_BIG
, /* Header byteorder. */
2311 (HAS_RELOC
| EXEC_P
| /* Object flags. */
2312 HAS_LINENO
| HAS_DEBUG
|
2313 HAS_SYMS
| HAS_LOCALS
| DYNAMIC
| WP_TEXT
| D_PAGED
),
2314 (SEC_ALLOC
| SEC_LOAD
| SEC_READONLY
| SEC_CODE
| SEC_DATA
2315 | SEC_ROM
| SEC_HAS_CONTENTS
), /* Section_flags. */
2316 0, /* Symbol_leading_char. */
2317 ' ', /* AR_pad_char. */
2318 16, /* AR_max_namelen. */
2319 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2320 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2321 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* Data. */
2322 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2323 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2324 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* Hdrs. */
2325 { /* bfd_check_format. */
2327 bfd_sym_object_p
, /* bfd_check_format. */
2331 { /* bfd_set_format. */
2337 { /* bfd_write_contents. */
2344 BFD_JUMP_TABLE_GENERIC (bfd_sym
),
2345 BFD_JUMP_TABLE_COPY (_bfd_generic
),
2346 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
2347 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive
),
2348 BFD_JUMP_TABLE_SYMBOLS (bfd_sym
),
2349 BFD_JUMP_TABLE_RELOCS (_bfd_norelocs
),
2350 BFD_JUMP_TABLE_WRITE (bfd_sym
),
2351 BFD_JUMP_TABLE_LINK (bfd_sym
),
2352 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),