mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 18:08:24 +08:00
objcopy add-symbol uninitialised struct
* objcopy.c: Formatting, whitespace throughout. (copy_main): Init newsym->othersym. (parse_symflags): Make len a size_t. Adjust uses.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2016-05-31 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* objcopy.c: Formatting, whitespace throughout.
|
||||||
|
(copy_main): Init newsym->othersym.
|
||||||
|
(parse_symflags): Make len a size_t. Adjust uses.
|
||||||
|
|
||||||
2016-05-25 H.J. Lu <hongjiu.lu@intel.com>
|
2016-05-25 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
PR binutils/14625
|
PR binutils/14625
|
||||||
|
@ -757,7 +757,7 @@ parse_symflags (const char *s, char **other)
|
|||||||
{
|
{
|
||||||
flagword ret;
|
flagword ret;
|
||||||
const char *snext;
|
const char *snext;
|
||||||
int len;
|
size_t len;
|
||||||
|
|
||||||
ret = BSF_NO_FLAGS;
|
ret = BSF_NO_FLAGS;
|
||||||
|
|
||||||
@ -772,12 +772,14 @@ parse_symflags (const char *s, char **other)
|
|||||||
++snext;
|
++snext;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PARSE_FLAG(fname,fval) \
|
#define PARSE_FLAG(fname, fval) \
|
||||||
else if (len == (int) sizeof fname - 1 && strncasecmp (fname, s, len) == 0) \
|
else if (len == sizeof fname - 1 \
|
||||||
|
&& strncasecmp (fname, s, len) == 0) \
|
||||||
ret |= fval
|
ret |= fval
|
||||||
|
|
||||||
#define PARSE_OTHER(fname,fval) \
|
#define PARSE_OTHER(fname, fval) \
|
||||||
else if (len >= (int) sizeof fname && strncasecmp (fname, s, sizeof fname - 1) == 0) \
|
else if (len >= sizeof fname \
|
||||||
|
&& strncasecmp (fname, s, sizeof fname - 1) == 0) \
|
||||||
fval = xstrndup (s + sizeof fname - 1, len - sizeof fname + 1)
|
fval = xstrndup (s + sizeof fname - 1, len - sizeof fname + 1)
|
||||||
|
|
||||||
if (0) ;
|
if (0) ;
|
||||||
@ -1333,9 +1335,9 @@ need_sym_before (struct addsym_node **node, const char *sym)
|
|||||||
static asymbol *
|
static asymbol *
|
||||||
create_new_symbol (struct addsym_node *ptr, bfd *obfd)
|
create_new_symbol (struct addsym_node *ptr, bfd *obfd)
|
||||||
{
|
{
|
||||||
asymbol *sym = bfd_make_empty_symbol(obfd);
|
asymbol *sym = bfd_make_empty_symbol (obfd);
|
||||||
|
|
||||||
bfd_asymbol_name(sym) = ptr->symdef;
|
bfd_asymbol_name (sym) = ptr->symdef;
|
||||||
sym->value = ptr->symval;
|
sym->value = ptr->symval;
|
||||||
sym->flags = ptr->flags;
|
sym->flags = ptr->flags;
|
||||||
if (ptr->section)
|
if (ptr->section)
|
||||||
@ -3141,7 +3143,7 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
|
|||||||
/* All went well. */
|
/* All went well. */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
loser:
|
loser:
|
||||||
status = 1;
|
status = 1;
|
||||||
bfd_nonfatal_message (NULL, obfd, osection, err);
|
bfd_nonfatal_message (NULL, obfd, osection, err);
|
||||||
}
|
}
|
||||||
@ -4127,6 +4129,7 @@ copy_main (int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
t = strchr (t + 1, ',');
|
t = strchr (t + 1, ',');
|
||||||
|
newsym->othersym = NULL;
|
||||||
if (t)
|
if (t)
|
||||||
newsym->flags = parse_symflags (t+1, &newsym->othersym);
|
newsym->flags = parse_symflags (t+1, &newsym->othersym);
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user