This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Fix linker undefined_symbol function to report warning
- From: Ian Lance Taylor <ian at airs dot com>
- To: binutils at sourceware dot org
- Date: 12 Aug 2003 09:47:46 -0700
- Subject: Fix linker undefined_symbol function to report warning
I checked in this patch so that the linker undefined_symbol function
would report `warning' when it is only issuing a warning. I also
fixed the function to consistently set the failure flag--before, it
would fail to set it in certain cases when the same symbol was
reported several times. I also changed the parameter name from
`fatal' to `error', to be more consistent with linker usage of the
terms fatal and error.
Ian
2003-08-12 Ian Lance Taylor <ian@airs.com>
* ldmain.c (undefined_symbol): Change parameter name from `fatal'
to `error'. If only a warning, put warning in the reported
string. Consistently set failure flag when not a warning.
Index: ldmain.c
===================================================================
RCS file: /cvs/src/src/ld/ldmain.c,v
retrieving revision 1.72
diff -u -p -r1.72 ldmain.c
--- ldmain.c 28 Jun 2003 05:28:54 -0000 1.72
+++ ldmain.c 12 Aug 2003 16:44:42 -0000
@@ -1268,7 +1268,7 @@ undefined_symbol (struct bfd_link_info *
bfd *abfd,
asection *section,
bfd_vma address,
- bfd_boolean fatal ATTRIBUTE_UNUSED)
+ bfd_boolean error)
{
static char *error_name;
static unsigned int error_count;
@@ -1311,27 +1311,47 @@ undefined_symbol (struct bfd_link_info *
{
if (error_count < MAX_ERRORS_IN_A_ROW)
{
- einfo (_("%C: undefined reference to `%T'\n"),
- abfd, section, address, name);
- if (fatal)
- einfo ("%X");
+ if (error)
+ einfo (_("%X%C: undefined reference to `%T'\n"),
+ abfd, section, address, name);
+ else
+ einfo (_("%C: warning: undefined reference to `%T'\n"),
+ abfd, section, address, name);
}
else if (error_count == MAX_ERRORS_IN_A_ROW)
- einfo (_("%D: more undefined references to `%T' follow\n"),
- abfd, section, address, name);
+ {
+ if (error)
+ einfo (_("%X%D: more undefined references to `%T' follow\n"),
+ abfd, section, address, name);
+ else
+ einfo (_("%D: warning: more undefined references to `%T' follow\n"),
+ abfd, section, address, name);
+ }
+ else if (error)
+ einfo ("%X");
}
else
{
if (error_count < MAX_ERRORS_IN_A_ROW)
{
- einfo (_("%B: undefined reference to `%T'\n"),
- abfd, name);
- if (fatal)
- einfo ("%X");
+ if (error)
+ einfo (_("%X%B: undefined reference to `%T'\n"),
+ abfd, name);
+ else
+ einfo (_("%B: warning: undefined reference to `%T'\n"),
+ abfd, name);
}
else if (error_count == MAX_ERRORS_IN_A_ROW)
- einfo (_("%B: more undefined references to `%T' follow\n"),
- abfd, name);
+ {
+ if (error)
+ einfo (_("%X%B: more undefined references to `%T' follow\n"),
+ abfd, name);
+ else
+ einfo (_("%B: warning: more undefined references to `%T' follow\n"),
+ abfd, name);
+ }
+ else if (error)
+ einfo ("%X");
}
return TRUE;