* elf64-ppc.c (ppc64_elf_edit_toc): Don't segfault on NULL
local_syms when looking for local symbols in .toc.
This commit is contained in:
parent
dd1910a2e2
commit
df22d22333
@ -1,3 +1,8 @@
|
|||||||
|
2011-02-08 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* elf64-ppc.c (ppc64_elf_edit_toc): Don't segfault on NULL
|
||||||
|
local_syms when looking for local symbols in .toc.
|
||||||
|
|
||||||
2011-02-01 Alan Modra <amodra@gmail.com>
|
2011-02-01 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* elf64-ppc.c (ppc64_elf_next_input_section): Use elf_gp value
|
* elf64-ppc.c (ppc64_elf_next_input_section): Use elf_gp value
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* PowerPC64-specific support for 64-bit ELF.
|
/* PowerPC64-specific support for 64-bit ELF.
|
||||||
Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
|
Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
|
||||||
2009, 2010 Free Software Foundation, Inc.
|
2009, 2010, 2011 Free Software Foundation, Inc.
|
||||||
Written by Linus Nordberg, Swox AB <info@swox.com>,
|
Written by Linus Nordberg, Swox AB <info@swox.com>,
|
||||||
based on elf32-ppc.c by Ian Lance Taylor.
|
based on elf32-ppc.c by Ian Lance Taylor.
|
||||||
Largely rewritten by Alan Modra.
|
Largely rewritten by Alan Modra.
|
||||||
@ -8372,34 +8372,35 @@ ppc64_elf_edit_toc (struct bfd_link_info *info)
|
|||||||
|
|
||||||
/* We shouldn't have local or global symbols defined in the TOC,
|
/* We shouldn't have local or global symbols defined in the TOC,
|
||||||
but handle them anyway. */
|
but handle them anyway. */
|
||||||
for (sym = local_syms;
|
if (local_syms != NULL)
|
||||||
sym < local_syms + symtab_hdr->sh_info;
|
for (sym = local_syms;
|
||||||
++sym)
|
sym < local_syms + symtab_hdr->sh_info;
|
||||||
if (sym->st_value != 0
|
++sym)
|
||||||
&& bfd_section_from_elf_index (ibfd, sym->st_shndx) == toc)
|
if (sym->st_value != 0
|
||||||
{
|
&& bfd_section_from_elf_index (ibfd, sym->st_shndx) == toc)
|
||||||
unsigned long i;
|
{
|
||||||
|
unsigned long i;
|
||||||
|
|
||||||
if (sym->st_value > toc->rawsize)
|
if (sym->st_value > toc->rawsize)
|
||||||
i = toc->rawsize >> 3;
|
i = toc->rawsize >> 3;
|
||||||
else
|
else
|
||||||
i = sym->st_value >> 3;
|
i = sym->st_value >> 3;
|
||||||
|
|
||||||
if ((skip[i] & (ref_from_discarded | can_optimize)) != 0)
|
if ((skip[i] & (ref_from_discarded | can_optimize)) != 0)
|
||||||
{
|
{
|
||||||
if (local_toc_syms)
|
if (local_toc_syms)
|
||||||
(*_bfd_error_handler)
|
(*_bfd_error_handler)
|
||||||
(_("%s defined on removed toc entry"),
|
(_("%s defined on removed toc entry"),
|
||||||
bfd_elf_sym_name (ibfd, symtab_hdr, sym, NULL));
|
bfd_elf_sym_name (ibfd, symtab_hdr, sym, NULL));
|
||||||
do
|
do
|
||||||
++i;
|
++i;
|
||||||
while ((skip[i] & (ref_from_discarded | can_optimize)));
|
while ((skip[i] & (ref_from_discarded | can_optimize)));
|
||||||
sym->st_value = (bfd_vma) i << 3;
|
sym->st_value = (bfd_vma) i << 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
sym->st_value -= skip[i];
|
sym->st_value -= skip[i];
|
||||||
symtab_hdr->contents = (unsigned char *) local_syms;
|
symtab_hdr->contents = (unsigned char *) local_syms;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Adjust any global syms defined in this toc input section. */
|
/* Adjust any global syms defined in this toc input section. */
|
||||||
if (toc_inf.global_toc_syms)
|
if (toc_inf.global_toc_syms)
|
||||||
|
Loading…
Reference in New Issue
Block a user