From efa6c49704b5d4a46840c7d93f1312010ad2bae4 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 26 Apr 1996 22:15:10 +0000 Subject: * ldmisc.h (demangle): Declare. * ldmisc.c: Include "libiberty.h". Include demangle.h with "", not <>. (demangle): Make non-static. Remove remove_underscore paramter. Always return an allocated string. (vfinfo): Free result of demangle. Add case 'G'. Use %T to print functionname, rather than calling demangle. Print a colon between the BFD(section+offset) and the line number. * ldmain.c (add_archive_element): Improve format of archive information in map file. (constructor_callback): Don't print anything to the map file. * ldlang.c (lang_one_common): Improve format of common symbol information in map file. * ldctor.c (ldctor_build_sets): If producing a map file, print set information. * ldwrite.c (print_symbol_table): Print a newline before the header in the map file. * Makefile.in: Rebuild dependencies. --- ld/ldmain.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 76 insertions(+), 5 deletions(-) (limited to 'ld/ldmain.c') diff --git a/ld/ldmain.c b/ld/ldmain.c index aee02e7..d637a50 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -637,7 +637,82 @@ add_archive_element (info, abfd, name) ldlang_add_file (input); if (config.map_file != (FILE *) NULL) - minfo ("%s needed due to %T\n", abfd->filename, name); + { + static boolean header_printed; + struct bfd_link_hash_entry *h; + bfd *from; + int len; + + h = bfd_link_hash_lookup (link_info.hash, name, false, false, true); + + if (h == NULL) + from = NULL; + else + { + switch (h->type) + { + default: + from = NULL; + break; + + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + from = h->u.def.section->owner; + break; + + case bfd_link_hash_undefined: + case bfd_link_hash_undefweak: + from = h->u.undef.abfd; + break; + + case bfd_link_hash_common: + from = h->u.c.p->section->owner; + break; + } + } + + if (! header_printed) + { + char buf[100]; + + sprintf (buf, "%-29s %s\n\n", "Archive member included", + "because of file (symbol)"); + minfo ("%s", buf); + header_printed = true; + } + + if (bfd_my_archive (abfd) == NULL) + { + minfo ("%s", bfd_get_filename (abfd)); + len = strlen (bfd_get_filename (abfd)); + } + else + { + minfo ("%s(%s)", bfd_get_filename (bfd_my_archive (abfd)), + bfd_get_filename (abfd)); + len = (strlen (bfd_get_filename (bfd_my_archive (abfd))) + + strlen (bfd_get_filename (abfd)) + + 2); + } + + if (len >= 29) + { + print_nl (); + len = 0; + } + while (len < 30) + { + print_space (); + ++len; + } + + if (from != NULL) + minfo ("%B ", from); + if (h != NULL) + minfo ("(%T)\n", h->root.string); + else + minfo ("(%s)\n", name); + } if (trace_files || trace_file_tries) info_msg ("%I\n", input); @@ -820,10 +895,6 @@ constructor_callback (info, constructor, name, abfd, section, value) else strcpy (s, "__DTOR_LIST__"); - if (config.map_file != (FILE *) NULL) - fprintf (config.map_file, - "Adding %s to constructor/destructor set %s\n", name, set_name); - h = bfd_link_hash_lookup (info->hash, set_name, true, true, true); if (h == (struct bfd_link_hash_entry *) NULL) einfo ("%P%F: bfd_link_hash_lookup failed: %E\n"); -- cgit v1.1