Author: emaste
Date: Wed Apr 20 19:13:00 2016
New Revision: 298361
URL: https://svnweb.freebsd.org/changeset/base/298361

Log:
  elfcopy: map all !alnum characters to '_' in binary input symbol names
  
  This matches bfd and gold.
  
  Obtained from:        ELF Tool Chain r3445
  Sponsored by: The FreeBSD Foundation

Modified:
  head/contrib/elftoolchain/elfcopy/binary.c

Modified: head/contrib/elftoolchain/elfcopy/binary.c
==============================================================================
--- head/contrib/elftoolchain/elfcopy/binary.c  Wed Apr 20 18:48:39 2016        
(r298360)
+++ head/contrib/elftoolchain/elfcopy/binary.c  Wed Apr 20 19:13:00 2016        
(r298361)
@@ -26,6 +26,7 @@
 
 #include <sys/param.h>
 #include <sys/stat.h>
+#include <ctype.h>
 #include <err.h>
 #include <gelf.h>
 #include <stdio.h>
@@ -213,9 +214,9 @@ create_elf_from_binary(struct elfcopy *e
 
        if ((sym_basename = strdup(ifn)) == NULL)
                err(1, "strdup");
-       p = sym_basename;
-       while ((p = strchr(p, '.')) != NULL)
-               *p++ = '_';
+       for (p = sym_basename; *p != '\0'; p++)
+               if (!isalnum(*p))
+                       *p = '_';
 #define        _GEN_SYMNAME(S) do {                                            
\
        snprintf(name, sizeof(name), "%s%s%s", "_binary_", sym_basename, S); \
 } while (0)
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to