diff options
author | Alan Modra <amodra@gmail.com> | 2018-02-24 10:28:12 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2018-02-26 10:51:12 +1030 |
commit | df5f2391f7b2e3cab7e677ab7dadd02aef06e269 (patch) | |
tree | 011c9dd1fdb526a1a8d3a2e96974fd04715c2fc8 /ld/ldmain.c | |
parent | 33589acbfea909ca2a26b977ff2f672332990747 (diff) | |
download | gdb-df5f2391f7b2e3cab7e677ab7dadd02aef06e269.zip gdb-df5f2391f7b2e3cab7e677ab7dadd02aef06e269.tar.gz gdb-df5f2391f7b2e3cab7e677ab7dadd02aef06e269.tar.bz2 |
ld error/warning messages
This patch standardizes messages in ld, to better conform to the GNU
coding standard. Besides issues of capitalization and full-stops,
I've
- Split up help messages for target options, so that adding a new
option does not mean loss of translation for all the others.
- Embedded tabs have been removed, since a user might have tab stops
set at other than 8 char intervals.
- Added missing program name (%P). ld isn't the compiler.
- Put %F and %X first (and removed %X if %F was present). These can
go anywhere, but look silly in the m%Fiddle of a message, and
choosing "%P%F:" in some messages but "%F%P:" in others leads to the
likelihood of duplication in ld.pot. Besides, the colon belongs
with %P.
* emulparams/call_nop.sh, * emulparams/cet.sh,
* emulparams/elf32mcore.sh, * emultempl/aarch64elf.em
* emultempl/aix.em, * emultempl/alphaelf.em, * emultempl/armcoff.em,
* emultempl/armelf.em, * emultempl/avrelf.em, * emultempl/beos.em,
* emultempl/bfin.em, * emultempl/cr16elf.em, * emultempl/elf32.em,
* emultempl/elf-generic.em, * emultempl/hppaelf.em,
* emultempl/linux.em, * emultempl/lnk960.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kcoff.em,
* emultempl/m68kelf.em, * emultempl/metagelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em, * emultempl/nds32elf.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc32elf.em, * emultempl/ppc64elf.em,
* emultempl/scoreelf.em, * emultempl/sh64elf.em,
* emultempl/spuelf.em, * emultempl/sunos.em, * emultempl/tic6xdsbt.em,
* emultempl/ticoff.em, * emultempl/v850elf.em, * emultempl/vms.em,
* emultempl/vxworks.em, * emultempl/xtensaelf.em, * ldcref.c,
* ldctor.c, * ldexp.c, * ldfile.c, * ldgram.y, * ldlang.c,
* ldmain.c, * ldmisc.c, * ldwrite.c, * lexsup.c, * mri.c, * pe-dll.c,
* plugin.c: Standardize error/warning messages.
* testsuite/ld-arc/jli-overflow.err,
* testsuite/ld-arm/cmse-implib-errors.out,
* testsuite/ld-arm/cmse-new-earlier-later-implib.out,
* testsuite/ld-arm/cmse-new-implib-not-sg-in-implib.out,
* testsuite/ld-arm/cmse-new-wrong-implib.out,
* testsuite/ld-arm/cmse-veneers-no-gnu_sgstubs.out,
* testsuite/ld-arm/cmse-veneers-wrong-entryfct.out,
* testsuite/ld-arm/vxworks1-static.d,
* testsuite/ld-cris/tls-err-20x.d, * testsuite/ld-cris/tls-err-29.d,
* testsuite/ld-cris/tls-err-31.d, * testsuite/ld-cris/tls-err-33.d,
* testsuite/ld-cris/tls-err-35.d, * testsuite/ld-cris/tls-err-37.d,
* testsuite/ld-cris/tls-err-39.d, * testsuite/ld-cris/tls-err-41.d,
* testsuite/ld-cris/tls-err-43.d, * testsuite/ld-cris/tls-err-45.d,
* testsuite/ld-cris/tls-err-47.d, * testsuite/ld-cris/tls-err-49.d,
* testsuite/ld-cris/tls-err-51.d, * testsuite/ld-cris/tls-err-67.d,
* testsuite/ld-elf/dwarf2.err, * testsuite/ld-elf/dwarf3.err,
* testsuite/ld-elf/orphan-5.l, * testsuite/ld-elf/orphan-6.l,
* testsuite/ld-i386/vxworks1-static.d,
* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d,
* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d,
* testsuite/ld-mips-elf/bal-jalx-pic-micromips.d,
* testsuite/ld-mips-elf/bal-jalx-pic-n32.d,
* testsuite/ld-mips-elf/bal-jalx-pic-n64.d,
* testsuite/ld-mips-elf/bal-jalx-pic.d,
* testsuite/ld-mips-elf/jal-global-overflow-1.d,
* testsuite/ld-mips-elf/jal-local-overflow-1.d,
* testsuite/ld-mips-elf/mode-change-error-1.d,
* testsuite/ld-mips-elf/unaligned-branch-2.d,
* testsuite/ld-mips-elf/unaligned-branch-ignore-2.d,
* testsuite/ld-mips-elf/unaligned-branch-ignore-micromips.d,
* testsuite/ld-mips-elf/unaligned-branch-ignore-mips16.d,
* testsuite/ld-mips-elf/unaligned-branch-ignore-r6-1.d,
* testsuite/ld-mips-elf/unaligned-branch-micromips.d,
* testsuite/ld-mips-elf/unaligned-branch-mips16.d,
* testsuite/ld-mips-elf/unaligned-branch-r6-1.d,
* testsuite/ld-mips-elf/unaligned-branch-r6-2.d,
* testsuite/ld-mips-elf/unaligned-branch.d,
* testsuite/ld-mips-elf/unaligned-jalx-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-3.d,
* testsuite/ld-mips-elf/unaligned-jalx-addend-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-addend-3.d,
* testsuite/ld-mips-elf/unaligned-jalx-addend-micromips-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-addend-mips16-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-micromips-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-mips16-1.d,
* testsuite/ld-mips-elf/unaligned-jump-micromips.d,
* testsuite/ld-mips-elf/unaligned-jump-mips16.d,
* testsuite/ld-mips-elf/unaligned-jump.d,
* testsuite/ld-mips-elf/unaligned-ldpc-1.d,
* testsuite/ld-mips-elf/unaligned-lwpc-1.d,
* testsuite/ld-mips-elf/undefined.d,
* testsuite/ld-mips-elf/vxworks1-static.d,
* testsuite/ld-mmix/bpo-20.d, * testsuite/ld-mmix/bpo-20m.d,
* testsuite/ld-mmix/bpo-7.d, * testsuite/ld-mmix/bpo-7m.d,
* testsuite/ld-mmix/bpo-8.d, * testsuite/ld-mmix/bpo-8m.d,
* testsuite/ld-mmix/greg-17.d, * testsuite/ld-mmix/greg-18.d,
* testsuite/ld-mmix/greg-8.d, * testsuite/ld-mmix/greg-9.d,
* testsuite/ld-plugin/plugin-14.d, * testsuite/ld-plugin/plugin-15.d,
* testsuite/ld-plugin/plugin-16.d, * testsuite/ld-plugin/plugin-20.d,
* testsuite/ld-plugin/plugin-21.d, * testsuite/ld-plugin/plugin-22.d,
* testsuite/ld-plugin/plugin-23.d, * testsuite/ld-plugin/plugin-6.d,
* testsuite/ld-plugin/plugin-7.d, * testsuite/ld-plugin/plugin-8.d,
* testsuite/ld-powerpc/aix-weak-3-32.d,
* testsuite/ld-powerpc/aix-weak-3-64.d,
* testsuite/ld-powerpc/vxworks1-static.d,
* testsuite/ld-sh/vxworks1-static.d,
* testsuite/ld-sparc/vxworks1-static.d,
* testsuite/ld-undefined/undefined.exp,
* testsuite/ld-x86-64/pie1.d: Update for changed errors and warnings.
* testsuite/ld-elf/warn1.d, * testsuite/ld-elf/warn2.d: Correct regex.
Diffstat (limited to 'ld/ldmain.c')
-rw-r--r-- | ld/ldmain.c | 130 |
1 files changed, 74 insertions, 56 deletions
diff --git a/ld/ldmain.c b/ld/ldmain.c index 6945654..b6914db 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -397,13 +397,13 @@ main (int argc, char **argv) xexit (0); if (link_info.inhibit_common_definition && !bfd_link_dll (&link_info)) - einfo (_("%P%F: --no-define-common may not be used without -shared\n")); + einfo (_("%F%P: --no-define-common may not be used without -shared\n")); if (!lang_has_input_file) { if (version_printed || command_line.print_output_format) xexit (0); - einfo (_("%P%F: no input files\n")); + einfo (_("%F%P: no input files\n")); } if (trace_files) @@ -423,7 +423,7 @@ main (int argc, char **argv) if (config.map_file == (FILE *) NULL) { bfd_set_error (bfd_error_system_call); - einfo (_("%P%F: cannot open map file %s: %E\n"), + einfo (_("%F%P: cannot open map file %s: %E\n"), config.map_filename); } } @@ -481,7 +481,7 @@ main (int argc, char **argv) else { if (!bfd_close (link_info.output_bfd)) - einfo (_("%F%pB: final close failed: %E\n"), link_info.output_bfd); + einfo (_("%F%P: %pB: final close failed: %E\n"), link_info.output_bfd); /* If the --force-exe-suffix is enabled, and we're making an executable file and it doesn't end in .exe, copy it to one @@ -508,22 +508,22 @@ main (int argc, char **argv) dst = fopen (dst_name, FOPEN_WB); if (!src) - einfo (_("%P%F: unable to open for source of copy `%s'\n"), + einfo (_("%F%P: unable to open for source of copy `%s'\n"), output_filename); if (!dst) - einfo (_("%P%F: unable to open for destination of copy `%s'\n"), + einfo (_("%F%P: unable to open for destination of copy `%s'\n"), dst_name); while ((l = fread (buf, 1, bsize, src)) > 0) { int done = fwrite (buf, 1, l, dst); if (done != l) - einfo (_("%P: Error writing file `%s'\n"), dst_name); + einfo (_("%P: error writing file `%s'\n"), dst_name); } fclose (src); if (fclose (dst) == EOF) - einfo (_("%P: Error closing file `%s'\n"), dst_name); + einfo (_("%P: error closing file `%s'\n"), dst_name); free (dst_name); free (buf); } @@ -620,7 +620,7 @@ get_emulation (int argc, char **argv) i++; } else - einfo (_("%P%F: missing argument to -m\n")); + einfo (_("%F%P: missing argument to -m\n")); } else if (strcmp (argv[i], "-mips1") == 0 || strcmp (argv[i], "-mips2") == 0 @@ -670,11 +670,11 @@ add_ysym (const char *name) bfd_hash_newfunc, sizeof (struct bfd_hash_entry), 61)) - einfo (_("%P%F: bfd_hash_table_init failed: %E\n")); + einfo (_("%F%P: bfd_hash_table_init failed: %E\n")); } if (bfd_hash_lookup (link_info.notice_hash, name, TRUE, TRUE) == NULL) - einfo (_("%P%F: bfd_hash_lookup failed: %E\n")); + einfo (_("%F%P: bfd_hash_lookup failed: %E\n")); } void @@ -687,11 +687,11 @@ add_ignoresym (struct bfd_link_info *info, const char *name) bfd_hash_newfunc, sizeof (struct bfd_hash_entry), 61)) - einfo (_("%P%F: bfd_hash_table_init failed: %E\n")); + einfo (_("%F%P: bfd_hash_table_init failed: %E\n")); } if (bfd_hash_lookup (info->ignore_hash, name, TRUE, TRUE) == NULL) - einfo (_("%P%F: bfd_hash_lookup failed: %E\n")); + einfo (_("%F%P: bfd_hash_lookup failed: %E\n")); } /* Record a symbol to be wrapped, from the --wrap option. */ @@ -707,11 +707,11 @@ add_wrap (const char *name) bfd_hash_newfunc, sizeof (struct bfd_hash_entry), 61)) - einfo (_("%P%F: bfd_hash_table_init failed: %E\n")); + einfo (_("%F%P: bfd_hash_table_init failed: %E\n")); } if (bfd_hash_lookup (link_info.wrap_hash, name, TRUE, TRUE) == NULL) - einfo (_("%P%F: bfd_hash_lookup failed: %E\n")); + einfo (_("%F%P: bfd_hash_lookup failed: %E\n")); } /* Handle the -retain-symbols-file option. */ @@ -739,7 +739,7 @@ add_keepsyms_file (const char *filename) xmalloc (sizeof (struct bfd_hash_table)); if (!bfd_hash_table_init (link_info.keep_hash, bfd_hash_newfunc, sizeof (struct bfd_hash_entry))) - einfo (_("%P%F: bfd_hash_table_init failed: %E\n")); + einfo (_("%F%P: bfd_hash_table_init failed: %E\n")); bufsize = 100; buf = (char *) xmalloc (bufsize); @@ -769,7 +769,7 @@ add_keepsyms_file (const char *filename) buf[len] = '\0'; if (bfd_hash_lookup (link_info.keep_hash, buf, TRUE, TRUE) == NULL) - einfo (_("%P%F: bfd_hash_lookup for insertion failed: %E\n")); + einfo (_("%F%P: bfd_hash_lookup for insertion failed: %E\n")); } } @@ -979,14 +979,15 @@ multiple_definition (struct bfd_link_info *info, nval = oval; obfd = NULL; } - einfo (_("%X%C: multiple definition of `%pT'\n"), + einfo (_("%X%P: %C: multiple definition of `%pT'"), nbfd, nsec, nval, name); if (obfd != NULL) - einfo (_("%D: first defined here\n"), obfd, osec, oval); + einfo (_("; %D: first defined here"), obfd, osec, oval); + einfo ("\n"); if (RELAXATION_ENABLED_BY_USER) { - einfo (_("%P: Disabling relaxation: it will not work with multiple definitions\n")); + einfo (_("%P: disabling relaxation; it will not work with multiple definitions\n")); DISABLE_RELAXATION; } } @@ -1038,43 +1039,60 @@ multiple_common (struct bfd_link_info *info ATTRIBUTE_UNUSED, || ntype == bfd_link_hash_indirect) { ASSERT (otype == bfd_link_hash_common); - einfo (_("%pB: warning: definition of `%pT' overriding common\n"), - nbfd, name); if (obfd != NULL) - einfo (_("%pB: warning: common is here\n"), obfd); + einfo (_("%P: %pB: warning: definition of `%pT' overriding common" + " from %pB\n"), + nbfd, name, obfd); + else + einfo (_("%P: %pB: warning: definition of `%pT' overriding common\n"), + nbfd, name); } else if (otype == bfd_link_hash_defined || otype == bfd_link_hash_defweak || otype == bfd_link_hash_indirect) { ASSERT (ntype == bfd_link_hash_common); - einfo (_("%pB: warning: common of `%pT' overridden by definition\n"), - nbfd, name); if (obfd != NULL) - einfo (_("%pB: warning: defined here\n"), obfd); + einfo (_("%P: %pB: warning: common of `%pT' overridden by definition" + " from %pB\n"), + nbfd, name, obfd); + else + einfo (_("%P: %pB: warning: common of `%pT' overridden by definition\n"), + nbfd, name); } else { ASSERT (otype == bfd_link_hash_common && ntype == bfd_link_hash_common); if (osize > nsize) { - einfo (_("%pB: warning: common of `%pT' overridden by larger common\n"), - nbfd, name); if (obfd != NULL) - einfo (_("%pB: warning: larger common is here\n"), obfd); + einfo (_("%P: %pB: warning: common of `%pT' overridden" + " by larger common from %pB\n"), + nbfd, name, obfd); + else + einfo (_("%P: %pB: warning: common of `%pT' overridden" + " by larger common\n"), + nbfd, name); } else if (nsize > osize) { - einfo (_("%pB: warning: common of `%pT' overriding smaller common\n"), - nbfd, name); if (obfd != NULL) - einfo (_("%pB: warning: smaller common is here\n"), obfd); + einfo (_("%P: %pB: warning: common of `%pT' overriding" + " smaller common from %pB\n"), + nbfd, name, obfd); + else + einfo (_("%P: %pB: warning: common of `%pT' overriding" + " smaller common\n"), + nbfd, name); } else { - einfo (_("%pB: warning: multiple common of `%pT'\n"), nbfd, name); if (obfd != NULL) - einfo (_("%pB: warning: previous common is here\n"), obfd); + einfo (_("%P: %pB and %pB: warning: multiple common of `%pT'\n"), + nbfd, obfd, name); + else + einfo (_("%P: %pB: warning: multiple common of `%pT'\n"), + nbfd, name); } } } @@ -1138,7 +1156,7 @@ constructor_callback (struct bfd_link_info *info, if (bfd_reloc_type_lookup (info->output_bfd, BFD_RELOC_CTOR) == NULL && (bfd_link_relocatable (info) || bfd_reloc_type_lookup (abfd, BFD_RELOC_CTOR) == NULL)) - einfo (_("%P%F: BFD backend error: BFD_RELOC_CTOR unsupported\n")); + einfo (_("%F%P: BFD backend error: BFD_RELOC_CTOR unsupported\n")); s = set_name; if (bfd_get_symbol_leading_char (abfd) != '\0') @@ -1150,7 +1168,7 @@ constructor_callback (struct bfd_link_info *info, 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")); + einfo (_("%F%P: bfd_link_hash_lookup failed: %E\n")); if (h->type == bfd_link_hash_new) { h->type = bfd_link_hash_undefined; @@ -1183,7 +1201,7 @@ symbol_warning (const char *warning, const char *symbol, bfd *abfd) struct warning_callback_info cinfo; if (!bfd_generic_link_read_symbols (abfd)) - einfo (_("%pB%F: could not read symbols: %E\n"), abfd); + einfo (_("%F%P: %pB: could not read symbols: %E\n"), abfd); cinfo.found = FALSE; cinfo.warning = warning; @@ -1210,11 +1228,11 @@ warning_callback (struct bfd_link_info *info ATTRIBUTE_UNUSED, return; if (section != NULL) - einfo ("%C: %s%s\n", abfd, section, address, _("warning: "), warning); + einfo ("%P: %C: %s%s\n", abfd, section, address, _("warning: "), warning); else if (abfd == NULL) einfo ("%P: %s%s\n", _("warning: "), warning); else if (symbol == NULL) - einfo ("%pB: %s%s\n", abfd, _("warning: "), warning); + einfo ("%P: %pB: %s%s\n", abfd, _("warning: "), warning); else if (!symbol_warning (warning, symbol, abfd)) { bfd *b; @@ -1222,7 +1240,7 @@ warning_callback (struct bfd_link_info *info ATTRIBUTE_UNUSED, for (b = info->input_bfds; b; b = b->link.next) if (b != abfd && symbol_warning (warning, symbol, b)) return; - einfo ("%pB: %s%s\n", abfd, _("warning: "), warning); + einfo ("%P: %pB: %s%s\n", abfd, _("warning: "), warning); } } @@ -1245,14 +1263,14 @@ warning_find_reloc (bfd *abfd, asection *sec, void *iarg) relsize = bfd_get_reloc_upper_bound (abfd, sec); if (relsize < 0) - einfo (_("%pB%F: could not read relocs: %E\n"), abfd); + einfo (_("%F%P: %pB: could not read relocs: %E\n"), abfd); if (relsize == 0) return; relpp = (arelent **) xmalloc (relsize); relcount = bfd_canonicalize_reloc (abfd, sec, relpp, info->asymbols); if (relcount < 0) - einfo (_("%pB%F: could not read relocs: %E\n"), abfd); + einfo (_("%F%P: %pB: could not read relocs: %E\n"), abfd); p = relpp; pend = p + relcount; @@ -1265,7 +1283,7 @@ warning_find_reloc (bfd *abfd, asection *sec, void *iarg) && strcmp (bfd_asymbol_name (*q->sym_ptr_ptr), info->symbol) == 0) { /* We found a reloc for the symbol we are looking for. */ - einfo ("%C: %s%s\n", abfd, sec, q->address, _("warning: "), + einfo ("%P: %C: %s%s\n", abfd, sec, q->address, _("warning: "), info->warning); info->found = TRUE; break; @@ -1318,19 +1336,19 @@ undefined_symbol (struct bfd_link_info *info, if (error_count < MAX_ERRORS_IN_A_ROW) { if (error) - einfo (_("%X%C: undefined reference to `%pT'\n"), + einfo (_("%X%P: %C: undefined reference to `%pT'\n"), abfd, section, address, name); else - einfo (_("%C: warning: undefined reference to `%pT'\n"), + einfo (_("%P: %C: warning: undefined reference to `%pT'\n"), abfd, section, address, name); } else if (error_count == MAX_ERRORS_IN_A_ROW) { if (error) - einfo (_("%X%D: more undefined references to `%pT' follow\n"), + einfo (_("%X%P: %D: more undefined references to `%pT' follow\n"), abfd, section, address, name); else - einfo (_("%D: warning: more undefined references to `%pT' follow\n"), + einfo (_("%P: %D: warning: more undefined references to `%pT' follow\n"), abfd, section, address, name); } else if (error) @@ -1341,19 +1359,19 @@ undefined_symbol (struct bfd_link_info *info, if (error_count < MAX_ERRORS_IN_A_ROW) { if (error) - einfo (_("%X%pB: undefined reference to `%pT'\n"), + einfo (_("%X%P: %pB: undefined reference to `%pT'\n"), abfd, name); else - einfo (_("%pB: warning: undefined reference to `%pT'\n"), + einfo (_("%P: %pB: warning: undefined reference to `%pT'\n"), abfd, name); } else if (error_count == MAX_ERRORS_IN_A_ROW) { if (error) - einfo (_("%X%pB: more undefined references to `%pT' follow\n"), + einfo (_("%X%P: %pB: more undefined references to `%pT' follow\n"), abfd, name); else - einfo (_("%pB: warning: more undefined references to `%pT' follow\n"), + einfo (_("%P: %pB: warning: more undefined references to `%pT' follow\n"), abfd, name); } else if (error) @@ -1385,7 +1403,7 @@ reloc_overflow (struct bfd_link_info *info, if (overflow_cutoff_limit == -1) return; - einfo ("%X%H:", abfd, section, address); + einfo ("%X%P: %H:", abfd, section, address); if (overflow_cutoff_limit >= 0 && overflow_cutoff_limit-- == 0) @@ -1438,7 +1456,7 @@ reloc_dangerous (struct bfd_link_info *info ATTRIBUTE_UNUSED, asection *section, bfd_vma address) { - einfo (_("%X%H: dangerous relocation: %s\n"), + einfo (_("%X%P: %H: dangerous relocation: %s\n"), abfd, section, address, message); } @@ -1452,7 +1470,7 @@ unattached_reloc (struct bfd_link_info *info ATTRIBUTE_UNUSED, asection *section, bfd_vma address) { - einfo (_("%X%H: reloc refers to symbol `%pT' which is not being output\n"), + einfo (_("%X%P: %H: reloc refers to symbol `%pT' which is not being output\n"), abfd, section, address, name); } @@ -1486,9 +1504,9 @@ notice (struct bfd_link_info *info, && bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE) != NULL) { if (bfd_is_und_section (section)) - einfo (_("%pB: reference to %s\n"), abfd, name); + einfo (_("%P: %pB: reference to %s\n"), abfd, name); else - einfo (_("%pB: definition of %s\n"), abfd, name); + einfo (_("%P: %pB: definition of %s\n"), abfd, name); } if (command_line.cref || nocrossref_list != NULL) |