1 /* xSYM symbol-file support for BFD.
2 Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
3 Free Software Foundation, Inc.
5 This file is part of BFD, the Binary File Descriptor library.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
26 #define bfd_sym_close_and_cleanup _bfd_generic_close_and_cleanup
27 #define bfd_sym_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
28 #define bfd_sym_new_section_hook _bfd_generic_new_section_hook
29 #define bfd_sym_bfd_is_local_label_name bfd_generic_is_local_label_name
30 #define bfd_sym_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
31 #define bfd_sym_get_lineno _bfd_nosymbols_get_lineno
32 #define bfd_sym_find_nearest_line _bfd_nosymbols_find_nearest_line
33 #define bfd_sym_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
34 #define bfd_sym_read_minisymbols _bfd_generic_read_minisymbols
35 #define bfd_sym_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
36 #define bfd_sym_get_reloc_upper_bound _bfd_norelocs_get_reloc_upper_bound
37 #define bfd_sym_canonicalize_reloc _bfd_norelocs_canonicalize_reloc
38 #define bfd_sym_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
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_link_hash_table_create _bfd_generic_link_hash_table_create
50 #define bfd_sym_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
51 #define bfd_sym_bfd_link_add_symbols _bfd_generic_link_add_symbols
52 #define bfd_sym_bfd_link_just_syms _bfd_generic_link_just_syms
53 #define bfd_sym_bfd_final_link _bfd_generic_final_link
54 #define bfd_sym_bfd_link_split_section _bfd_generic_link_split_section
55 #define bfd_sym_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
57 extern const bfd_target sym_vec
;
60 pstrcmp (const char *as
, const char *bs
)
62 const unsigned char *a
= (const unsigned char *) as
;
63 const unsigned char *b
= (const unsigned char *) bs
;
67 clen
= (a
[0] > b
[0]) ? b
[0] : a
[0];
68 ret
= memcmp (a
+ 1, b
+ 1, clen
);
81 compute_offset (unsigned long first_page
,
82 unsigned long page_size
,
83 unsigned long entry_size
,
86 unsigned long entries_per_page
= page_size
/ entry_size
;
87 unsigned long page_number
= first_page
+ (index
/ entries_per_page
);
88 unsigned long page_offset
= (index
% entries_per_page
) * entry_size
;
90 return (page_number
* page_size
) + page_offset
;
94 bfd_sym_mkobject (bfd
*abfd ATTRIBUTE_UNUSED
)
100 bfd_sym_print_symbol (bfd
*abfd ATTRIBUTE_UNUSED
,
101 void * afile ATTRIBUTE_UNUSED
,
102 asymbol
*symbol ATTRIBUTE_UNUSED
,
103 bfd_print_symbol_type how ATTRIBUTE_UNUSED
)
109 bfd_sym_valid (bfd
*abfd
)
111 if (abfd
== NULL
|| abfd
->xvec
== NULL
)
114 return abfd
->xvec
== &sym_vec
;
118 bfd_sym_read_name_table (bfd
*abfd
, bfd_sym_header_block
*dshb
)
122 size_t table_size
= dshb
->dshb_nte
.dti_page_count
* dshb
->dshb_page_size
;
123 size_t table_offset
= dshb
->dshb_nte
.dti_first_page
* dshb
->dshb_page_size
;
125 rstr
= bfd_alloc (abfd
, table_size
);
129 bfd_seek (abfd
, table_offset
, SEEK_SET
);
130 ret
= bfd_bread (rstr
, table_size
, abfd
);
131 if (ret
< 0 || (unsigned long) ret
!= table_size
)
133 bfd_release (abfd
, rstr
);
141 bfd_sym_parse_file_reference_v32 (unsigned char *buf
,
143 bfd_sym_file_reference
*entry
)
145 BFD_ASSERT (len
== 6);
147 entry
->fref_frte_index
= bfd_getb16 (buf
);
148 entry
->fref_offset
= bfd_getb32 (buf
+ 2);
152 bfd_sym_parse_disk_table_v32 (unsigned char *buf
,
154 bfd_sym_table_info
*table
)
156 BFD_ASSERT (len
== 8);
158 table
->dti_first_page
= bfd_getb16 (buf
);
159 table
->dti_page_count
= bfd_getb16 (buf
+ 2);
160 table
->dti_object_count
= bfd_getb32 (buf
+ 4);
164 bfd_sym_parse_header_v32 (unsigned char *buf
,
166 bfd_sym_header_block
*header
)
168 BFD_ASSERT (len
== 154);
170 memcpy (header
->dshb_id
, buf
, 32);
171 header
->dshb_page_size
= bfd_getb16 (buf
+ 32);
172 header
->dshb_hash_page
= bfd_getb16 (buf
+ 34);
173 header
->dshb_root_mte
= bfd_getb16 (buf
+ 36);
174 header
->dshb_mod_date
= bfd_getb32 (buf
+ 38);
176 bfd_sym_parse_disk_table_v32 (buf
+ 42, 8, &header
->dshb_frte
);
177 bfd_sym_parse_disk_table_v32 (buf
+ 50, 8, &header
->dshb_rte
);
178 bfd_sym_parse_disk_table_v32 (buf
+ 58, 8, &header
->dshb_mte
);
179 bfd_sym_parse_disk_table_v32 (buf
+ 66, 8, &header
->dshb_cmte
);
180 bfd_sym_parse_disk_table_v32 (buf
+ 74, 8, &header
->dshb_cvte
);
181 bfd_sym_parse_disk_table_v32 (buf
+ 82, 8, &header
->dshb_csnte
);
182 bfd_sym_parse_disk_table_v32 (buf
+ 90, 8, &header
->dshb_clte
);
183 bfd_sym_parse_disk_table_v32 (buf
+ 98, 8, &header
->dshb_ctte
);
184 bfd_sym_parse_disk_table_v32 (buf
+ 106, 8, &header
->dshb_tte
);
185 bfd_sym_parse_disk_table_v32 (buf
+ 114, 8, &header
->dshb_nte
);
186 bfd_sym_parse_disk_table_v32 (buf
+ 122, 8, &header
->dshb_tinfo
);
187 bfd_sym_parse_disk_table_v32 (buf
+ 130, 8, &header
->dshb_fite
);
188 bfd_sym_parse_disk_table_v32 (buf
+ 138, 8, &header
->dshb_const
);
190 memcpy (&header
->dshb_file_creator
, buf
+ 146, 4);
191 memcpy (&header
->dshb_file_type
, buf
+ 150, 4);
195 bfd_sym_read_header_v32 (bfd
*abfd
, bfd_sym_header_block
*header
)
197 unsigned char buf
[154];
200 ret
= bfd_bread (buf
, 154, abfd
);
204 bfd_sym_parse_header_v32 (buf
, 154, header
);
210 bfd_sym_read_header_v34 (bfd
*abfd ATTRIBUTE_UNUSED
,
211 bfd_sym_header_block
*header ATTRIBUTE_UNUSED
)
217 bfd_sym_read_header (bfd
*abfd
,
218 bfd_sym_header_block
*header
,
219 bfd_sym_version version
)
223 case BFD_SYM_VERSION_3_5
:
224 case BFD_SYM_VERSION_3_4
:
225 return bfd_sym_read_header_v34 (abfd
, header
);
226 case BFD_SYM_VERSION_3_3
:
227 case BFD_SYM_VERSION_3_2
:
228 return bfd_sym_read_header_v32 (abfd
, header
);
229 case BFD_SYM_VERSION_3_1
:
236 bfd_sym_read_version (bfd
*abfd
, bfd_sym_version
*version
)
238 char version_string
[32];
241 ret
= bfd_bread (version_string
, sizeof (version_string
), abfd
);
242 if (ret
!= sizeof (version_string
))
245 if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_1
) == 0)
246 *version
= BFD_SYM_VERSION_3_1
;
247 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_2
) == 0)
248 *version
= BFD_SYM_VERSION_3_2
;
249 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_3
) == 0)
250 *version
= BFD_SYM_VERSION_3_3
;
251 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_4
) == 0)
252 *version
= BFD_SYM_VERSION_3_4
;
253 else if (pstrcmp (version_string
, BFD_SYM_VERSION_STR_3_5
) == 0)
254 *version
= BFD_SYM_VERSION_3_5
;
262 bfd_sym_display_table_summary (FILE *f
,
263 bfd_sym_table_info
*dti
,
266 fprintf (f
, "%-6s %13ld %13ld %13ld\n",
270 dti
->dti_object_count
);
274 bfd_sym_display_header (FILE *f
, bfd_sym_header_block
*dshb
)
276 fprintf (f
, " Version: %.*s\n", dshb
->dshb_id
[0], dshb
->dshb_id
+ 1);
277 fprintf (f
, " Page Size: 0x%x\n", dshb
->dshb_page_size
);
278 fprintf (f
, " Hash Page: %lu\n", dshb
->dshb_hash_page
);
279 fprintf (f
, " Root MTE: %lu\n", dshb
->dshb_root_mte
);
280 fprintf (f
, " Modification Date: ");
281 fprintf (f
, "[unimplemented]");
282 fprintf (f
, " (0x%lx)\n", dshb
->dshb_mod_date
);
284 fprintf (f
, " File Creator: %.4s Type: %.4s\n\n",
285 dshb
->dshb_file_creator
, dshb
->dshb_file_type
);
287 fprintf (f
, "Table Name First Page Page Count Object Count\n");
288 fprintf (f
, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
290 bfd_sym_display_table_summary (f
, &dshb
->dshb_nte
, "NTE");
291 bfd_sym_display_table_summary (f
, &dshb
->dshb_rte
, "RTE");
292 bfd_sym_display_table_summary (f
, &dshb
->dshb_mte
, "MTE");
293 bfd_sym_display_table_summary (f
, &dshb
->dshb_frte
, "FRTE");
294 bfd_sym_display_table_summary (f
, &dshb
->dshb_cmte
, "CMTE");
295 bfd_sym_display_table_summary (f
, &dshb
->dshb_cvte
, "CVTE");
296 bfd_sym_display_table_summary (f
, &dshb
->dshb_csnte
, "CSNTE");
297 bfd_sym_display_table_summary (f
, &dshb
->dshb_clte
, "CLTE");
298 bfd_sym_display_table_summary (f
, &dshb
->dshb_ctte
, "CTTE");
299 bfd_sym_display_table_summary (f
, &dshb
->dshb_tte
, "TTE");
300 bfd_sym_display_table_summary (f
, &dshb
->dshb_tinfo
, "TINFO");
301 bfd_sym_display_table_summary (f
, &dshb
->dshb_fite
, "FITE");
302 bfd_sym_display_table_summary (f
, &dshb
->dshb_const
, "CONST");
308 bfd_sym_parse_resources_table_entry_v32 (unsigned char *buf
,
310 bfd_sym_resources_table_entry
*entry
)
312 BFD_ASSERT (len
== 18);
314 memcpy (&entry
->rte_res_type
, buf
, 4);
315 entry
->rte_res_number
= bfd_getb16 (buf
+ 4);
316 entry
->rte_nte_index
= bfd_getb32 (buf
+ 6);
317 entry
->rte_mte_first
= bfd_getb16 (buf
+ 10);
318 entry
->rte_mte_last
= bfd_getb16 (buf
+ 12);
319 entry
->rte_res_size
= bfd_getb32 (buf
+ 14);
323 bfd_sym_parse_modules_table_entry_v33 (unsigned char *buf
,
325 bfd_sym_modules_table_entry
*entry
)
327 BFD_ASSERT (len
== 46);
329 entry
->mte_rte_index
= bfd_getb16 (buf
);
330 entry
->mte_res_offset
= bfd_getb32 (buf
+ 2);
331 entry
->mte_size
= bfd_getb32 (buf
+ 6);
332 entry
->mte_kind
= buf
[10];
333 entry
->mte_scope
= buf
[11];
334 entry
->mte_parent
= bfd_getb16 (buf
+ 12);
335 bfd_sym_parse_file_reference_v32 (buf
+ 14, 6, &entry
->mte_imp_fref
);
336 entry
->mte_imp_end
= bfd_getb32 (buf
+ 20);
337 entry
->mte_nte_index
= bfd_getb32 (buf
+ 24);
338 entry
->mte_cmte_index
= bfd_getb16 (buf
+ 28);
339 entry
->mte_cvte_index
= bfd_getb32 (buf
+ 30);
340 entry
->mte_clte_index
= bfd_getb16 (buf
+ 34);
341 entry
->mte_ctte_index
= bfd_getb16 (buf
+ 36);
342 entry
->mte_csnte_idx_1
= bfd_getb32 (buf
+ 38);
343 entry
->mte_csnte_idx_2
= bfd_getb32 (buf
+ 42);
347 bfd_sym_parse_file_references_table_entry_v32 (unsigned char *buf
,
349 bfd_sym_file_references_table_entry
*entry
)
353 BFD_ASSERT (len
== 10);
355 memset (entry
, 0, sizeof (bfd_sym_file_references_table_entry
));
356 type
= bfd_getb16 (buf
);
360 case BFD_SYM_END_OF_LIST_3_2
:
361 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
364 case BFD_SYM_FILE_NAME_INDEX_3_2
:
365 entry
->filename
.type
= BFD_SYM_FILE_NAME_INDEX
;
366 entry
->filename
.nte_index
= bfd_getb32 (buf
+ 2);
367 entry
->filename
.mod_date
= bfd_getb32 (buf
+ 6);
371 entry
->entry
.mte_index
= type
;
372 entry
->entry
.file_offset
= bfd_getb32 (buf
+ 2);
377 bfd_sym_parse_contained_modules_table_entry_v32 (unsigned char *buf
,
379 bfd_sym_contained_modules_table_entry
*entry
)
383 BFD_ASSERT (len
== 6);
385 memset (entry
, 0, sizeof (bfd_sym_contained_modules_table_entry
));
386 type
= bfd_getb16 (buf
);
390 case BFD_SYM_END_OF_LIST_3_2
:
391 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
395 entry
->entry
.mte_index
= type
;
396 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 2);
402 bfd_sym_parse_contained_variables_table_entry_v32 (unsigned char *buf
,
404 bfd_sym_contained_variables_table_entry
*entry
)
408 BFD_ASSERT (len
== 26);
410 memset (entry
, 0, sizeof (bfd_sym_contained_variables_table_entry
));
411 type
= bfd_getb16 (buf
);
415 case BFD_SYM_END_OF_LIST_3_2
:
416 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
419 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
420 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
421 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
425 entry
->entry
.tte_index
= type
;
426 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 2);
427 entry
->entry
.file_delta
= bfd_getb16 (buf
+ 6);
428 entry
->entry
.scope
= buf
[8];
429 entry
->entry
.la_size
= buf
[9];
431 if (entry
->entry
.la_size
== BFD_SYM_CVTE_SCA
)
433 entry
->entry
.address
.scstruct
.sca_kind
= buf
[10];
434 entry
->entry
.address
.scstruct
.sca_class
= buf
[11];
435 entry
->entry
.address
.scstruct
.sca_offset
= bfd_getb32 (buf
+ 12);
437 else if (entry
->entry
.la_size
<= BFD_SYM_CVTE_SCA
)
439 #if BFD_SYM_CVTE_SCA > 0
440 memcpy (&entry
->entry
.address
.lastruct
.la
, buf
+ 10,
443 entry
->entry
.address
.lastruct
.la_kind
= buf
[23];
445 else if (entry
->entry
.la_size
== BFD_SYM_CVTE_BIG_LA
)
447 entry
->entry
.address
.biglastruct
.big_la
= bfd_getb32 (buf
+ 10);
448 entry
->entry
.address
.biglastruct
.big_la_kind
= buf
[12];
454 bfd_sym_parse_contained_statements_table_entry_v32 (unsigned char *buf
,
456 bfd_sym_contained_statements_table_entry
*entry
)
460 BFD_ASSERT (len
== 8);
462 memset (entry
, 0, sizeof (bfd_sym_contained_statements_table_entry
));
463 type
= bfd_getb16 (buf
);
467 case BFD_SYM_END_OF_LIST_3_2
:
468 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
471 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
472 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
473 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
477 entry
->entry
.mte_index
= type
;
478 entry
->entry
.mte_offset
= bfd_getb16 (buf
+ 2);
479 entry
->entry
.file_delta
= bfd_getb32 (buf
+ 4);
485 bfd_sym_parse_contained_labels_table_entry_v32 (unsigned char *buf
,
487 bfd_sym_contained_labels_table_entry
*entry
)
491 BFD_ASSERT (len
== 12);
493 memset (entry
, 0, sizeof (bfd_sym_contained_labels_table_entry
));
494 type
= bfd_getb16 (buf
);
498 case BFD_SYM_END_OF_LIST_3_2
:
499 entry
->generic
.type
= BFD_SYM_END_OF_LIST
;
502 case BFD_SYM_SOURCE_FILE_CHANGE_3_2
:
503 entry
->file
.type
= BFD_SYM_SOURCE_FILE_CHANGE
;
504 bfd_sym_parse_file_reference_v32 (buf
+ 2, 6, &entry
->file
.fref
);
508 entry
->entry
.mte_index
= type
;
509 entry
->entry
.mte_offset
= bfd_getb16 (buf
+ 2);
510 entry
->entry
.nte_index
= bfd_getb32 (buf
+ 4);
511 entry
->entry
.file_delta
= bfd_getb16 (buf
+ 8);
512 entry
->entry
.scope
= bfd_getb16 (buf
+ 10);
518 bfd_sym_parse_type_table_entry_v32 (unsigned char *buf
,
520 bfd_sym_type_table_entry
*entry
)
522 BFD_ASSERT (len
== 4);
524 *entry
= bfd_getb32 (buf
);
528 bfd_sym_fetch_resources_table_entry (bfd
*abfd
,
529 bfd_sym_resources_table_entry
*entry
,
532 void (*parser
) (unsigned char *, size_t, bfd_sym_resources_table_entry
*);
533 unsigned long offset
;
534 unsigned long entry_size
;
535 unsigned char buf
[18];
536 bfd_sym_data_struct
*sdata
= NULL
;
539 BFD_ASSERT (bfd_sym_valid (abfd
));
540 sdata
= abfd
->tdata
.sym_data
;
545 switch (sdata
->version
)
547 case BFD_SYM_VERSION_3_5
:
548 case BFD_SYM_VERSION_3_4
:
551 case BFD_SYM_VERSION_3_3
:
552 case BFD_SYM_VERSION_3_2
:
554 parser
= bfd_sym_parse_resources_table_entry_v32
;
557 case BFD_SYM_VERSION_3_1
:
564 offset
= compute_offset (sdata
->header
.dshb_rte
.dti_first_page
,
565 sdata
->header
.dshb_page_size
,
568 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
570 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
573 (*parser
) (buf
, entry_size
, entry
);
579 bfd_sym_fetch_modules_table_entry (bfd
*abfd
,
580 bfd_sym_modules_table_entry
*entry
,
583 void (*parser
) (unsigned char *, size_t, bfd_sym_modules_table_entry
*);
584 unsigned long offset
;
585 unsigned long entry_size
;
586 unsigned char buf
[46];
587 bfd_sym_data_struct
*sdata
= NULL
;
590 BFD_ASSERT (bfd_sym_valid (abfd
));
591 sdata
= abfd
->tdata
.sym_data
;
596 switch (sdata
->version
)
598 case BFD_SYM_VERSION_3_5
:
599 case BFD_SYM_VERSION_3_4
:
602 case BFD_SYM_VERSION_3_3
:
604 parser
= bfd_sym_parse_modules_table_entry_v33
;
607 case BFD_SYM_VERSION_3_2
:
608 case BFD_SYM_VERSION_3_1
:
615 offset
= compute_offset (sdata
->header
.dshb_mte
.dti_first_page
,
616 sdata
->header
.dshb_page_size
,
619 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
621 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
624 (*parser
) (buf
, entry_size
, entry
);
630 bfd_sym_fetch_file_references_table_entry (bfd
*abfd
,
631 bfd_sym_file_references_table_entry
*entry
,
634 void (*parser
) (unsigned char *, size_t, bfd_sym_file_references_table_entry
*);
635 unsigned long offset
;
636 unsigned long entry_size
= 0;
637 unsigned char buf
[8];
638 bfd_sym_data_struct
*sdata
= NULL
;
641 BFD_ASSERT (bfd_sym_valid (abfd
));
642 sdata
= abfd
->tdata
.sym_data
;
647 switch (sdata
->version
)
649 case BFD_SYM_VERSION_3_3
:
650 case BFD_SYM_VERSION_3_2
:
652 parser
= bfd_sym_parse_file_references_table_entry_v32
;
655 case BFD_SYM_VERSION_3_5
:
656 case BFD_SYM_VERSION_3_4
:
657 case BFD_SYM_VERSION_3_1
:
665 offset
= compute_offset (sdata
->header
.dshb_frte
.dti_first_page
,
666 sdata
->header
.dshb_page_size
,
669 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
671 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
674 (*parser
) (buf
, entry_size
, entry
);
680 bfd_sym_fetch_contained_modules_table_entry (bfd
*abfd
,
681 bfd_sym_contained_modules_table_entry
*entry
,
684 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_modules_table_entry
*);
685 unsigned long offset
;
686 unsigned long entry_size
= 0;
687 unsigned char buf
[6];
688 bfd_sym_data_struct
*sdata
= NULL
;
691 BFD_ASSERT (bfd_sym_valid (abfd
));
692 sdata
= abfd
->tdata
.sym_data
;
697 switch (sdata
->version
)
699 case BFD_SYM_VERSION_3_3
:
700 case BFD_SYM_VERSION_3_2
:
702 parser
= bfd_sym_parse_contained_modules_table_entry_v32
;
705 case BFD_SYM_VERSION_3_5
:
706 case BFD_SYM_VERSION_3_4
:
707 case BFD_SYM_VERSION_3_1
:
715 offset
= compute_offset (sdata
->header
.dshb_cmte
.dti_first_page
,
716 sdata
->header
.dshb_page_size
,
719 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
721 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
724 (*parser
) (buf
, entry_size
, entry
);
730 bfd_sym_fetch_contained_variables_table_entry (bfd
*abfd
,
731 bfd_sym_contained_variables_table_entry
*entry
,
734 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_variables_table_entry
*);
735 unsigned long offset
;
736 unsigned long entry_size
= 0;
737 unsigned char buf
[26];
738 bfd_sym_data_struct
*sdata
= NULL
;
741 BFD_ASSERT (bfd_sym_valid (abfd
));
742 sdata
= abfd
->tdata
.sym_data
;
747 switch (sdata
->version
)
749 case BFD_SYM_VERSION_3_3
:
750 case BFD_SYM_VERSION_3_2
:
752 parser
= bfd_sym_parse_contained_variables_table_entry_v32
;
755 case BFD_SYM_VERSION_3_5
:
756 case BFD_SYM_VERSION_3_4
:
757 case BFD_SYM_VERSION_3_1
:
765 offset
= compute_offset (sdata
->header
.dshb_cvte
.dti_first_page
,
766 sdata
->header
.dshb_page_size
,
769 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
771 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
774 (*parser
) (buf
, entry_size
, entry
);
780 bfd_sym_fetch_contained_statements_table_entry (bfd
*abfd
,
781 bfd_sym_contained_statements_table_entry
*entry
,
784 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_statements_table_entry
*);
785 unsigned long offset
;
786 unsigned long entry_size
= 0;
787 unsigned char buf
[8];
788 bfd_sym_data_struct
*sdata
= NULL
;
791 BFD_ASSERT (bfd_sym_valid (abfd
));
792 sdata
= abfd
->tdata
.sym_data
;
797 switch (sdata
->version
)
799 case BFD_SYM_VERSION_3_3
:
800 case BFD_SYM_VERSION_3_2
:
802 parser
= bfd_sym_parse_contained_statements_table_entry_v32
;
805 case BFD_SYM_VERSION_3_5
:
806 case BFD_SYM_VERSION_3_4
:
807 case BFD_SYM_VERSION_3_1
:
815 offset
= compute_offset (sdata
->header
.dshb_csnte
.dti_first_page
,
816 sdata
->header
.dshb_page_size
,
819 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
821 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
824 (*parser
) (buf
, entry_size
, entry
);
830 bfd_sym_fetch_contained_labels_table_entry (bfd
*abfd
,
831 bfd_sym_contained_labels_table_entry
*entry
,
834 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_labels_table_entry
*);
835 unsigned long offset
;
836 unsigned long entry_size
= 0;
837 unsigned char buf
[12];
838 bfd_sym_data_struct
*sdata
= NULL
;
841 BFD_ASSERT (bfd_sym_valid (abfd
));
842 sdata
= abfd
->tdata
.sym_data
;
847 switch (sdata
->version
)
849 case BFD_SYM_VERSION_3_3
:
850 case BFD_SYM_VERSION_3_2
:
852 parser
= bfd_sym_parse_contained_labels_table_entry_v32
;
855 case BFD_SYM_VERSION_3_5
:
856 case BFD_SYM_VERSION_3_4
:
857 case BFD_SYM_VERSION_3_1
:
865 offset
= compute_offset (sdata
->header
.dshb_clte
.dti_first_page
,
866 sdata
->header
.dshb_page_size
,
869 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
871 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
874 (*parser
) (buf
, entry_size
, entry
);
880 bfd_sym_fetch_contained_types_table_entry (bfd
*abfd
,
881 bfd_sym_contained_types_table_entry
*entry
,
884 void (*parser
) (unsigned char *, size_t, bfd_sym_contained_types_table_entry
*);
885 unsigned long offset
;
886 unsigned long entry_size
= 0;
887 unsigned char buf
[0];
888 bfd_sym_data_struct
*sdata
= NULL
;
891 BFD_ASSERT (bfd_sym_valid (abfd
));
892 sdata
= abfd
->tdata
.sym_data
;
897 switch (sdata
->version
)
899 case BFD_SYM_VERSION_3_3
:
900 case BFD_SYM_VERSION_3_2
:
905 case BFD_SYM_VERSION_3_5
:
906 case BFD_SYM_VERSION_3_4
:
907 case BFD_SYM_VERSION_3_1
:
915 offset
= compute_offset (sdata
->header
.dshb_ctte
.dti_first_page
,
916 sdata
->header
.dshb_page_size
,
919 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
921 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
924 (*parser
) (buf
, entry_size
, entry
);
930 bfd_sym_fetch_file_references_index_table_entry (bfd
*abfd
,
931 bfd_sym_file_references_index_table_entry
*entry
,
934 void (*parser
) (unsigned char *, size_t, bfd_sym_file_references_index_table_entry
*);
935 unsigned long offset
;
936 unsigned long entry_size
= 0;
937 unsigned char buf
[0];
938 bfd_sym_data_struct
*sdata
= NULL
;
941 BFD_ASSERT (bfd_sym_valid (abfd
));
942 sdata
= abfd
->tdata
.sym_data
;
947 switch (sdata
->version
)
949 case BFD_SYM_VERSION_3_3
:
950 case BFD_SYM_VERSION_3_2
:
955 case BFD_SYM_VERSION_3_5
:
956 case BFD_SYM_VERSION_3_4
:
957 case BFD_SYM_VERSION_3_1
:
965 offset
= compute_offset (sdata
->header
.dshb_fite
.dti_first_page
,
966 sdata
->header
.dshb_page_size
,
969 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
971 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
974 (*parser
) (buf
, entry_size
, entry
);
980 bfd_sym_fetch_constant_pool_entry (bfd
*abfd
,
981 bfd_sym_constant_pool_entry
*entry
,
984 void (*parser
) (unsigned char *, size_t, bfd_sym_constant_pool_entry
*);
985 unsigned long offset
;
986 unsigned long entry_size
= 0;
987 unsigned char buf
[0];
988 bfd_sym_data_struct
*sdata
= NULL
;
991 BFD_ASSERT (bfd_sym_valid (abfd
));
992 sdata
= abfd
->tdata
.sym_data
;
997 switch (sdata
->version
)
999 case BFD_SYM_VERSION_3_3
:
1000 case BFD_SYM_VERSION_3_2
:
1005 case BFD_SYM_VERSION_3_5
:
1006 case BFD_SYM_VERSION_3_4
:
1007 case BFD_SYM_VERSION_3_1
:
1015 offset
= compute_offset (sdata
->header
.dshb_fite
.dti_first_page
,
1016 sdata
->header
.dshb_page_size
,
1019 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1021 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1024 (*parser
) (buf
, entry_size
, entry
);
1030 bfd_sym_fetch_type_table_entry (bfd
*abfd
,
1031 bfd_sym_type_table_entry
*entry
,
1032 unsigned long index
)
1034 void (*parser
) (unsigned char *, size_t, bfd_sym_type_table_entry
*);
1035 unsigned long offset
;
1036 unsigned long entry_size
= 0;
1037 unsigned char buf
[4];
1038 bfd_sym_data_struct
*sdata
= NULL
;
1041 BFD_ASSERT (bfd_sym_valid (abfd
));
1042 sdata
= abfd
->tdata
.sym_data
;
1044 switch (sdata
->version
)
1046 case BFD_SYM_VERSION_3_3
:
1047 case BFD_SYM_VERSION_3_2
:
1049 parser
= bfd_sym_parse_type_table_entry_v32
;
1052 case BFD_SYM_VERSION_3_5
:
1053 case BFD_SYM_VERSION_3_4
:
1054 case BFD_SYM_VERSION_3_1
:
1062 offset
= compute_offset (sdata
->header
.dshb_tte
.dti_first_page
,
1063 sdata
->header
.dshb_page_size
,
1066 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1068 if (bfd_bread (buf
, entry_size
, abfd
) != entry_size
)
1071 (*parser
) (buf
, entry_size
, entry
);
1077 bfd_sym_fetch_type_information_table_entry (bfd
*abfd
,
1078 bfd_sym_type_information_table_entry
*entry
,
1079 unsigned long offset
)
1081 unsigned char buf
[4];
1082 bfd_sym_data_struct
*sdata
= NULL
;
1084 BFD_ASSERT (bfd_sym_valid (abfd
));
1085 sdata
= abfd
->tdata
.sym_data
;
1090 if (bfd_seek (abfd
, offset
, SEEK_SET
) < 0)
1093 if (bfd_bread (buf
, 4, abfd
) != 4)
1095 entry
->nte_index
= bfd_getb32 (buf
);
1097 if (bfd_bread (buf
, 2, abfd
) != 2)
1099 entry
->physical_size
= bfd_getb16 (buf
);
1101 if (entry
->physical_size
& 0x8000)
1103 if (bfd_bread (buf
, 4, abfd
) != 4)
1105 entry
->physical_size
&= 0x7fff;
1106 entry
->logical_size
= bfd_getb32 (buf
);
1107 entry
->offset
= offset
+ 10;
1111 if (bfd_bread (buf
, 2, abfd
) != 2)
1113 entry
->physical_size
&= 0x7fff;
1114 entry
->logical_size
= bfd_getb16 (buf
);
1115 entry
->offset
= offset
+ 8;
1122 bfd_sym_fetch_type_table_information (bfd
*abfd
,
1123 bfd_sym_type_information_table_entry
*entry
,
1124 unsigned long index
)
1126 bfd_sym_type_table_entry tindex
;
1127 bfd_sym_data_struct
*sdata
= NULL
;
1129 BFD_ASSERT (bfd_sym_valid (abfd
));
1130 sdata
= abfd
->tdata
.sym_data
;
1132 if (sdata
->header
.dshb_tte
.dti_object_count
<= 99)
1137 if (bfd_sym_fetch_type_table_entry (abfd
, &tindex
, index
- 100) < 0)
1139 if (bfd_sym_fetch_type_information_table_entry (abfd
, entry
, tindex
) < 0)
1145 const unsigned char *
1146 bfd_sym_symbol_name (bfd
*abfd
, unsigned long index
)
1148 bfd_sym_data_struct
*sdata
= NULL
;
1150 BFD_ASSERT (bfd_sym_valid (abfd
));
1151 sdata
= abfd
->tdata
.sym_data
;
1154 return (const unsigned char *) "";
1157 if ((index
/ sdata
->header
.dshb_page_size
)
1158 > sdata
->header
.dshb_nte
.dti_page_count
)
1159 return (const unsigned char *) "\09[INVALID]";
1161 return (const unsigned char *) sdata
->name_table
+ index
;
1164 const unsigned char *
1165 bfd_sym_module_name (bfd
*abfd
, unsigned long index
)
1167 bfd_sym_modules_table_entry entry
;
1169 if (bfd_sym_fetch_modules_table_entry (abfd
, &entry
, index
) < 0)
1170 return (const unsigned char *) "\09[INVALID]";
1172 return bfd_sym_symbol_name (abfd
, entry
.mte_nte_index
);
1176 bfd_sym_unparse_storage_kind (enum bfd_sym_storage_kind kind
)
1180 case BFD_SYM_STORAGE_KIND_LOCAL
: return "LOCAL";
1181 case BFD_SYM_STORAGE_KIND_VALUE
: return "VALUE";
1182 case BFD_SYM_STORAGE_KIND_REFERENCE
: return "REFERENCE";
1183 case BFD_SYM_STORAGE_KIND_WITH
: return "WITH";
1184 default: return "[UNKNOWN]";
1189 bfd_sym_unparse_storage_class (enum bfd_sym_storage_class kind
)
1193 case BFD_SYM_STORAGE_CLASS_REGISTER
: return "REGISTER";
1194 case BFD_SYM_STORAGE_CLASS_GLOBAL
: return "GLOBAL";
1195 case BFD_SYM_STORAGE_CLASS_FRAME_RELATIVE
: return "FRAME_RELATIVE";
1196 case BFD_SYM_STORAGE_CLASS_STACK_RELATIVE
: return "STACK_RELATIVE";
1197 case BFD_SYM_STORAGE_CLASS_ABSOLUTE
: return "ABSOLUTE";
1198 case BFD_SYM_STORAGE_CLASS_CONSTANT
: return "CONSTANT";
1199 case BFD_SYM_STORAGE_CLASS_RESOURCE
: return "RESOURCE";
1200 case BFD_SYM_STORAGE_CLASS_BIGCONSTANT
: return "BIGCONSTANT";
1201 default: return "[UNKNOWN]";
1206 bfd_sym_unparse_module_kind (enum bfd_sym_module_kind kind
)
1210 case BFD_SYM_MODULE_KIND_NONE
: return "NONE";
1211 case BFD_SYM_MODULE_KIND_PROGRAM
: return "PROGRAM";
1212 case BFD_SYM_MODULE_KIND_UNIT
: return "UNIT";
1213 case BFD_SYM_MODULE_KIND_PROCEDURE
: return "PROCEDURE";
1214 case BFD_SYM_MODULE_KIND_FUNCTION
: return "FUNCTION";
1215 case BFD_SYM_MODULE_KIND_DATA
: return "DATA";
1216 case BFD_SYM_MODULE_KIND_BLOCK
: return "BLOCK";
1217 default: return "[UNKNOWN]";
1222 bfd_sym_unparse_symbol_scope (enum bfd_sym_symbol_scope scope
)
1226 case BFD_SYM_SYMBOL_SCOPE_LOCAL
: return "LOCAL";
1227 case BFD_SYM_SYMBOL_SCOPE_GLOBAL
: return "GLOBAL";
1234 bfd_sym_print_file_reference (bfd
*abfd
,
1236 bfd_sym_file_reference
*entry
)
1238 bfd_sym_file_references_table_entry frtentry
;
1241 ret
= bfd_sym_fetch_file_references_table_entry (abfd
, &frtentry
,
1242 entry
->fref_frte_index
);
1243 fprintf (f
, "FILE ");
1245 if ((ret
< 0) || (frtentry
.generic
.type
!= BFD_SYM_FILE_NAME_INDEX
))
1246 fprintf (f
, "[INVALID]");
1248 fprintf (f
, "\"%.*s\"",
1249 bfd_sym_symbol_name (abfd
, frtentry
.filename
.nte_index
)[0],
1250 &bfd_sym_symbol_name (abfd
, frtentry
.filename
.nte_index
)[1]);
1252 fprintf (f
, " (FRTE %lu)", entry
->fref_frte_index
);
1256 bfd_sym_print_resources_table_entry (bfd
*abfd
,
1258 bfd_sym_resources_table_entry
*entry
)
1260 fprintf (f
, " \"%.*s\" (NTE %lu), type \"%.4s\", num %u, size %lu, MTE %lu -- %lu",
1261 bfd_sym_symbol_name (abfd
, entry
->rte_nte_index
)[0],
1262 &bfd_sym_symbol_name (abfd
, entry
->rte_nte_index
)[1],
1263 entry
->rte_nte_index
, entry
->rte_res_type
, entry
->rte_res_number
,
1264 entry
->rte_res_size
, entry
->rte_mte_first
, entry
->rte_mte_last
);
1268 bfd_sym_print_modules_table_entry (bfd
*abfd
,
1270 bfd_sym_modules_table_entry
*entry
)
1272 fprintf (f
, "\"%.*s\" (NTE %lu)",
1273 bfd_sym_symbol_name (abfd
, entry
->mte_nte_index
)[0],
1274 &bfd_sym_symbol_name (abfd
, entry
->mte_nte_index
)[1],
1275 entry
->mte_nte_index
);
1279 bfd_sym_print_file_reference (abfd
, f
, &entry
->mte_imp_fref
);
1280 fprintf (f
, " range %lu -- %lu",
1281 entry
->mte_imp_fref
.fref_offset
, entry
->mte_imp_end
);
1285 fprintf (f
, "kind %s", bfd_sym_unparse_module_kind (entry
->mte_kind
));
1286 fprintf (f
, ", scope %s", bfd_sym_unparse_symbol_scope (entry
->mte_scope
));
1288 fprintf (f
, ", RTE %lu, offset %lu, size %lu",
1289 entry
->mte_rte_index
, entry
->mte_res_offset
, entry
->mte_size
);
1293 fprintf (f
, "CMTE %lu, CVTE %lu, CLTE %lu, CTTE %lu, CSNTE1 %lu, CSNTE2 %lu",
1294 entry
->mte_cmte_index
, entry
->mte_cvte_index
,
1295 entry
->mte_clte_index
, entry
->mte_ctte_index
,
1296 entry
->mte_csnte_idx_1
, entry
->mte_csnte_idx_2
);
1298 if (entry
->mte_parent
!= 0)
1299 fprintf (f
, ", parent %lu", entry
->mte_parent
);
1301 fprintf (f
, ", no parent");
1303 if (entry
->mte_cmte_index
!= 0)
1304 fprintf (f
, ", child %lu", entry
->mte_cmte_index
);
1306 fprintf (f
, ", no child");
1310 bfd_sym_print_file_references_table_entry (bfd
*abfd
,
1312 bfd_sym_file_references_table_entry
*entry
)
1314 switch (entry
->generic
.type
)
1316 case BFD_SYM_FILE_NAME_INDEX
:
1317 fprintf (f
, "FILE \"%.*s\" (NTE %lu), modtime ",
1318 bfd_sym_symbol_name (abfd
, entry
->filename
.nte_index
)[0],
1319 &bfd_sym_symbol_name (abfd
, entry
->filename
.nte_index
)[1],
1320 entry
->filename
.nte_index
);
1322 fprintf (f
, "[UNIMPLEMENTED]");
1323 /* printModDate (entry->filename.mod_date); */
1324 fprintf (f
, " (0x%lx)", entry
->filename
.mod_date
);
1327 case BFD_SYM_END_OF_LIST
:
1332 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu",
1333 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1334 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1335 entry
->entry
.mte_index
,
1336 entry
->entry
.file_offset
);
1342 bfd_sym_print_contained_modules_table_entry (bfd
*abfd
,
1344 bfd_sym_contained_modules_table_entry
*entry
)
1346 switch (entry
->generic
.type
)
1348 case BFD_SYM_END_OF_LIST
:
1353 fprintf (f
, "\"%.*s\" (MTE %lu, NTE %lu)",
1354 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1355 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1356 entry
->entry
.mte_index
,
1357 entry
->entry
.nte_index
);
1363 bfd_sym_print_contained_variables_table_entry (bfd
*abfd
,
1365 bfd_sym_contained_variables_table_entry
*entry
)
1367 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1373 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1375 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1376 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1380 fprintf (f
, "\"%.*s\" (NTE %lu)",
1381 bfd_sym_symbol_name (abfd
, entry
->entry
.nte_index
)[0],
1382 &bfd_sym_symbol_name (abfd
, entry
->entry
.nte_index
)[1],
1383 entry
->entry
.nte_index
);
1385 fprintf (f
, ", TTE %lu", entry
->entry
.tte_index
);
1386 fprintf (f
, ", offset %lu", entry
->entry
.file_delta
);
1387 fprintf (f
, ", scope %s", bfd_sym_unparse_symbol_scope (entry
->entry
.scope
));
1389 if (entry
->entry
.la_size
== BFD_SYM_CVTE_SCA
)
1390 fprintf (f
, ", latype %s, laclass %s, laoffset %lu",
1391 bfd_sym_unparse_storage_kind (entry
->entry
.address
.scstruct
.sca_kind
),
1392 bfd_sym_unparse_storage_class (entry
->entry
.address
.scstruct
.sca_class
),
1393 entry
->entry
.address
.scstruct
.sca_offset
);
1394 else if (entry
->entry
.la_size
<= BFD_SYM_CVTE_LA_MAX_SIZE
)
1398 fprintf (f
, ", la [");
1399 for (i
= 0; i
< entry
->entry
.la_size
; i
++)
1400 fprintf (f
, "0x%02x ", entry
->entry
.address
.lastruct
.la
[i
]);
1403 else if (entry
->entry
.la_size
== BFD_SYM_CVTE_BIG_LA
)
1404 fprintf (f
, ", bigla %lu, biglakind %u",
1405 entry
->entry
.address
.biglastruct
.big_la
,
1406 entry
->entry
.address
.biglastruct
.big_la_kind
);
1409 fprintf (f
, ", la [INVALID]");
1413 bfd_sym_print_contained_statements_table_entry (bfd
*abfd
,
1415 bfd_sym_contained_statements_table_entry
*entry
)
1417 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1423 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1425 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1426 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1430 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu, delta %lu",
1431 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1432 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1433 entry
->entry
.mte_index
,
1434 entry
->entry
.mte_offset
,
1435 entry
->entry
.file_delta
);
1439 bfd_sym_print_contained_labels_table_entry (bfd
*abfd
,
1441 bfd_sym_contained_labels_table_entry
*entry
)
1443 if (entry
->generic
.type
== BFD_SYM_END_OF_LIST
)
1449 if (entry
->generic
.type
== BFD_SYM_SOURCE_FILE_CHANGE
)
1451 bfd_sym_print_file_reference (abfd
, f
, &entry
->file
.fref
);
1452 fprintf (f
, " offset %lu", entry
->file
.fref
.fref_offset
);
1456 fprintf (f
, "\"%.*s\" (MTE %lu), offset %lu, delta %lu, scope %s",
1457 bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[0],
1458 &bfd_sym_module_name (abfd
, entry
->entry
.mte_index
)[1],
1459 entry
->entry
.mte_index
,
1460 entry
->entry
.mte_offset
,
1461 entry
->entry
.file_delta
,
1462 bfd_sym_unparse_symbol_scope (entry
->entry
.scope
));
1466 bfd_sym_print_contained_types_table_entry (bfd
*abfd ATTRIBUTE_UNUSED
,
1468 bfd_sym_contained_types_table_entry
*entry ATTRIBUTE_UNUSED
)
1470 fprintf (f
, "[UNIMPLEMENTED]");
1474 bfd_sym_type_operator_name (unsigned char num
)
1478 case 1: return "TTE";
1479 case 2: return "PointerTo";
1480 case 3: return "ScalarOf";
1481 case 4: return "ConstantOf";
1482 case 5: return "EnumerationOf";
1483 case 6: return "VectorOf";
1484 case 7: return "RecordOf";
1485 case 8: return "UnionOf";
1486 case 9: return "SubRangeOf";
1487 case 10: return "SetOf";
1488 case 11: return "NamedTypeOf";
1489 case 12: return "ProcOf";
1490 case 13: return "ValueOf";
1491 case 14: return "ArrayOf";
1492 default: return "[UNKNOWN OPERATOR]";
1497 bfd_sym_type_basic_name (unsigned char num
)
1501 case 0: return "void";
1502 case 1: return "pascal string";
1503 case 2: return "unsigned long";
1504 case 3: return "signed long";
1505 case 4: return "extended (10 bytes)";
1506 case 5: return "pascal boolean (1 byte)";
1507 case 6: return "unsigned byte";
1508 case 7: return "signed byte";
1509 case 8: return "character (1 byte)";
1510 case 9: return "wide character (2 bytes)";
1511 case 10: return "unsigned short";
1512 case 11: return "signed short";
1513 case 12: return "singled";
1514 case 13: return "double";
1515 case 14: return "extended (12 bytes)";
1516 case 15: return "computational (8 bytes)";
1517 case 16: return "c string";
1518 case 17: return "as-is string";
1519 default: return "[UNKNOWN BASIC TYPE]";
1524 bfd_sym_fetch_long (unsigned char *buf
,
1526 unsigned long offset
,
1527 unsigned long *offsetptr
,
1538 else if (! (buf
[offset
] & 0x80))
1540 *value
= buf
[offset
];
1544 else if (buf
[offset
] == 0xc0)
1546 if ((offset
+ 5) > len
)
1554 *value
= bfd_getb32 (buf
+ offset
+ 1);
1559 else if ((buf
[offset
] & 0xc0) == 0xc0)
1561 *value
= -(buf
[offset
] & 0x3f);
1565 else if ((buf
[offset
] & 0xc0) == 0x80)
1567 if ((offset
+ 2) > len
)
1575 *value
= bfd_getb16 (buf
+ offset
) & 0x3fff;
1583 if (offsetptr
!= NULL
)
1584 *offsetptr
= offset
;
1590 bfd_sym_print_type_information (bfd
*abfd
,
1594 unsigned long offset
,
1595 unsigned long *offsetptr
)
1601 fprintf (f
, "[NULL]");
1603 if (offsetptr
!= NULL
)
1604 *offsetptr
= offset
;
1611 if (! (type
& 0x80))
1613 fprintf (f
, "[%s] (0x%x)", bfd_sym_type_basic_name (type
& 0x7f), type
);
1615 if (offsetptr
!= NULL
)
1616 *offsetptr
= offset
;
1621 fprintf (f
, "[packed ");
1625 switch (type
& 0x3f)
1630 bfd_sym_type_information_table_entry tinfo
;
1632 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1634 fprintf (f
, "[INVALID]");
1637 if (bfd_sym_fetch_type_table_information (abfd
, &tinfo
, value
) < 0)
1638 fprintf (f
, "[INVALID]");
1640 fprintf (f
, "\"%.*s\"",
1641 bfd_sym_symbol_name (abfd
, tinfo
.nte_index
)[0],
1642 &bfd_sym_symbol_name (abfd
, tinfo
.nte_index
)[1]);
1644 fprintf (f
, " (TTE %lu)", value
);
1649 fprintf (f
, "pointer (0x%x) to ", type
);
1650 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1657 fprintf (f
, "scalar (0x%x) of ", type
);
1658 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1659 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1660 fprintf (f
, " (%lu)", (unsigned long) value
);
1666 long lower
, upper
, nelem
;
1669 fprintf (f
, "enumeration (0x%x) of ", type
);
1670 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1671 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &lower
);
1672 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &upper
);
1673 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &nelem
);
1674 fprintf (f
, " from %lu to %lu with %lu elements: ",
1675 (unsigned long) lower
, (unsigned long) upper
,
1676 (unsigned long) nelem
);
1678 for (i
= 0; i
< nelem
; i
++)
1681 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1687 fprintf (f
, "vector (0x%x)", type
);
1688 fprintf (f
, "\n index ");
1689 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1690 fprintf (f
, "\n target ");
1691 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1697 long nrec
, eloff
, i
;
1699 if ((type
& 0x3f) == 7)
1700 fprintf (f
, "record (0x%x) of ", type
);
1702 fprintf (f
, "union (0x%x) of ", type
);
1704 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &nrec
);
1705 fprintf (f
, "%lu elements: ", nrec
);
1707 for (i
= 0; i
< nrec
; i
++)
1709 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &eloff
);
1711 fprintf (f
, "offset %lu: ", eloff
);
1712 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1718 fprintf (f
, "subrange (0x%x) of ", type
);
1719 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1720 fprintf (f
, " lower ");
1721 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1722 fprintf (f
, " upper ");
1723 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1730 fprintf (f
, "named type (0x%x) ", type
);
1731 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &value
);
1733 fprintf (f
, "[INVALID]");
1735 fprintf (f
, "\"%.*s\"",
1736 bfd_sym_symbol_name (abfd
, value
)[0],
1737 &bfd_sym_symbol_name (abfd
, value
)[1]);
1739 fprintf (f
, " (NTE %lu) with type ", value
);
1740 bfd_sym_print_type_information (abfd
, f
, buf
, len
, offset
, &offset
);
1745 fprintf (f
, "%s (0x%x)", bfd_sym_type_operator_name (type
), type
);
1749 if (type
== (0x40 | 0x6))
1756 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &n
);
1757 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &width
);
1758 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &m
);
1759 /* fprintf (f, "\n "); */
1760 fprintf (f
, " N %ld, width %ld, M %ld, ", n
, width
, m
);
1761 for (i
= 0; i
< m
; i
++)
1763 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &l
);
1766 fprintf (f
, "%ld", l
);
1769 else if (type
& 0x40)
1771 /* Other packed type. */
1774 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &msb
);
1775 bfd_sym_fetch_long (buf
, len
, offset
, &offset
, &lsb
);
1776 /* fprintf (f, "\n "); */
1777 fprintf (f
, " msb %ld, lsb %ld", msb
, lsb
);
1782 if (offsetptr
!= NULL
)
1783 *offsetptr
= offset
;
1787 bfd_sym_print_type_information_table_entry (bfd
*abfd
,
1789 bfd_sym_type_information_table_entry
*entry
)
1792 unsigned long offset
;
1795 fprintf (f
, "\"%.*s\" (NTE %lu), %lu bytes at %lu, logical size %lu",
1796 bfd_sym_symbol_name (abfd
, entry
->nte_index
)[0],
1797 &bfd_sym_symbol_name (abfd
, entry
->nte_index
)[1],
1799 entry
->physical_size
, entry
->offset
, entry
->logical_size
);
1803 buf
= alloca (entry
->physical_size
);
1806 fprintf (f
, "[ERROR]\n");
1809 if (bfd_seek (abfd
, entry
->offset
, SEEK_SET
) < 0)
1811 fprintf (f
, "[ERROR]\n");
1814 if (bfd_bread (buf
, entry
->physical_size
, abfd
) != entry
->physical_size
)
1816 fprintf (f
, "[ERROR]\n");
1821 for (i
= 0; i
< entry
->physical_size
; i
++)
1824 fprintf (f
, "0x%02x", buf
[i
]);
1826 fprintf (f
, " 0x%02x", buf
[i
]);
1832 bfd_sym_print_type_information (abfd
, f
, buf
, entry
->physical_size
, 0, &offset
);
1834 if (offset
!= entry
->physical_size
)
1835 fprintf (f
, "\n [parser used %lu bytes instead of %lu]", offset
, entry
->physical_size
);
1839 bfd_sym_print_file_references_index_table_entry (bfd
*abfd ATTRIBUTE_UNUSED
,
1841 bfd_sym_file_references_index_table_entry
*entry ATTRIBUTE_UNUSED
)
1843 fprintf (f
, "[UNIMPLEMENTED]");
1847 bfd_sym_print_constant_pool_entry (bfd
*abfd ATTRIBUTE_UNUSED
,
1849 bfd_sym_constant_pool_entry
*entry ATTRIBUTE_UNUSED
)
1851 fprintf (f
, "[UNIMPLEMENTED]");
1855 bfd_sym_display_name_table_entry (bfd
*abfd
,
1857 unsigned char *entry
)
1859 unsigned long index
;
1860 unsigned long offset
;
1861 bfd_sym_data_struct
*sdata
= NULL
;
1863 BFD_ASSERT (bfd_sym_valid (abfd
));
1864 sdata
= abfd
->tdata
.sym_data
;
1865 index
= (entry
- sdata
->name_table
) / 2;
1867 if (sdata
->version
>= BFD_SYM_VERSION_3_4
&& entry
[0] == 255 && entry
[1] == 0)
1869 unsigned short length
= bfd_getb16 (entry
+ 2);
1870 fprintf (f
, "[%8lu] \"%.*s\"\n", index
, length
, entry
+ 4);
1871 offset
= 2 + length
+ 1;
1875 if (! (entry
[0] == 0 || (entry
[0] == 1 && entry
[1] == '\0')))
1876 fprintf (f
, "[%8lu] \"%.*s\"\n", index
, entry
[0], entry
+ 1);
1878 if (sdata
->version
>= BFD_SYM_VERSION_3_4
)
1879 offset
= entry
[0] + 2;
1881 offset
= entry
[0] + 1;
1884 return (entry
+ offset
+ (offset
% 2));
1888 bfd_sym_display_name_table (bfd
*abfd
, FILE *f
)
1890 unsigned long name_table_len
;
1891 unsigned char *name_table
, *name_table_end
, *cur
;
1892 bfd_sym_data_struct
*sdata
= NULL
;
1894 BFD_ASSERT (bfd_sym_valid (abfd
));
1895 sdata
= abfd
->tdata
.sym_data
;
1897 name_table_len
= sdata
->header
.dshb_nte
.dti_page_count
* sdata
->header
.dshb_page_size
;
1898 name_table
= sdata
->name_table
;
1899 name_table_end
= name_table
+ name_table_len
;
1901 fprintf (f
, "name table (NTE) contains %lu bytes:\n\n", name_table_len
);
1906 cur
= bfd_sym_display_name_table_entry (abfd
, f
, cur
);
1907 if (cur
>= name_table_end
)
1913 bfd_sym_display_resources_table (bfd
*abfd
, FILE *f
)
1916 bfd_sym_resources_table_entry entry
;
1917 bfd_sym_data_struct
*sdata
= NULL
;
1919 BFD_ASSERT (bfd_sym_valid (abfd
));
1920 sdata
= abfd
->tdata
.sym_data
;
1922 fprintf (f
, "resource table (RTE) contains %lu objects:\n\n",
1923 sdata
->header
.dshb_rte
.dti_object_count
);
1925 for (i
= 1; i
<= sdata
->header
.dshb_rte
.dti_object_count
; i
++)
1927 if (bfd_sym_fetch_resources_table_entry (abfd
, &entry
, i
) < 0)
1928 fprintf (f
, " [%8lu] [INVALID]\n", i
);
1931 fprintf (f
, " [%8lu] ", i
);
1932 bfd_sym_print_resources_table_entry (abfd
, f
, &entry
);
1939 bfd_sym_display_modules_table (bfd
*abfd
, FILE *f
)
1942 bfd_sym_modules_table_entry entry
;
1943 bfd_sym_data_struct
*sdata
= NULL
;
1945 BFD_ASSERT (bfd_sym_valid (abfd
));
1946 sdata
= abfd
->tdata
.sym_data
;
1948 fprintf (f
, "module table (MTE) contains %lu objects:\n\n",
1949 sdata
->header
.dshb_mte
.dti_object_count
);
1951 for (i
= 1; i
<= sdata
->header
.dshb_mte
.dti_object_count
; i
++)
1953 if (bfd_sym_fetch_modules_table_entry (abfd
, &entry
, i
) < 0)
1954 fprintf (f
, " [%8lu] [INVALID]\n", i
);
1957 fprintf (f
, " [%8lu] ", i
);
1958 bfd_sym_print_modules_table_entry (abfd
, f
, &entry
);
1965 bfd_sym_display_file_references_table (bfd
*abfd
, FILE *f
)
1968 bfd_sym_file_references_table_entry entry
;
1969 bfd_sym_data_struct
*sdata
= NULL
;
1971 BFD_ASSERT (bfd_sym_valid (abfd
));
1972 sdata
= abfd
->tdata
.sym_data
;
1974 fprintf (f
, "file reference table (FRTE) contains %lu objects:\n\n",
1975 sdata
->header
.dshb_frte
.dti_object_count
);
1977 for (i
= 1; i
<= sdata
->header
.dshb_frte
.dti_object_count
; i
++)
1979 if (bfd_sym_fetch_file_references_table_entry (abfd
, &entry
, i
) < 0)
1980 fprintf (f
, " [%8lu] [INVALID]\n", i
);
1983 fprintf (f
, " [%8lu] ", i
);
1984 bfd_sym_print_file_references_table_entry (abfd
, f
, &entry
);
1991 bfd_sym_display_contained_modules_table (bfd
*abfd
, FILE *f
)
1994 bfd_sym_contained_modules_table_entry entry
;
1995 bfd_sym_data_struct
*sdata
= NULL
;
1997 BFD_ASSERT (bfd_sym_valid (abfd
));
1998 sdata
= abfd
->tdata
.sym_data
;
2000 fprintf (f
, "contained modules table (CMTE) contains %lu objects:\n\n",
2001 sdata
->header
.dshb_cmte
.dti_object_count
);
2003 for (i
= 1; i
<= sdata
->header
.dshb_cmte
.dti_object_count
; i
++)
2005 if (bfd_sym_fetch_contained_modules_table_entry (abfd
, &entry
, i
) < 0)
2006 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2009 fprintf (f
, " [%8lu] ", i
);
2010 bfd_sym_print_contained_modules_table_entry (abfd
, f
, &entry
);
2017 bfd_sym_display_contained_variables_table (bfd
*abfd
, FILE *f
)
2020 bfd_sym_contained_variables_table_entry entry
;
2021 bfd_sym_data_struct
*sdata
= NULL
;
2023 BFD_ASSERT (bfd_sym_valid (abfd
));
2024 sdata
= abfd
->tdata
.sym_data
;
2026 fprintf (f
, "contained variables table (CVTE) contains %lu objects:\n\n",
2027 sdata
->header
.dshb_cvte
.dti_object_count
);
2029 for (i
= 1; i
<= sdata
->header
.dshb_cvte
.dti_object_count
; i
++)
2031 if (bfd_sym_fetch_contained_variables_table_entry (abfd
, &entry
, i
) < 0)
2032 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2035 fprintf (f
, " [%8lu] ", i
);
2036 bfd_sym_print_contained_variables_table_entry (abfd
, f
, &entry
);
2045 bfd_sym_display_contained_statements_table (bfd
*abfd
, FILE *f
)
2048 bfd_sym_contained_statements_table_entry entry
;
2049 bfd_sym_data_struct
*sdata
= NULL
;
2051 BFD_ASSERT (bfd_sym_valid (abfd
));
2052 sdata
= abfd
->tdata
.sym_data
;
2054 fprintf (f
, "contained statements table (CSNTE) contains %lu objects:\n\n",
2055 sdata
->header
.dshb_csnte
.dti_object_count
);
2057 for (i
= 1; i
<= sdata
->header
.dshb_csnte
.dti_object_count
; i
++)
2059 if (bfd_sym_fetch_contained_statements_table_entry (abfd
, &entry
, i
) < 0)
2060 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2063 fprintf (f
, " [%8lu] ", i
);
2064 bfd_sym_print_contained_statements_table_entry (abfd
, f
, &entry
);
2071 bfd_sym_display_contained_labels_table (bfd
*abfd
, FILE *f
)
2074 bfd_sym_contained_labels_table_entry entry
;
2075 bfd_sym_data_struct
*sdata
= NULL
;
2077 BFD_ASSERT (bfd_sym_valid (abfd
));
2078 sdata
= abfd
->tdata
.sym_data
;
2080 fprintf (f
, "contained labels table (CLTE) contains %lu objects:\n\n",
2081 sdata
->header
.dshb_clte
.dti_object_count
);
2083 for (i
= 1; i
<= sdata
->header
.dshb_clte
.dti_object_count
; i
++)
2085 if (bfd_sym_fetch_contained_labels_table_entry (abfd
, &entry
, i
) < 0)
2086 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2089 fprintf (f
, " [%8lu] ", i
);
2090 bfd_sym_print_contained_labels_table_entry (abfd
, f
, &entry
);
2097 bfd_sym_display_contained_types_table (bfd
*abfd
, FILE *f
)
2100 bfd_sym_contained_types_table_entry entry
;
2101 bfd_sym_data_struct
*sdata
= NULL
;
2103 BFD_ASSERT (bfd_sym_valid (abfd
));
2104 sdata
= abfd
->tdata
.sym_data
;
2106 fprintf (f
, "contained types table (CTTE) contains %lu objects:\n\n",
2107 sdata
->header
.dshb_ctte
.dti_object_count
);
2109 for (i
= 1; i
<= sdata
->header
.dshb_ctte
.dti_object_count
; i
++)
2111 if (bfd_sym_fetch_contained_types_table_entry (abfd
, &entry
, i
) < 0)
2112 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2115 fprintf (f
, " [%8lu] ", i
);
2116 bfd_sym_print_contained_types_table_entry (abfd
, f
, &entry
);
2123 bfd_sym_display_file_references_index_table (bfd
*abfd
, FILE *f
)
2126 bfd_sym_file_references_index_table_entry entry
;
2127 bfd_sym_data_struct
*sdata
= NULL
;
2129 BFD_ASSERT (bfd_sym_valid (abfd
));
2130 sdata
= abfd
->tdata
.sym_data
;
2132 fprintf (f
, "file references index table (FITE) contains %lu objects:\n\n",
2133 sdata
->header
.dshb_fite
.dti_object_count
);
2135 for (i
= 1; i
<= sdata
->header
.dshb_fite
.dti_object_count
; i
++)
2137 if (bfd_sym_fetch_file_references_index_table_entry (abfd
, &entry
, i
) < 0)
2138 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2141 fprintf (f
, " [%8lu] ", i
);
2142 bfd_sym_print_file_references_index_table_entry (abfd
, f
, &entry
);
2149 bfd_sym_display_constant_pool (bfd
*abfd
, FILE *f
)
2152 bfd_sym_constant_pool_entry entry
;
2153 bfd_sym_data_struct
*sdata
= NULL
;
2155 BFD_ASSERT (bfd_sym_valid (abfd
));
2156 sdata
= abfd
->tdata
.sym_data
;
2158 fprintf (f
, "constant pool (CONST) contains %lu objects:\n\n",
2159 sdata
->header
.dshb_const
.dti_object_count
);
2161 for (i
= 1; i
<= sdata
->header
.dshb_const
.dti_object_count
; i
++)
2163 if (bfd_sym_fetch_constant_pool_entry (abfd
, &entry
, i
) < 0)
2164 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2167 fprintf (f
, " [%8lu] ", i
);
2168 bfd_sym_print_constant_pool_entry (abfd
, f
, &entry
);
2175 bfd_sym_display_type_information_table (bfd
*abfd
, FILE *f
)
2178 bfd_sym_type_table_entry index
;
2179 bfd_sym_type_information_table_entry entry
;
2180 bfd_sym_data_struct
*sdata
= NULL
;
2182 BFD_ASSERT (bfd_sym_valid (abfd
));
2183 sdata
= abfd
->tdata
.sym_data
;
2185 if (sdata
->header
.dshb_tte
.dti_object_count
> 99)
2186 fprintf (f
, "type table (TINFO) contains %lu objects:\n\n",
2187 sdata
->header
.dshb_tte
.dti_object_count
- 99);
2190 fprintf (f
, "type table (TINFO) contains [INVALID] objects:\n\n");
2194 for (i
= 100; i
<= sdata
->header
.dshb_tte
.dti_object_count
; i
++)
2196 if (bfd_sym_fetch_type_table_entry (abfd
, &index
, i
- 100) < 0)
2197 fprintf (f
, " [%8lu] [INVALID]\n", i
);
2200 fprintf (f
, " [%8lu] (TINFO %lu) ", i
, index
);
2202 if (bfd_sym_fetch_type_information_table_entry (abfd
, &entry
, index
) < 0)
2203 fprintf (f
, "[INVALID]");
2205 bfd_sym_print_type_information_table_entry (abfd
, f
, &entry
);
2213 bfd_sym_scan (bfd
*abfd
, bfd_sym_version version
, bfd_sym_data_struct
*mdata
)
2216 const char *name
= "symbols";
2218 mdata
->name_table
= 0;
2220 mdata
->version
= version
;
2222 bfd_seek (abfd
, 0, SEEK_SET
);
2223 if (bfd_sym_read_header (abfd
, &mdata
->header
, mdata
->version
) != 0)
2226 mdata
->name_table
= bfd_sym_read_name_table (abfd
, &mdata
->header
);
2227 if (mdata
->name_table
== NULL
)
2230 bfdsec
= bfd_make_section_anyway (abfd
, name
);
2237 bfdsec
->filepos
= 0;
2238 bfdsec
->alignment_power
= 0;
2240 bfdsec
->flags
= SEC_HAS_CONTENTS
;
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
);
2280 bfd_sym_make_empty_symbol (bfd
*abfd
)
2282 return bfd_alloc (abfd
, sizeof (asymbol
));
2286 bfd_sym_get_symbol_info (bfd
*abfd ATTRIBUTE_UNUSED
, asymbol
*symbol
, symbol_info
*ret
)
2288 bfd_symbol_info (symbol
, ret
);
2292 bfd_sym_get_symtab_upper_bound (bfd
*abfd ATTRIBUTE_UNUSED
)
2298 bfd_sym_canonicalize_symtab (bfd
*abfd ATTRIBUTE_UNUSED
, asymbol
**sym ATTRIBUTE_UNUSED
)
2304 bfd_sym_sizeof_headers (bfd
*abfd ATTRIBUTE_UNUSED
, bfd_boolean exec ATTRIBUTE_UNUSED
)
2309 const bfd_target sym_vec
=
2312 bfd_target_sym_flavour
, /* Flavour. */
2313 BFD_ENDIAN_BIG
, /* Byteorder. */
2314 BFD_ENDIAN_BIG
, /* Header byteorder. */
2315 (HAS_RELOC
| EXEC_P
| /* Object flags. */
2316 HAS_LINENO
| HAS_DEBUG
|
2317 HAS_SYMS
| HAS_LOCALS
| DYNAMIC
| WP_TEXT
| D_PAGED
),
2318 (SEC_ALLOC
| SEC_LOAD
| SEC_READONLY
| SEC_CODE
| SEC_DATA
2319 | SEC_ROM
| SEC_HAS_CONTENTS
), /* Section_flags. */
2320 0, /* Symbol_leading_char. */
2321 ' ', /* AR_pad_char. */
2322 16, /* AR_max_namelen. */
2323 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2324 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2325 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* Data. */
2326 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
2327 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
2328 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* Hdrs. */
2329 { /* bfd_check_format. */
2331 bfd_sym_object_p
, /* bfd_check_format. */
2335 { /* bfd_set_format. */
2341 { /* bfd_write_contents. */
2348 BFD_JUMP_TABLE_GENERIC (bfd_sym
),
2349 BFD_JUMP_TABLE_COPY (_bfd_generic
),
2350 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
2351 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive
),
2352 BFD_JUMP_TABLE_SYMBOLS (bfd_sym
),
2353 BFD_JUMP_TABLE_RELOCS (bfd_sym
),
2354 BFD_JUMP_TABLE_WRITE (bfd_sym
),
2355 BFD_JUMP_TABLE_LINK (bfd_sym
),
2356 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),