Fix problems translating messages when a percentage sign appears at the end of a string.

PR 28051
gas	* config/tc-i386.c (offset_in_range): Reformat error messages in
	order to fix problems when translating.
	(md_assemble): Likewise.
	* messages.c (as_internal_value_out_of_range): Likewise.
	* read.c (emit_expr_with_reloc): Likewise.
	* testsuite/gas/all/overflow.l Change expected output format.
	* po/gas.pot: Regenerate.

bfd	* coff-rs6000.c (xcoff_reloc_type_tls): Reformat error messages in
	order to fix problems when translating.
	* cofflink.c (_bfd_coff_write_global_sym): Likewise.
	* elfnn-aarch64.c (_bfd_aarch64_erratum_843419_branch_to_stub):
	Likewise.
	* po/bfd.pot: Regenerate.
This commit is contained in:
Nick Clifton
2021-07-07 10:25:41 +01:00
parent 1f00b55dba
commit ffa5352c0c
11 changed files with 479 additions and 403 deletions

View File

@@ -1,3 +1,13 @@
2021-07-07 Nick Clifton <nickc@redhat.com>
PR 28051
* coff-rs6000.c (xcoff_reloc_type_tls): Reformat error messages in
order to fix problems when translating.
* cofflink.c (_bfd_coff_write_global_sym): Likewise.
* elfnn-aarch64.c (_bfd_aarch64_erratum_843419_branch_to_stub):
Likewise.
* po/bfd.pot: Regenerate.
2021-07-06 Michael Matz <matz@suse.de>
PR ld/28021

View File

