This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[RFA:] Prepend "warning: " to "user" linker warnings, as ELF does.
- From: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- To: binutils at sources dot redhat dot com
- Date: Sun, 6 Feb 2005 15:33:15 +0100
- Subject: [RFA:] Prepend "warning: " to "user" linker warnings, as ELF does.
The ELF section warning construct was recentlish (2003-08-04)
changed to have "warning: " prepended, so for symmetry I suggest
all (i.e. including the a.out stabs construct) do the same (or
I'll have to submit the corresponding a/symmetric patch to
newlib). I expect even less breakage on a.out, compared to the
ELF-only change. ;-) No test-cases need be adjusted, but
forthcoming test-cases depend on this.
Since the ELF warnings go through here, that "warning: " string
would be doubled, so I removed it. Yay, removed code!
Translating "warning: " for *those* messages in ldmain.c is now
inconsistent; other "warning: " strings aren't. Should they all
be translated or left alone?
Ok to commit?
bfd:
* elflink.c (elf_link_add_object_symbols): Don't add "warning: "
prefix here.
ld:
* ldmain.c (warning_callback, warning_find_reloc): Prepend
"warning: " to warning messages.
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.129
diff -c -p -r1.129 elflink.c
*** bfd/elflink.c 3 Feb 2005 14:12:49 -0000 1.129
--- bfd/elflink.c 6 Feb 2005 14:28:23 -0000
*************** elf_link_add_object_symbols (bfd *abfd,
*** 3142,3149 ****
{
char *msg;
bfd_size_type sz;
- bfd_size_type prefix_len;
- const char * gnu_warning_prefix = _("warning: ");
name += sizeof ".gnu.warning." - 1;
--- 3142,3147 ----
*************** elf_link_add_object_symbols (bfd *abfd,
*** 3177,3192 ****
}
sz = s->size;
! prefix_len = strlen (gnu_warning_prefix);
! msg = bfd_alloc (abfd, prefix_len + sz + 1);
if (msg == NULL)
goto error_return;
! strcpy (msg, gnu_warning_prefix);
! if (! bfd_get_section_contents (abfd, s, msg + prefix_len, 0, sz))
goto error_return;
! msg[prefix_len + sz] = '\0';
if (! (_bfd_generic_link_add_one_symbol
(info, abfd, name, BSF_WARNING, s, 0, msg,
--- 3175,3188 ----
}
sz = s->size;
! msg = bfd_alloc (abfd, sz + 1);
if (msg == NULL)
goto error_return;
! if (! bfd_get_section_contents (abfd, s, msg, 0, sz))
goto error_return;
! msg[sz] = '\0';
if (! (_bfd_generic_link_add_one_symbol
(info, abfd, name, BSF_WARNING, s, 0, msg,
Index: ld/ldmain.c
===================================================================
RCS file: /cvs/src/src/ld/ldmain.c,v
retrieving revision 1.91
diff -c -p -r1.91 ldmain.c
*** ld/ldmain.c 19 Jan 2005 11:42:49 -0000 1.91
--- ld/ldmain.c 6 Feb 2005 14:28:23 -0000
*************** warning_callback (struct bfd_link_info *
*** 1200,1210 ****
return TRUE;
if (section != NULL)
! einfo ("%C: %s\n", abfd, section, address, warning);
else if (abfd == NULL)
! einfo ("%P: %s\n", warning);
else if (symbol == NULL)
! einfo ("%B: %s\n", abfd, warning);
else
{
lang_input_statement_type *entry;
--- 1200,1210 ----
return TRUE;
if (section != NULL)
! einfo ("%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 ("%B: %s%s\n", abfd, _("warning: "), warning);
else
{
lang_input_statement_type *entry;
*************** warning_callback (struct bfd_link_info *
*** 1242,1248 ****
bfd_map_over_sections (abfd, warning_find_reloc, &info);
if (! info.found)
! einfo ("%B: %s\n", abfd, warning);
if (entry == NULL)
free (asymbols);
--- 1242,1248 ----
bfd_map_over_sections (abfd, warning_find_reloc, &info);
if (! info.found)
! einfo ("%B: %s%s\n", abfd, _("warning: "), warning);
if (entry == NULL)
free (asymbols);
*************** warning_find_reloc (bfd *abfd, asection
*** 1290,1296 ****
&& 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\n", abfd, sec, q->address, info->warning);
info->found = TRUE;
break;
}
--- 1290,1297 ----
&& 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: "),
! info->warning);
info->found = TRUE;
break;
}
brgds, H-P