diff options
Diffstat (limited to 'ld/lexsup.c')
-rw-r--r-- | ld/lexsup.c | 89 |
1 files changed, 50 insertions, 39 deletions
diff --git a/ld/lexsup.c b/ld/lexsup.c index 58b9bdd..bde2046 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -499,8 +499,10 @@ static const struct ld_option ld_options[] = { {"split-by-reloc", optional_argument, NULL, OPTION_SPLIT_BY_RELOC}, '\0', N_("[=COUNT]"), N_("Split output sections every COUNT relocs"), TWO_DASHES }, - { {"stats", no_argument, NULL, OPTION_STATS}, - '\0', NULL, N_("Print memory usage statistics"), TWO_DASHES }, + { {"stats", optional_argument, NULL, OPTION_STATS}, + '\0', NULL, N_("Print resource usage statistics"), TWO_DASHES }, + { {"no-stats", optional_argument, NULL, OPTION_NO_STATS}, + '\0', NULL, N_("Do not print resource usage statistics"), TWO_DASHES }, { {"target-help", no_argument, NULL, OPTION_TARGET_HELP}, '\0', NULL, N_("Display target specific options"), TWO_DASHES }, { {"task-link", required_argument, NULL, OPTION_TASK_LINK}, @@ -810,7 +812,8 @@ parse_args (unsigned argc, char **argv) && optc != argv[last_optind][1]) { if (optarg) - einfo (_("%F%P: Error: unable to disambiguate: %s (did you mean -%s ?)\n"), + fatal (_("%P: Error: unable to disambiguate: " + "%s (did you mean -%s ?)\n"), argv[last_optind], argv[last_optind]); else einfo (_("%P: Warning: grouped short command line options are deprecated: %s\n"), argv[last_optind]); @@ -850,7 +853,7 @@ parse_args (unsigned argc, char **argv) /* Fall through. */ default: - einfo (_("%F%P: use the --help option for usage information\n")); + fatal (_("%P: use the --help option for usage information\n")); break; case 1: /* File name. */ @@ -869,7 +872,7 @@ parse_args (unsigned argc, char **argv) || strcmp (optarg, "default") == 0) input_flags.dynamic = true; else - einfo (_("%F%P: unrecognized -a option `%s'\n"), optarg); + fatal (_("%P: unrecognized -a option `%s'\n"), optarg); break; case OPTION_ASSERT: /* FIXME: We just ignore these, but we should handle them. */ @@ -882,7 +885,7 @@ parse_args (unsigned argc, char **argv) else if (strcmp (optarg, "pure-text") == 0) ; else - einfo (_("%F%P: unrecognized -assert option `%s'\n"), optarg); + fatal (_("%P: unrecognized -assert option `%s'\n"), optarg); break; case 'A': ldfile_add_arch (optarg); @@ -926,8 +929,7 @@ parse_args (unsigned argc, char **argv) style = cplus_demangle_name_to_style (optarg); if (style == unknown_demangling) - einfo (_("%F%P: unknown demangling style `%s'\n"), - optarg); + fatal (_("%P: unknown demangling style `%s'\n"), optarg); cplus_demangle_set_style (style); } @@ -1034,7 +1036,7 @@ parse_args (unsigned argc, char **argv) char *end; g_switch_value = strtoul (optarg, &end, 0); if (*end) - einfo (_("%F%P: invalid number `%s'\n"), optarg); + fatal (_("%P: invalid number `%s'\n"), optarg); } break; case 'g': @@ -1130,7 +1132,7 @@ parse_args (unsigned argc, char **argv) link_info.unresolved_syms_in_shared_libs = RM_IGNORE; } else - einfo (_("%F%P: bad --unresolved-symbols option: %s\n"), optarg); + fatal (_("%P: bad --unresolved-symbols option: %s\n"), optarg); break; case OPTION_WARN_UNRESOLVED_SYMBOLS: link_info.warn_unresolved_syms = true; @@ -1217,7 +1219,7 @@ parse_args (unsigned argc, char **argv) break; case OPTION_PLUGIN_OPT: if (plugin_opt_plugin_arg (optarg)) - einfo (_("%F%P: bad -plugin-opt option\n")); + fatal (_("%P: bad -plugin-opt option\n")); break; case OPTION_PLUGIN_SAVE_TEMPS: config.plugin_save_temps = true; @@ -1237,11 +1239,11 @@ parse_args (unsigned argc, char **argv) an error message here. We cannot just make this a warning, increment optind, and continue because getopt is too confused and will seg-fault the next time around. */ - einfo(_("%F%P: unrecognised option: %s\n"), argv[optind]); + fatal(_("%P: unrecognised option: %s\n"), argv[optind]); if (bfd_link_pic (&link_info)) - einfo (_("%F%P: -r and %s may not be used together\n"), - bfd_link_dll (&link_info) ? "-shared" : "-pie"); + fatal (_("%P: -r and %s may not be used together\n"), + bfd_link_dll (&link_info) ? "-shared" : "-pie"); link_info.type = type_relocatable; config.build_constructors = false; @@ -1350,7 +1352,7 @@ parse_args (unsigned argc, char **argv) if (config.has_shared) { if (bfd_link_relocatable (&link_info)) - einfo (_("%F%P: -r and %s may not be used together\n"), + fatal (_("%P: -r and %s may not be used together\n"), "-shared"); link_info.type = type_dll; @@ -1362,7 +1364,7 @@ parse_args (unsigned argc, char **argv) link_info.unresolved_syms_in_shared_libs = RM_IGNORE; } else - einfo (_("%F%P: -shared not supported\n")); + fatal (_("%P: -shared not supported\n")); break; case OPTION_NO_PIE: link_info.type = type_pde; @@ -1371,12 +1373,12 @@ parse_args (unsigned argc, char **argv) if (config.has_shared) { if (bfd_link_relocatable (&link_info)) - einfo (_("%F%P: -r and %s may not be used together\n"), "-pie"); + fatal (_("%P: -r and %s may not be used together\n"), "-pie"); link_info.type = type_pie; } else - einfo (_("%F%P: -pie not supported\n")); + fatal (_("%P: -pie not supported\n")); break; case 'h': /* Used on Solaris. */ case OPTION_SONAME: @@ -1393,7 +1395,7 @@ parse_args (unsigned argc, char **argv) else if (strcmp (optarg, N_("ascending")) == 0) config.sort_common = sort_ascending; else - einfo (_("%F%P: invalid common section sorting option: %s\n"), + fatal (_("%P: invalid common section sorting option: %s\n"), optarg); break; case OPTION_SORT_SECTION: @@ -1402,8 +1404,7 @@ parse_args (unsigned argc, char **argv) else if (strcmp (optarg, N_("alignment")) == 0) sort_section = by_alignment; else - einfo (_("%F%P: invalid section sorting option: %s\n"), - optarg); + fatal (_("%P: invalid section sorting option: %s\n"), optarg); break; case OPTION_SECTION_ORDERING_FILE: if (command_line.section_ordering_file != NULL @@ -1413,6 +1414,17 @@ parse_args (unsigned argc, char **argv) break; case OPTION_STATS: config.stats = true; + if (optarg) + config.stats_filename = optarg; + else + { + config.stats_filename = NULL; + config.stats_file = stderr; + } + break; + case OPTION_NO_STATS: + config.stats = false; + config.stats_filename = NULL; break; case OPTION_NO_SYMBOLIC: opt_symbolic = symbolic_unset; @@ -1445,14 +1457,14 @@ parse_args (unsigned argc, char **argv) /* Check for <something>=<somthing>... */ optarg2 = strchr (optarg, '='); if (optarg2 == NULL) - einfo (_("%F%P: invalid argument to option" + fatal (_("%P: invalid argument to option" " \"--section-start\"\n")); optarg2++; /* So far so good. Are all the args present? */ if ((*optarg == '\0') || (*optarg2 == '\0')) - einfo (_("%F%P: missing argument(s) to option" + fatal (_("%P: missing argument(s) to option" " \"--section-start\"\n")); /* We must copy the section name as set_section_start @@ -1499,8 +1511,8 @@ parse_args (unsigned argc, char **argv) /* Fall through. */ case OPTION_UR: if (bfd_link_pic (&link_info)) - einfo (_("%F%P: -r and %s may not be used together\n"), - bfd_link_dll (&link_info) ? "-shared" : "-pie"); + fatal (_("%P: -r and %s may not be used together\n"), + bfd_link_dll (&link_info) ? "-shared" : "-pie"); link_info.type = type_relocatable; config.build_constructors = true; @@ -1530,7 +1542,7 @@ parse_args (unsigned argc, char **argv) char *end; int level ATTRIBUTE_UNUSED = strtoul (optarg, &end, 0); if (*end) - einfo (_("%F%P: invalid number `%s'\n"), optarg); + fatal (_("%P: invalid number `%s'\n"), optarg); #if BFD_SUPPORTS_PLUGINS report_plugin_symbols = level > 1; #endif /* BFD_SUPPORTS_PLUGINS */ @@ -1725,7 +1737,7 @@ parse_args (unsigned argc, char **argv) break; case ')': if (! ingroup) - einfo (_("%F%P: group ended before it began (--help for usage)\n")); + fatal (_("%P: group ended before it began (--help for usage)\n")); lang_leave_group (); ingroup--; @@ -1741,7 +1753,7 @@ parse_args (unsigned argc, char **argv) case OPTION_REMAP_INPUTS_FILE: if (! ldfile_add_remap_file (optarg)) - einfo (_("%F%P: failed to add remap file %s\n"), optarg); + fatal (_("%P: failed to add remap file %s\n"), optarg); break; case OPTION_REMAP_INPUTS: @@ -1750,7 +1762,7 @@ parse_args (unsigned argc, char **argv) if (optarg2 == NULL) /* FIXME: Should we allow --remap-inputs=@myfile as a synonym for --remap-inputs-file=myfile ? */ - einfo (_("%F%P: invalid argument to option --remap-inputs\n")); + fatal (_("%P: invalid argument to option --remap-inputs\n")); size_t len = optarg2 - optarg; char * pattern = xmalloc (len + 1); memcpy (pattern, optarg, len); @@ -1771,8 +1783,7 @@ parse_args (unsigned argc, char **argv) char *end; bfd_size_type cache_size = strtoul (optarg, &end, 0); if (*end != '\0') - einfo (_("%F%P: invalid cache memory size: %s\n"), - optarg); + fatal (_("%P: invalid cache memory size: %s\n"), optarg); link_info.max_cache_size = cache_size; } break; @@ -1797,7 +1808,7 @@ parse_args (unsigned argc, char **argv) case OPTION_POP_STATE: if (input_flags.pushed == NULL) - einfo (_("%F%P: no state pushed before popping\n")); + fatal (_("%P: no state pushed before popping\n")); else { struct lang_input_statement_flags *oldp = input_flags.pushed; @@ -1820,7 +1831,7 @@ parse_args (unsigned argc, char **argv) else if (strcasecmp (optarg, "discard") == 0) config.orphan_handling = orphan_handling_discard; else - einfo (_("%F%P: invalid argument to option" + fatal (_("%P: invalid argument to option" " \"--orphan-handling\"\n")); break; @@ -1858,7 +1869,7 @@ parse_args (unsigned argc, char **argv) else if (strcmp (optarg, "share-duplicated") == 0) config.ctf_share_duplicated = true; else - einfo (_("%F%P: bad --ctf-share-types option: %s\n"), optarg); + fatal (_("%P: bad --ctf-share-types option: %s\n"), optarg); break; } } @@ -2024,7 +2035,7 @@ parse_args (unsigned argc, char **argv) if (config.no_section_header) { if (bfd_link_relocatable (&link_info)) - einfo (_("%F%P: -r and -z nosectionheader may not be used together\n")); + fatal (_("%P: -r and -z nosectionheader may not be used together\n")); link_info.strip = strip_all; } @@ -2032,9 +2043,9 @@ parse_args (unsigned argc, char **argv) if (!bfd_link_dll (&link_info)) { if (command_line.filter_shlib) - einfo (_("%F%P: -F may not be used without -shared\n")); + fatal (_("%P: -F may not be used without -shared\n")); if (command_line.auxiliary_filters) - einfo (_("%F%P: -f may not be used without -shared\n")); + fatal (_("%P: -f may not be used without -shared\n")); } /* Treat ld -r -s as ld -r -S -x (i.e., strip all local symbols). I @@ -2075,7 +2086,7 @@ set_section_start (char *sect, char *valstr) const char *end; bfd_vma val = bfd_scan_vma (valstr, &end, 16); if (*end) - einfo (_("%F%P: invalid hex number `%s'\n"), valstr); + fatal (_("%P: invalid hex number `%s'\n"), valstr); lang_section_start (sect, exp_intop (val), NULL); } @@ -2088,7 +2099,7 @@ set_segment_start (const char *section, char *valstr) bfd_vma val = bfd_scan_vma (valstr, &end, 16); if (*end) - einfo (_("%F%P: invalid hex number `%s'\n"), valstr); + fatal (_("%P: invalid hex number `%s'\n"), valstr); /* If we already have an entry for this segment, update the existing value. */ name = section + 1; |