[patch]: Make xdata symbol name unique

Nick Clifton nickc@redhat.com
Fri Aug 27 08:36:00 GMT 2010


Hi Kai,

>      * config/obj-coff-seh.c (seh_max_xlbl_name): More
>      unique name generation.
>      (make_seh_text_label): Likewise.
>
> Tested for x86_64-w64-mingw32. Ok for apply?

I may be going mad here, but this looks wrong to me:

+  as_where (&filename, &lineno);
+  len = strlen (".seh_xlbl_") + strlen (c->func_name) + 9 + strlen 
(filename) + 1 + 9 + 1;
+  ret = (char*) xmalloc (len);
    if (!ret)
      as_fatal (_("Out of memory for xdata lable for %s"), c->func_name);
-  else
-    sprintf (ret, ".seh_xlbl_%s_%x", c->func_name, + c->xlbl_count);
+  sprintf (ret, ".seh_xlbl_%s_%x_%s_%x", c->func_name, + c->xlbl_count, 
filename, lineno);
+  while ((filename = strchr (ret, '\\')) != NULL)
+    *filename = '.';
+  while ((filename = strchr (ret, '/')) != NULL)
+    *filename = '.';
+  while ((filename = strchr (ret, ':')) != NULL)
+    *filename = '.';

Shouldn't the while loops be replacing characters inside the ret buffer 
and not the filename returned by as_where() ?

Cheers
   Nick



More information about the Binutils mailing list