@@ -3205,10 +3205,12 @@ xcoff_reloc_type_tls (bfd *input_bfd ATTRIBUTE_UNUSED,
/* FIXME: h is sometimes null, if the TLS symbol is not exported. */
if (!h)
{
char vaddr_buf[128];
sprintf_vma (vaddr_buf, rel->r_vaddr);
_bfd_error_handler
(_("%pB: TLS relocation at (0x%" BFD_VMA_FMT "x) over "
"internal symbols (C_HIDEXT) not yet possible\n"),
input_bfd, rel->r_vaddr);
(_("%pB: TLS relocation at 0x%s over internal symbols (C_HIDEXT) not yet possible\n"),
input_bfd, vaddr_buf);
return false;
}
@@ -3216,10 +3218,12 @@ xcoff_reloc_type_tls (bfd *input_bfd ATTRIBUTE_UNUSED,
/* TLS relocations must target a TLS symbol. */
if (h->smclas != XMC_TL && h->smclas != XMC_UL)
{
char vaddr_buf[128];
sprintf_vma (vaddr_buf, rel->r_vaddr);
_bfd_error_handler
(_("%pB: TLS relocation at (0x%" BFD_VMA_FMT "x) over "
"non-TLS symbol %s (0x%x)\n"),
input_bfd, rel->r_vaddr, h->root.root.string, h->smclas);
(_("%pB: TLS relocation at 0x%s over non-TLS symbol %s (0x%x)\n"),
input_bfd, vaddr_buf, h->root.root.string, h->smclas);
return false;
}
@@ -3230,10 +3234,12 @@ xcoff_reloc_type_tls (bfd *input_bfd ATTRIBUTE_UNUSED,
&& (h->flags & XCOFF_DEF_DYNAMIC) != 0)
|| (h->flags & XCOFF_IMPORT) != 0))
{
char vaddr_buf[128];
sprintf_vma (vaddr_buf, rel->r_vaddr);
_bfd_error_handler
(_("%pB: TLS local relocation at (0x%" BFD_VMA_FMT "x) over "
"imported symbol %s\n"),
input_bfd, rel->r_vaddr, h->root.root.string);
(_("%pB: TLS local relocation at 0x%s over imported symbol %s\n"),
input_bfd, vaddr_buf, h->root.root.string);
return false;
}
@@ -3638,13 +3644,17 @@ xcoff_ppc_relocate_section (bfd *output_bfd,
break;
default:
{
char vaddr_buf[128];
sprintf_vma (vaddr_buf, rel->r_vaddr);
_bfd_error_handler
(_("%pB: relocation (%d) at (0x%" BFD_VMA_FMT "x) has wrong"
" r_rsize (0x%x)\n"),
input_bfd, rel->r_type, rel->r_vaddr, rel->r_size);
(_("%pB: relocation (%d) at 0x%s has wrong r_rsize (0x%x)\n"),
input_bfd, rel->r_type, vaddr_buf, rel->r_size);
return false;
}
}
}
howto.complain_on_overflow = (rel->r_size & 0x80
? complain_overflow_signed

View File

@@ -2606,10 +2606,14 @@ _bfd_coff_write_global_sym (struct bfd_hash_entry *bh, void *data)
if (isym.n_value > (bfd_vma) 0xffffffff)
{
if (! h->root.linker_def)
{
char value_buf[128];
sprintf_vma (value_buf, isym.n_value);
_bfd_error_handler
(_("%pB: stripping non-representable symbol '%s' (value "
"%" BFD_VMA_FMT "x)"),
output_bfd, h->root.root.string, isym.n_value);
(_("%pB: stripping non-representable symbol '%s' (value 0x%s)"),
output_bfd, h->root.root.string, value_buf);
}
return true;
}
#endif

View File

@@ -5345,12 +5345,15 @@ _bfd_aarch64_erratum_843419_branch_to_stub (struct bfd_hash_entry *gen_entry,
}
else
{
char imm_buf[128];
sprintf (imm_buf, "%" BFD_VMA_FMT "x", imm);
abfd = stub_entry->target_section->owner;
_bfd_error_handler
(_("%pB: error: erratum 843419 immediate 0x%" BFD_VMA_FMT "x "
(_("%pB: error: erratum 843419 immediate 0x%s "
"out of range for ADR (input file too large) and "
"--fix-cortex-a53-843419=adr used. Run the linker with "
"--fix-cortex-a53-843419=full instead"), abfd, imm);
"--fix-cortex-a53-843419=full instead"), abfd, imm_buf);
bfd_set_error (bfd_error_bad_value);
/* This function is called inside a hashtable traversal and the error
handlers called above turn into non-fatal errors. Which means this

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: bug-binutils@gnu.org\n"
"POT-Creation-Date: 2021-07-03 15:01+0100\n"
"POT-Creation-Date: 2021-07-07 09:00+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -130,115 +130,115 @@ msgstr ""
msgid "Writing updated armap timestamp"
msgstr ""
#: bfd.c:681
#: bfd.c:687
msgid "no error"
msgstr ""
#: bfd.c:682
#: bfd.c:688
msgid "system call error"
msgstr ""
#: bfd.c:683
#: bfd.c:689
msgid "invalid bfd target"
msgstr ""
#: bfd.c:684
#: bfd.c:690
msgid "file in wrong format"
msgstr ""
#: bfd.c:685
#: bfd.c:691
msgid "archive object file in wrong format"
msgstr ""
#: bfd.c:686
#: bfd.c:692
msgid "invalid operation"
msgstr ""
#: bfd.c:687
#: bfd.c:693
msgid "memory exhausted"
msgstr ""
#: bfd.c:688
#: bfd.c:694
msgid "no symbols"
msgstr ""
#: bfd.c:689
#: bfd.c:695
msgid "archive has no index; run ranlib to add one"
msgstr ""
#: bfd.c:690
#: bfd.c:696
msgid "no more archived files"
msgstr ""
#: bfd.c:691
#: bfd.c:697
msgid "malformed archive"
msgstr ""
#: bfd.c:692
#: bfd.c:698
msgid "DSO missing from command line"
msgstr ""
#: bfd.c:693
#: bfd.c:699
msgid "file format not recognized"
msgstr ""
#: bfd.c:694
#: bfd.c:700
msgid "file format is ambiguous"
msgstr ""
#: bfd.c:695
#: bfd.c:701
msgid "section has no contents"
msgstr ""
#: bfd.c:696
#: bfd.c:702
msgid "nonrepresentable section on output"
msgstr ""
#: bfd.c:697
#: bfd.c:703
msgid "symbol needs debug section which does not exist"
msgstr ""
#: bfd.c:698
#: bfd.c:704
msgid "bad value"
msgstr ""
#: bfd.c:699
#: bfd.c:705
msgid "file truncated"
msgstr ""
#: bfd.c:700
#: bfd.c:706
msgid "file too big"
msgstr ""
#: bfd.c:701
#: bfd.c:707
msgid "sorry, cannot handle this file"
msgstr ""
#: bfd.c:702
#: bfd.c:708
#, c-format
msgid "error reading %s: %s"
msgstr ""
#: bfd.c:703
#: bfd.c:709
msgid "#<invalid error code>"
msgstr ""
#: bfd.c:1640
#: bfd.c:1646
#, c-format
msgid "BFD %s assertion fail %s:%d"
msgstr ""
#: bfd.c:1653
#: bfd.c:1659
#, c-format
msgid "BFD %s internal error, aborting at %s:%d in %s\n"
msgstr ""
#: bfd.c:1658
#: bfd.c:1664
#, c-format
msgid "BFD %s internal error, aborting at %s:%d\n"
msgstr ""
#: bfd.c:1660
#: bfd.c:1666
msgid "Please report this bug.\n"
msgstr ""
@@ -308,19 +308,29 @@ msgstr ""
msgid "%pB: TOC reloc at %#<PRIx64> to symbol `%s' with no TOC entry"
msgstr ""
#: coff-rs6000.c:3209 coff-rs6000.c:3220
msgid "%pB: TLS relocation at (0x%"
#: coff-rs6000.c:3212
#, c-format
msgid ""
"%pB: TLS relocation at 0x%s over internal symbols (C_HIDEXT) not yet "
"possible\n"
msgstr ""
#: coff-rs6000.c:3234
msgid "%pB: TLS local relocation at (0x%"
#: coff-rs6000.c:3225
#, c-format
msgid "%pB: TLS relocation at 0x%s over non-TLS symbol %s (0x%x)\n"
msgstr ""
#: coff-rs6000.c:3642 coff64-rs6000.c:1573
msgid "%pB: relocatation (%d) at (0x%"
#: coff-rs6000.c:3241
#, c-format
msgid "%pB: TLS local relocation at 0x%s over imported symbol %s\n"
msgstr ""
#: coff-rs6000.c:3905 coff64-rs6000.c:2023
#: coff-rs6000.c:3652
#, c-format
msgid "%pB: relocation (%d) at 0x%s has wrong r_rsize (0x%x)\n"
msgstr ""
#: coff-rs6000.c:3915 coff64-rs6000.c:2023
#, c-format
msgid "%pB: symbol `%s' has unrecognized smclas %d"
msgstr ""
@@ -370,7 +380,7 @@ msgstr ""
msgid "%pB: fatal: generic symbols retrieved before relaxing"
msgstr ""
#: coff-sh.c:2781 cofflink.c:2959
#: coff-sh.c:2781 cofflink.c:2963
#, c-format
msgid "%pB: illegal symbol index %ld in relocs"
msgstr ""
@@ -390,6 +400,10 @@ msgstr ""
msgid "%pB: wrong auxtype %#x for storage class %#x"
msgstr ""
#: coff64-rs6000.c:1573
msgid "%pB: relocation (%d) at (0x%"
msgstr ""
#: coffcode.h:986
#, c-format
msgid "%pB: unable to load COMDAT section name"
@@ -560,21 +574,22 @@ msgid ""
"%pA' of %pB\n"
msgstr ""
#: cofflink.c:2610
msgid "%pB: stripping non-representable symbol '%s' (value %"
#: cofflink.c:2614
#, c-format
msgid "%pB: stripping non-representable symbol '%s' (value 0x%s)"
msgstr ""
#: cofflink.c:2728
#: cofflink.c:2732
#, c-format
msgid "%pB: %pA: reloc overflow: %#x > 0xffff"
msgstr ""
#: cofflink.c:2736
#: cofflink.c:2740
#, c-format
msgid "%pB: warning: %pA: line number overflow: %#x > 0xffff"
msgstr ""
#: cofflink.c:3127
#: cofflink.c:3131
#, c-format
msgid "%pB: bad reloc address %#<PRIx64> in section `%pA'"
msgstr ""
@@ -1364,7 +1379,7 @@ msgstr ""
msgid "GNU_RETAIN section is supported only by GNU and FreeBSD targets"
msgstr ""
#: elf.c:12850 elf64-sparc.c:123 elfcode.h:1504
#: elf.c:12850 elf64-sparc.c:123 elfcode.h:1505
#, c-format
msgid "%pB(%pA): relocation %d has invalid symbol index %ld"
msgstr ""
@@ -4911,22 +4926,22 @@ msgstr ""
msgid "%F%pB: PC-relative offset overflow in GOT PLT entry for `%s'\n"
msgstr ""
#: elfcode.h:329
#: elfcode.h:330
#, c-format
msgid "warning: %pB has a section extending past end of file"
msgstr ""
#: elfcode.h:775
#: elfcode.h:776
#, c-format
msgid "warning: %pB has a corrupt string table index - ignoring"
msgstr ""
#: elfcode.h:819
#: elfcode.h:820
#, c-format
msgid "warning: %pB has a program header with invalid alignment"
msgstr ""
#: elfcode.h:1244
#: elfcode.h:1245
#, c-format
msgid "%pB: version count (%<PRId64>) does not match symbol count (%ld)"
msgstr ""
@@ -6384,7 +6399,7 @@ msgstr ""
msgid "%pB: error: debug data ends beyond end of debug directory"
msgstr ""
#: plugin.c:236
#: plugin.c:246
msgid ""
"plugin framework: out of file descriptors. Try using fewer objects/archives\n"
msgstr ""

View File

@@ -1,3 +1,14 @@
2021-07-07 Nick Clifton <nickc@redhat.com>
PR 28051
* config/tc-i386.c (offset_in_range): Reformat error messages in
order to fix problems when translating.
(md_assemble): Likewise.
* messages.c (as_internal_value_out_of_range): Likewise.
* read.c (emit_expr_with_reloc): Likewise.
* testsuite/gas/all/overflow.l Change expected output format.
* po/gas.pot: Regenerate.
2021-07-03 Nick Clifton <nickc@redhat.com>
* configure: Regenerate.

View File

@@ -2561,8 +2561,15 @@ offset_in_range (offsetT val, int size)
}
if ((val & ~mask) != 0 && (-val & ~mask) != 0)
as_warn (_("%"BFD_VMA_FMT"x shortened to %"BFD_VMA_FMT"x"),
val, val & mask);
{
char val_buf[128];
char masked_buf[128];
/* Coded this way in order to ease translation. */
sprintf_vma (val_buf, val);
sprintf_vma (masked_buf, val & mask);
as_warn (_("0x%s shortened to 0x%s"), val_buf, masked_buf);
}
return val & mask;
}
@@ -4916,8 +4923,12 @@ md_assemble (char *line)
i.types[j].bitfield.disp32s = 0;
if (i.types[j].bitfield.baseindex)
{
as_bad (_("0x%" BFD_VMA_FMT "x out of range of signed 32bit displacement"),
exp->X_add_number);
char number_buf[128];
/* Coded this way in order to allow for ease of translation. */
sprintf_vma (number_buf, exp->X_add_number);
as_bad (_("0x%s out of range of signed 32bit displacement"),
number_buf);
return;
}
}

