-
- if (config.map_file)
- {
- print_symbol_table ();
- lang_map ();
- }
-}
-
-/* Print the symbol table. */
-
-static void
-print_symbol_table ()
-{
- fprintf (config.map_file, "**FILES**\n\n");
- lang_for_each_file (print_file_stuff);
-
- fprintf (config.map_file, "**GLOBAL SYMBOLS**\n\n");
- fprintf (config.map_file, "offset section offset symbol\n");
- bfd_link_hash_traverse (link_info.hash, print_symbol, (PTR) NULL);
-}
-
-/* Print information about a file. */
-
-static void
-print_file_stuff (f)
- lang_input_statement_type *f;
-{
- fprintf (config.map_file, " %s\n", f->filename);
- if (f->just_syms_flag)
- {
- fprintf (config.map_file, " symbols only\n");
- }
- else
- {
- asection *s;
- if (true)
- {
- for (s = f->the_bfd->sections;
- s != (asection *) NULL;
- s = s->next)
- {
-#ifdef WINDOWS_NT
- /* Don't include any information that goes into the '.junk'
- section. This includes the code view .debug$ data and
- stuff from .drectve sections */
- if (strcmp (s->name, ".drectve") == 0 ||
- strncmp (s->name, ".debug$", 7) == 0)
- continue;
-#endif
- print_address (s->output_offset);
- if (s->reloc_done)
- {
- fprintf (config.map_file, " %08x 2**%2ud %s\n",
- (unsigned) bfd_get_section_size_after_reloc (s),
- s->alignment_power, s->name);
- }
-
- else
- {
- fprintf (config.map_file, " %08x 2**%2ud %s\n",
- (unsigned) bfd_get_section_size_before_reloc (s),
- s->alignment_power, s->name);
- }
- }
- }
- else
- {
- for (s = f->the_bfd->sections;
- s != (asection *) NULL;
- s = s->next)
- {
- fprintf (config.map_file, "%s ", s->name);
- print_address (s->output_offset);
- fprintf (config.map_file, "(%x)",
- (unsigned) bfd_get_section_size_after_reloc (s));
- }
- fprintf (config.map_file, "hex \n");
- }
- }
- print_nl ();
-}
-
-/* Print a symbol. */
-
-/*ARGSUSED*/
-static boolean
-print_symbol (p, ignore)
- struct bfd_link_hash_entry *p;
- PTR ignore;
-{
- while (p->type == bfd_link_hash_indirect
- || p->type == bfd_link_hash_warning)
- p = p->u.i.link;
-
- switch (p->type)
- {
- case bfd_link_hash_new:
- abort ();
-
- case bfd_link_hash_undefined:
- fprintf (config.map_file, "undefined ");
- fprintf (config.map_file, "%s ", p->root.string);
- print_nl ();
- break;
-
- case bfd_link_hash_undefweak:
- fprintf (config.map_file, "weak ");
- fprintf (config.map_file, "%s ", p->root.string);
- print_nl ();
- break;
-
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- {
- asection *defsec = p->u.def.section;
-
- print_address (p->u.def.value);
- if (defsec)
- {
- fprintf (config.map_file, " %-10s",
- bfd_section_name (output_bfd, defsec));
- print_space ();
- print_address (p->u.def.value + defsec->vma);
- }
- else
- {
- fprintf (config.map_file, " .......");
- }
- fprintf (config.map_file, " %s", p->root.string);
- if (p->type == bfd_link_hash_defweak)
- fprintf (config.map_file, " [weak]");
- }
- print_nl ();
- break;
-
- case bfd_link_hash_common:
- fprintf (config.map_file, "common ");
- print_address (p->u.c.size);
- fprintf (config.map_file, " %s ", p->root.string);
- print_nl ();
- break;
-
- default:
- abort ();
- }
-
- return true;