diff options
author | emaste <emaste@FreeBSD.org> | 2016-04-20 19:13:00 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2016-04-20 19:13:00 +0000 |
commit | 0ecbc86fe5bd2501ccbd620e92ef0e4b47466519 (patch) | |
tree | b7688278df26b97e763faacc05045c7ce630a7e1 /contrib/elftoolchain | |
parent | 87a51f6af20defab7f2e741ca2e1bcb36955e7c8 (diff) | |
download | FreeBSD-src-0ecbc86fe5bd2501ccbd620e92ef0e4b47466519.zip FreeBSD-src-0ecbc86fe5bd2501ccbd620e92ef0e4b47466519.tar.gz |
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
Diffstat (limited to 'contrib/elftoolchain')
-rw-r--r-- | contrib/elftoolchain/elfcopy/binary.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/contrib/elftoolchain/elfcopy/binary.c b/contrib/elftoolchain/elfcopy/binary.c index 7c834a9..476e6c7 100644 --- a/contrib/elftoolchain/elfcopy/binary.c +++ b/contrib/elftoolchain/elfcopy/binary.c @@ -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 *ecp, int ifd, const char *ifn) 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) |