mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 20:28:28 +08:00
* elf32-spu.c (get_sym_h): Don't attempt to read global syms.
(process_stubs): Likewise. (discover_functions): Don't used cached symbols. (maybe_insert_function): Correct condition under which function array is realloc'd. (mark_functions_via_relocs): Delete unused variable.
This commit is contained in:
@ -1,3 +1,12 @@
|
|||||||
|
2008-06-04 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
|
* elf32-spu.c (get_sym_h): Don't attempt to read global syms.
|
||||||
|
(process_stubs): Likewise.
|
||||||
|
(discover_functions): Don't used cached symbols.
|
||||||
|
(maybe_insert_function): Correct condition under which function
|
||||||
|
array is realloc'd.
|
||||||
|
(mark_functions_via_relocs): Delete unused variable.
|
||||||
|
|
||||||
2008-05-30 Frediano Ziglio <frediano.ziglio@vodafone.com>
|
2008-05-30 Frediano Ziglio <frediano.ziglio@vodafone.com>
|
||||||
Nick Clifton <nickc@redhat.com>
|
Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
@ -448,17 +448,9 @@ get_sym_h (struct elf_link_hash_entry **hp,
|
|||||||
{
|
{
|
||||||
locsyms = (Elf_Internal_Sym *) symtab_hdr->contents;
|
locsyms = (Elf_Internal_Sym *) symtab_hdr->contents;
|
||||||
if (locsyms == NULL)
|
if (locsyms == NULL)
|
||||||
{
|
locsyms = bfd_elf_get_elf_syms (ibfd, symtab_hdr,
|
||||||
size_t symcount = symtab_hdr->sh_info;
|
symtab_hdr->sh_info,
|
||||||
|
0, NULL, NULL, NULL);
|
||||||
/* If we are reading symbols into the contents, then
|
|
||||||
read the global syms too. This is done to cache
|
|
||||||
syms for later stack analysis. */
|
|
||||||
if ((unsigned char **) locsymsp == &symtab_hdr->contents)
|
|
||||||
symcount = symtab_hdr->sh_size / symtab_hdr->sh_entsize;
|
|
||||||
locsyms = bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, 0,
|
|
||||||
NULL, NULL, NULL);
|
|
||||||
}
|
|
||||||
if (locsyms == NULL)
|
if (locsyms == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
*locsymsp = locsyms;
|
*locsymsp = locsyms;
|
||||||
@ -1133,7 +1125,6 @@ process_stubs (struct bfd_link_info *info, bfd_boolean build)
|
|||||||
Elf_Internal_Shdr *symtab_hdr;
|
Elf_Internal_Shdr *symtab_hdr;
|
||||||
asection *isec;
|
asection *isec;
|
||||||
Elf_Internal_Sym *local_syms = NULL;
|
Elf_Internal_Sym *local_syms = NULL;
|
||||||
void *psyms;
|
|
||||||
|
|
||||||
if (ibfd->xvec != &bfd_elf32_spu_vec)
|
if (ibfd->xvec != &bfd_elf32_spu_vec)
|
||||||
continue;
|
continue;
|
||||||
@ -1143,11 +1134,6 @@ process_stubs (struct bfd_link_info *info, bfd_boolean build)
|
|||||||
if (symtab_hdr->sh_info == 0)
|
if (symtab_hdr->sh_info == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Arrange to read and keep global syms for later stack analysis. */
|
|
||||||
psyms = &local_syms;
|
|
||||||
if (htab->stack_analysis)
|
|
||||||
psyms = &symtab_hdr->contents;
|
|
||||||
|
|
||||||
/* Walk over each section attached to the input bfd. */
|
/* Walk over each section attached to the input bfd. */
|
||||||
for (isec = ibfd->sections; isec != NULL; isec = isec->next)
|
for (isec = ibfd->sections; isec != NULL; isec = isec->next)
|
||||||
{
|
{
|
||||||
@ -1197,7 +1183,7 @@ process_stubs (struct bfd_link_info *info, bfd_boolean build)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Determine the reloc target section. */
|
/* Determine the reloc target section. */
|
||||||
if (!get_sym_h (&h, &sym, &sym_sec, psyms, r_indx, ibfd))
|
if (!get_sym_h (&h, &sym, &sym_sec, &local_syms, r_indx, ibfd))
|
||||||
goto error_ret_free_internal;
|
goto error_ret_free_internal;
|
||||||
|
|
||||||
stub_type = needs_ovl_stub (h, sym, sym_sec, isec, irela,
|
stub_type = needs_ovl_stub (h, sym, sym_sec, isec, irela,
|
||||||
@ -1861,10 +1847,7 @@ maybe_insert_function (asection *sec,
|
|||||||
return &sinfo->fun[i];
|
return &sinfo->fun[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++i < sinfo->num_fun)
|
if (sinfo->num_fun >= sinfo->max_fun)
|
||||||
memmove (&sinfo->fun[i + 1], &sinfo->fun[i],
|
|
||||||
(sinfo->num_fun - i) * sizeof (sinfo->fun[i]));
|
|
||||||
else if (i >= sinfo->max_fun)
|
|
||||||
{
|
{
|
||||||
bfd_size_type amt = sizeof (struct spu_elf_stack_info);
|
bfd_size_type amt = sizeof (struct spu_elf_stack_info);
|
||||||
bfd_size_type old = amt;
|
bfd_size_type old = amt;
|
||||||
@ -1878,6 +1861,10 @@ maybe_insert_function (asection *sec,
|
|||||||
memset ((char *) sinfo + old, 0, amt - old);
|
memset ((char *) sinfo + old, 0, amt - old);
|
||||||
sec_data->u.i.stack_info = sinfo;
|
sec_data->u.i.stack_info = sinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (++i < sinfo->num_fun)
|
||||||
|
memmove (&sinfo->fun[i + 1], &sinfo->fun[i],
|
||||||
|
(sinfo->num_fun - i) * sizeof (sinfo->fun[i]));
|
||||||
sinfo->fun[i].is_func = is_func;
|
sinfo->fun[i].is_func = is_func;
|
||||||
sinfo->fun[i].global = global;
|
sinfo->fun[i].global = global;
|
||||||
sinfo->fun[i].sec = sec;
|
sinfo->fun[i].sec = sec;
|
||||||
@ -2107,7 +2094,6 @@ mark_functions_via_relocs (asection *sec,
|
|||||||
{
|
{
|
||||||
Elf_Internal_Rela *internal_relocs, *irelaend, *irela;
|
Elf_Internal_Rela *internal_relocs, *irelaend, *irela;
|
||||||
Elf_Internal_Shdr *symtab_hdr;
|
Elf_Internal_Shdr *symtab_hdr;
|
||||||
Elf_Internal_Sym *syms;
|
|
||||||
void *psyms;
|
void *psyms;
|
||||||
static bfd_boolean warned;
|
static bfd_boolean warned;
|
||||||
|
|
||||||
@ -2122,7 +2108,6 @@ mark_functions_via_relocs (asection *sec,
|
|||||||
|
|
||||||
symtab_hdr = &elf_tdata (sec->owner)->symtab_hdr;
|
symtab_hdr = &elf_tdata (sec->owner)->symtab_hdr;
|
||||||
psyms = &symtab_hdr->contents;
|
psyms = &symtab_hdr->contents;
|
||||||
syms = *(Elf_Internal_Sym **) psyms;
|
|
||||||
irela = internal_relocs;
|
irela = internal_relocs;
|
||||||
irelaend = irela + sec->reloc_count;
|
irelaend = irela + sec->reloc_count;
|
||||||
for (; irela < irelaend; irela++)
|
for (; irela < irelaend; irela++)
|
||||||
@ -2402,15 +2387,18 @@ discover_functions (struct bfd_link_info *info)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
syms = (Elf_Internal_Sym *) symtab_hdr->contents;
|
if (symtab_hdr->contents != NULL)
|
||||||
if (syms == NULL)
|
|
||||||
{
|
{
|
||||||
syms = bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, 0,
|
/* Don't use cached symbols since the generic ELF linker
|
||||||
NULL, NULL, NULL);
|
code only reads local symbols, and we need globals too. */
|
||||||
symtab_hdr->contents = (void *) syms;
|
free (symtab_hdr->contents);
|
||||||
if (syms == NULL)
|
symtab_hdr->contents = NULL;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
syms = bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, 0,
|
||||||
|
NULL, NULL, NULL);
|
||||||
|
symtab_hdr->contents = (void *) syms;
|
||||||
|
if (syms == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
/* Select defined function symbols that are going to be output. */
|
/* Select defined function symbols that are going to be output. */
|
||||||
psyms = bfd_malloc ((symcount + 1) * sizeof (*psyms));
|
psyms = bfd_malloc ((symcount + 1) * sizeof (*psyms));
|
||||||
|
Reference in New Issue
Block a user