[PATCH] elf: don't modify file names used with .file/.appfile
Alan Modra
amodra@bigpond.net.au
Sat Jul 25 08:52:00 GMT 2009
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 (¬es, s, name_length + 1);
> + S_SET_NAME (sym, obstack_finish (¬es));
> + }
> + 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
More information about the Binutils
mailing list