This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Better messages for discarde section


On Tue, Jun 03, 2003 at 03:25:41PM +0100, Nick Clifton wrote:
> > +			      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.
> 

Linux's asprintf returns -1 on error. I changed it to "ok <= 0".

> 
> > --- 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.
> 

I moved it just below error_handler.

> 
> > +++ 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.

Done.

> 
> 
> > -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). 
> 

I am not sure if I have a choice here since va_copy is used, which
is not available in K&R C. Does anyone how to handle it in K&R?

Here is the new one.

Thanks.


H.J.

Attachment: binutils-discard.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]