This is the mail archive of the binutils@sourceware.org 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] elf: don't modify file names used with .file/.appfile


On Fri, Jul 24, 2009 at 01:16:45PM +0100, Jan Beulich wrote:
> --- 2009-07-24/gas/config/obj-elf.c	2009-07-23 15:06:32.000000000 +0200
> +++ 2009-07-24/gas/config/obj-elf.c	2009-07-24 10:18:46.000000000 +0200
> @@ -260,9 +260,20 @@ elf_file_symbol (const char *s, int appf
>        || (symbol_rootP->bsym->flags & BSF_FILE) == 0)
>      {
>        symbolS *sym;
> +      unsigned int name_length;
>  
>        sym = symbol_new (s, absolute_section, 0, NULL);
>        symbol_set_frag (sym, &zero_address_frag);
> +
> +      name_length = strlen (s);
> +      if (name_length > strlen (S_GET_NAME (sym)))
> +	{
> +	  obstack_grow (&notes, s, name_length + 1);
> +	  S_SET_NAME (sym, obstack_finish (&notes));
> +	}
> +      else

No need for any of the above, just do the strcpy.  We know the
size allocated is large enough for the original name even when
tc_canonicalize_symbol_name trims the symbol name.

> +	strcpy ((char *)S_GET_NAME (sym), s);

Space after cast.  OK otherwise.

-- 
Alan Modra
Australia Development Lab, IBM


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