mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-23 03:29:47 +08:00
2009-04-19 Peter O'Gorman <binutils@mlists.thewrittenword.com>
Alan Modra <amodra@bigpond.net.au> Dave Korn <dave.korn.cygwin@gmail.com> * peXXigen.c (_bfd_XXi_swap_sym_in): Fix name handling w.r.t long names and non-NUL-terminated strings.
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
2009-04-19 Peter O'Gorman <binutils@mlists.thewrittenword.com>
|
||||||
|
Alan Modra <amodra@bigpond.net.au>
|
||||||
|
Dave Korn <dave.korn.cygwin@gmail.com>
|
||||||
|
|
||||||
|
* peXXigen.c (_bfd_XXi_swap_sym_in): Fix name handling w.r.t
|
||||||
|
long names and non-NUL-terminated strings.
|
||||||
|
|
||||||
2009-04-17 H.J. Lu <hongjiu.lu@intel.com>
|
2009-04-17 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
* bfd-in2.h: Regenerated.
|
* bfd-in2.h: Regenerated.
|
||||||
|
@ -129,6 +129,9 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1)
|
|||||||
they will be handled somewhat correctly in the bfd code. */
|
they will be handled somewhat correctly in the bfd code. */
|
||||||
if (in->n_sclass == C_SECTION)
|
if (in->n_sclass == C_SECTION)
|
||||||
{
|
{
|
||||||
|
char namebuf[SYMNMLEN + 1];
|
||||||
|
const char *name;
|
||||||
|
|
||||||
in->n_value = 0x0;
|
in->n_value = 0x0;
|
||||||
|
|
||||||
/* Create synthetic empty sections as needed. DJ */
|
/* Create synthetic empty sections as needed. DJ */
|
||||||
@ -136,33 +139,38 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1)
|
|||||||
{
|
{
|
||||||
asection *sec;
|
asection *sec;
|
||||||
|
|
||||||
for (sec = abfd->sections; sec; sec = sec->next)
|
name = _bfd_coff_internal_syment_name (abfd, in, namebuf);
|
||||||
{
|
if (name == NULL)
|
||||||
if (strcmp (sec->name, in->n_name) == 0)
|
/* FIXME: Return error. */
|
||||||
{
|
abort ();
|
||||||
in->n_scnum = sec->target_index;
|
sec = bfd_get_section_by_name (abfd, name);
|
||||||
break;
|
if (sec != NULL)
|
||||||
}
|
in->n_scnum = sec->target_index;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in->n_scnum == 0)
|
if (in->n_scnum == 0)
|
||||||
{
|
{
|
||||||
int unused_section_number = 0;
|
int unused_section_number = 0;
|
||||||
asection *sec;
|
asection *sec;
|
||||||
char *name;
|
|
||||||
flagword flags;
|
flagword flags;
|
||||||
|
|
||||||
for (sec = abfd->sections; sec; sec = sec->next)
|
for (sec = abfd->sections; sec; sec = sec->next)
|
||||||
if (unused_section_number <= sec->target_index)
|
if (unused_section_number <= sec->target_index)
|
||||||
unused_section_number = sec->target_index + 1;
|
unused_section_number = sec->target_index + 1;
|
||||||
|
|
||||||
name = bfd_alloc (abfd, (bfd_size_type) strlen (in->n_name) + 10);
|
if (name == namebuf)
|
||||||
if (name == NULL)
|
{
|
||||||
return;
|
name = bfd_alloc (abfd, strlen (namebuf) + 1);
|
||||||
strcpy (name, in->n_name);
|
if (name == NULL)
|
||||||
|
/* FIXME: Return error. */
|
||||||
|
abort ();
|
||||||
|
strcpy ((char *) name, namebuf);
|
||||||
|
}
|
||||||
flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD;
|
flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD;
|
||||||
sec = bfd_make_section_anyway_with_flags (abfd, name, flags);
|
sec = bfd_make_section_anyway_with_flags (abfd, name, flags);
|
||||||
|
if (sec == NULL)
|
||||||
|
/* FIXME: Return error. */
|
||||||
|
abort ();
|
||||||
|
|
||||||
sec->vma = 0;
|
sec->vma = 0;
|
||||||
sec->lma = 0;
|
sec->lma = 0;
|
||||||
|
Reference in New Issue
Block a user