Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152549566
D4474.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D4474.diff
View Options
Index: head/contrib/elftoolchain/elfcopy/binary.c
===================================================================
--- head/contrib/elftoolchain/elfcopy/binary.c
+++ head/contrib/elftoolchain/elfcopy/binary.c
@@ -37,16 +37,6 @@
ELFTC_VCSID("$Id: binary.c 3174 2015-03-27 17:13:41Z emaste $");
-static int
-basename_length(const char *filename)
-{
- char *p;
-
- if ((p = strchr(filename, '.')) != NULL)
- return (p - filename);
- return (strlen(filename));
-}
-
/*
* Convert ELF object to `binary'. Sections with SHF_ALLOC flag set
* are copied to the result binary. The relative offsets for each section
@@ -150,6 +140,7 @@
GElf_Shdr sh;
void *content;
uint64_t off, data_start, data_end, data_size;
+ char *sym_basename, *p;
/* Reset internal section list. */
if (!TAILQ_EMPTY(&ecp->v_sec))
@@ -220,9 +211,13 @@
/* Count in .symtab and .strtab section headers. */
shtab->sz += gelf_fsize(ecp->eout, ELF_T_SHDR, 2, EV_CURRENT);
+ if ((sym_basename = strdup(ifn)) == NULL)
+ err(1, "strdup");
+ p = sym_basename;
+ while ((p = strchr(p, '.')) != NULL)
+ *p++ = '_';
#define _GEN_SYMNAME(S) do { \
- snprintf(name, sizeof(name), "%s%.*s%s", "_binary_", \
- basename_length(ifn), ifn, S); \
+ snprintf(name, sizeof(name), "%s%s%s", "_binary_", sym_basename, S); \
} while (0)
/*
@@ -244,6 +239,7 @@
finalize_external_symtab(ecp);
create_symtab_data(ecp);
#undef _GEN_SYMNAME
+ free(sym_basename);
/*
* Write the underlying ehdr. Note that it should be called
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 16, 3:12 PM (20 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31598658
Default Alt Text
D4474.diff (1 KB)
Attached To
Mode
D4474: elfcopy: include extension but replace . when converting from binary
Attached
Detach File
Event Timeline
Log In to Comment