svn commit: r298361 - head/contrib/elftoolchain/elfcopy
Ed Maste
emaste at FreeBSD.org
Wed Apr 20 19:13:02 UTC 2016
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)
More information about the svn-src-head
mailing list