View File

@@ -366,9 +366,15 @@ as_internal_value_out_of_range (const char *prefix,
offsetT max,
const char *file,
unsigned line,
int bad)
bool bad)
{
const char * err;
/* These buffer sizes are excessive, but better to be safe than sorry.
Note - these buffers are used in order to make the error message
string translateable. */
char val_buf [128];
char min_buf [128];
char max_buf [128];
if (prefix == NULL)
prefix = "";
@@ -380,41 +386,38 @@ as_internal_value_out_of_range (const char *prefix,
if (max <= 1)
abort ();
/* xgettext:c-format */
err = _("%s out of domain (%" BFD_VMA_FMT "d is not a multiple of %" \
BFD_VMA_FMT "d)");
if (bad)
as_bad_where (file, line, err, prefix, val, right);
else
as_warn_where (file, line, err, prefix, val, right);
return;
}
sprintf (val_buf, "%" BFD_VMA_FMT "d", val);
sprintf (min_buf, "%" BFD_VMA_FMT "d", right);
if ( val < HEX_MAX_THRESHOLD
/* xgettext:c-format */
err = _("%s out of domain (%s is not a multiple of %s)");
if (bad)
as_bad_where (file, line, err, prefix, val_buf, min_buf);
else
as_warn_where (file, line, err, prefix, val_buf, min_buf);
}
else if ( val < HEX_MAX_THRESHOLD
&& min < HEX_MAX_THRESHOLD
&& max < HEX_MAX_THRESHOLD
&& val > HEX_MIN_THRESHOLD
&& min > HEX_MIN_THRESHOLD
&& max > HEX_MIN_THRESHOLD)
{
/* xgettext:c-format */
err = _("%s out of range (%" BFD_VMA_FMT "d is not between %" \
BFD_VMA_FMT "d and %" BFD_VMA_FMT "d)");
sprintf (val_buf, "%" BFD_VMA_FMT "d", val);
sprintf (min_buf, "%" BFD_VMA_FMT "d", min);
sprintf (max_buf, "%" BFD_VMA_FMT "d", max);
/* xgettext:c-format. */
err = _("%s out of range (%s is not between %s and %s)");
if (bad)
as_bad_where (file, line, err, prefix, val, min, max);
as_bad_where (file, line, err, prefix, val_buf, min_buf, max_buf);
else
as_warn_where (file, line, err, prefix, val, min, max);
as_warn_where (file, line, err, prefix, val_buf, min_buf, max_buf);
}
else
{
char val_buf [sizeof (val) * 3 + 2];
char min_buf [sizeof (val) * 3 + 2];
char max_buf [sizeof (val) * 3 + 2];
if (sizeof (val) > sizeof (bfd_vma))
abort ();
sprintf_vma (val_buf, (bfd_vma) val);
sprintf_vma (min_buf, (bfd_vma) min);
sprintf_vma (max_buf, (bfd_vma) max);
@@ -437,7 +440,7 @@ as_warn_value_out_of_range (const char *prefix,
const char *file,
unsigned line)
{
as_internal_value_out_of_range (prefix, value, min, max, file, line, 0);
as_internal_value_out_of_range (prefix, value, min, max, file, line, false);
}
void
@@ -448,5 +451,5 @@ as_bad_value_out_of_range (const char *prefix,
const char *file,
unsigned line)
{
as_internal_value_out_of_range (prefix, value, min, max, file, line, 1);
as_internal_value_out_of_range (prefix, value, min, max, file, line, true);
}

File diff suppressed because it is too large Load Diff

View File

@@ -4546,9 +4546,14 @@ emit_expr_with_reloc (expressionS *exp,
use = get & unmask;
if ((get & mask) != 0 && (-get & mask) != 0)
{
char get_buf[128];
char use_buf[128];
/* These buffers help to ease the translation of the warning message. */
sprintf_vma (get_buf, get);
sprintf_vma (use_buf, use);
/* Leading bits contain both 0s & 1s. */
as_warn (_("value 0x%" BFD_VMA_FMT "x truncated to 0x%" BFD_VMA_FMT "x"),
get, use);
as_warn (_("value 0x%s truncated to 0x%s"), get_buf, use_buf);
}
/* Put bytes in right order. */
md_number_to_chars (p, use, (int) nbytes);

View File

@@ -1,8 +1,8 @@
.*: Assembler messages:
.*:5: Warning: .* (0x)?100 truncated to (0x)?0
.*:6: Warning: .* (0x)?101 truncated to (0x)?1
.*:11: Warning: .* (0x)?f+00 truncated to (0x)?0
.*:12: Warning: .* (0x)?f+eff truncated to (0x)?ff
.*:5: Warning: .* 0x0+100 truncated to 0x0+0
.*:6: Warning: .* 0x0+101 truncated to 0x0+1
.*:11: Warning: .* 0xf+00 truncated to 0x0+0
.*:12: Warning: .* 0xf+eff truncated to 0x0+ff
.*:17: Error: .* (256|(0x)?100) too large .*
.*:18: Error: .* (257|(0x)?101) too large .*
.*:23: Error: .* (0x)?f+00 too large .*