Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Apr 2016 19:13:00 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r298361 - head/contrib/elftoolchain/elfcopy
Message-ID:  <201604201913.u3KJD0rr052589@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604201913.u3KJD0rr052589>