This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: Better messages for discarde section
- From: Nick Clifton <nickc at redhat dot com>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: binutils at sources dot redhat dot com
- Date: Tue, 03 Jun 2003 15:25:41 +0100
- Subject: Re: PATCH: Better messages for discarde section
- References: <20030530131718.A9042@lucon.org>
Hi H.J.
> Linker messages for definitions in discarde sections are the same
> as the real undefined symbols. This patch makes it clear that
> the definition is discarded.
There are a couple of problems with this patch:
> + ok = asprintf (&buf, "local symbol %d",
> + count++);
> + if (ok == -1)
> + buf = (char *) "local symbol";
asprintf() returns 0 if it failed to allocate the memory, not -1.
> --- binutils/include/bfdlink.h.discard 2003-05-21 14:36:18.000000000 -0700
> +++ binutils/include/bfdlink.h 2003-05-30 11:56:02.000000000 -0700
> @@ -643,4 +643,7 @@ struct bfd_elf_version_tree
> int used;
> };
>
> +/* Identifiers of linker error messages. */
> +#define LD_DEFINITION_IN_DISCARDED_SECTION 1
Since this is defining a value to be passed as the 'id' field of the
error_handler function in the bfd_link_callbacks structure, it really
ought to be defined near where the error_handler field is defined,
rather than at the end of the function.
> +++ binutils/ld/ldmisc.c 2003-05-30 13:06:52.000000000 -0700
> @@ -22,6 +22,7 @@
> 02111-1307, USA. */
>
> #include "bfd.h"
> +#include "bfdlink.h"
You are adding a dependency in ldmisc.c. You should run "make dep" to
update ld/Makefile.am to reflect this.
> -error_handler VPARAMS ((int id ATTRIBUTE_UNUSED, const char *fmt, ...))
> +error_handler (int id, const char *fmt, ...)
> {
> - VA_OPEN (arg, fmt);
> - VA_FIXEDARG (arg, const char *, fmt);
Please do not remove the V.... macros. We have not switched over to
using IsoC. (Well not yet anyway).
Cheers
Nick