* ldmisc.c (vfinfo): Add %H.

* ldmain.c (reloc_overflow): Use %H rather than %C.
	(reloc_dangerous, unattached_reloc): Likewise.
This commit is contained in:
Alan Modra
2011-05-23 06:13:35 +00:00
parent 6de6a7fe35
commit 270396f296
3 changed files with 24 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2011-05-23 Alan Modra <amodra@gmail.com>
* ldmisc.c (vfinfo): Add %H.
* ldmain.c (reloc_overflow): Use %H rather than %C.
(reloc_dangerous, unattached_reloc): Likewise.
2011-05-23 Alan Modra <amodra@gmail.com> 2011-05-23 Alan Modra <amodra@gmail.com>
PR 12763 PR 12763

View File

@ -1399,7 +1399,7 @@ reloc_overflow (struct bfd_link_info *info ATTRIBUTE_UNUSED,
if (overflow_cutoff_limit == -1) if (overflow_cutoff_limit == -1)
return TRUE; return TRUE;
einfo ("%X%C:", abfd, section, address); einfo ("%X%H:", abfd, section, address);
if (overflow_cutoff_limit >= 0 if (overflow_cutoff_limit >= 0
&& overflow_cutoff_limit-- == 0) && overflow_cutoff_limit-- == 0)
@ -1451,7 +1451,7 @@ reloc_dangerous (struct bfd_link_info *info ATTRIBUTE_UNUSED,
asection *section, asection *section,
bfd_vma address) bfd_vma address)
{ {
einfo (_("%X%C: dangerous relocation: %s\n"), einfo (_("%X%H: dangerous relocation: %s\n"),
abfd, section, address, message); abfd, section, address, message);
return TRUE; return TRUE;
} }
@ -1466,7 +1466,7 @@ unattached_reloc (struct bfd_link_info *info ATTRIBUTE_UNUSED,
asection *section, asection *section,
bfd_vma address) bfd_vma address)
{ {
einfo (_("%X%C: reloc refers to symbol `%T' which is not being output\n"), einfo (_("%X%H: reloc refers to symbol `%T' which is not being output\n"),
abfd, section, address, name); abfd, section, address, name);
return TRUE; return TRUE;
} }

View File

@ -47,6 +47,7 @@
%E current bfd error or errno %E current bfd error or errno
%F error is fatal %F error is fatal
%G like %D, but only function name %G like %D, but only function name
%H like %C but in addition emit section+offset
%I filename from a lang_input_statement_type %I filename from a lang_input_statement_type
%P print program name %P print program name
%R info about a relent %R info about a relent
@ -262,6 +263,7 @@ vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
case 'C': case 'C':
case 'D': case 'D':
case 'G': case 'G':
case 'H':
/* Clever filename:linenumber with function name if possible. /* Clever filename:linenumber with function name if possible.
The arguments are a BFD, a section, and an offset. */ The arguments are a BFD, a section, and an offset. */
{ {
@ -276,6 +278,7 @@ vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
const char *functionname; const char *functionname;
unsigned int linenumber; unsigned int linenumber;
bfd_boolean discard_last; bfd_boolean discard_last;
bfd_boolean done;
abfd = va_arg (arg, bfd *); abfd = va_arg (arg, bfd *);
section = va_arg (arg, asection *); section = va_arg (arg, asection *);
@ -296,14 +299,15 @@ vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
We do not always have a line number available so if We do not always have a line number available so if
we cannot find them we print out the section name and we cannot find them we print out the section name and
offset instread. */ offset instead. */
discard_last = TRUE; discard_last = TRUE;
if (abfd != NULL if (abfd != NULL
&& bfd_find_nearest_line (abfd, section, asymbols, offset, && bfd_find_nearest_line (abfd, section, asymbols, offset,
&filename, &functionname, &filename, &functionname,
&linenumber)) &linenumber))
{ {
if (functionname != NULL && fmt[-1] == 'C') if (functionname != NULL
&& (fmt[-1] == 'C' || fmt[-1] == 'H'))
{ {
/* Detect the case where we are printing out a /* Detect the case where we are printing out a
message for the same function as the last message for the same function as the last
@ -343,15 +347,21 @@ vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
if (filename != NULL) if (filename != NULL)
fprintf (fp, "%s:", filename); fprintf (fp, "%s:", filename);
done = fmt[-1] != 'H';
if (functionname != NULL && fmt[-1] == 'G') if (functionname != NULL && fmt[-1] == 'G')
lfinfo (fp, "%T", functionname); lfinfo (fp, "%T", functionname);
else if (filename != NULL && linenumber != 0) else if (filename != NULL && linenumber != 0)
fprintf (fp, "%u", linenumber); fprintf (fp, "%u%s", linenumber, ":" + done);
else else
lfinfo (fp, "(%A+0x%v)", section, offset); done = FALSE;
} }
else else
lfinfo (fp, "%B:(%A+0x%v)", abfd, section, offset); {
lfinfo (fp, "%B:", abfd);
done = FALSE;
}
if (!done)
lfinfo (fp, "(%A+0x%v)", section, offset);
if (discard_last) if (discard_last)
{ {