aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2010-07-29 07:35:58 +0000
committerAlan Modra <amodra@gmail.com>2010-07-29 07:35:58 +0000
commitd62b368413a6f5831aa2dc4a9795702e2889084b (patch)
treee268fec163a4c7e07f4388a411d4d4c3096aa72f /bfd
parent67aceb73d6db8ad73a4519b2fc7a6fd58c30d447 (diff)
downloadfsf-binutils-gdb-d62b368413a6f5831aa2dc4a9795702e2889084b.zip
fsf-binutils-gdb-d62b368413a6f5831aa2dc4a9795702e2889084b.tar.gz
fsf-binutils-gdb-d62b368413a6f5831aa2dc4a9795702e2889084b.tar.bz2
* elf64-ppc.c (ppc64_elf_edit_toc): Always adjust local syms in
.toc section, even when none are used in relocs.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf64-ppc.c56
2 files changed, 31 insertions, 30 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index cc36cfa..81379db 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2010-07-29 Alan Modra <amodra@gmail.com>
+
+ * elf64-ppc.c (ppc64_elf_edit_toc): Always adjust local syms in
+ .toc section, even when none are used in relocs.
+
2010-07-27 Maciej W. Rozycki <macro@codesourcery.com>
* elfxx-mips.h: Include "elf/mips.h".
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index b97bd3a..f2c50d5 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -8248,6 +8248,7 @@ ppc64_elf_edit_toc (struct bfd_link_info *info)
{
bfd_byte *contents, *src;
unsigned long off;
+ Elf_Internal_Sym *sym;
bfd_boolean local_toc_syms = FALSE;
/* Shuffle the toc contents, and at the same time convert the
@@ -8292,7 +8293,6 @@ ppc64_elf_edit_toc (struct bfd_link_info *info)
unsigned long r_symndx;
asection *sym_sec;
struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
bfd_vma val;
r_type = ELF64_R_TYPE (rel->r_info);
@@ -8371,38 +8371,34 @@ ppc64_elf_edit_toc (struct bfd_link_info *info)
/* We shouldn't have local or global symbols defined in the TOC,
but handle them anyway. */
- if (local_toc_syms)
- {
- Elf_Internal_Sym *sym;
-
- for (sym = local_syms;
- sym < local_syms + symtab_hdr->sh_info;
- ++sym)
- if (sym->st_value != 0
- && bfd_section_from_elf_index (ibfd, sym->st_shndx) == toc)
- {
- unsigned long i;
-
- if (sym->st_value > toc->rawsize)
- i = toc->rawsize >> 3;
- else
- i = sym->st_value >> 3;
+ for (sym = local_syms;
+ sym < local_syms + symtab_hdr->sh_info;
+ ++sym)
+ if (sym->st_value != 0
+ && bfd_section_from_elf_index (ibfd, sym->st_shndx) == toc)
+ {
+ unsigned long i;
- if ((skip[i] & (ref_from_discarded | can_optimize)) != 0)
- {
- (*_bfd_error_handler)
- (_("%s defined on removed toc entry"),
- bfd_elf_sym_name (ibfd, symtab_hdr, sym, NULL));
- do
- ++i;
- while ((skip[i] & (ref_from_discarded | can_optimize)));
- sym->st_value = (bfd_vma) i << 3;
- }
+ if (sym->st_value > toc->rawsize)
+ i = toc->rawsize >> 3;
+ else
+ i = sym->st_value >> 3;
- sym->st_value -= skip[i];
- symtab_hdr->contents = (unsigned char *) local_syms;
+ if ((skip[i] & (ref_from_discarded | can_optimize)) != 0)
+ {
+ if (local_toc_syms)
+ (*_bfd_error_handler)
+ (_("%s defined on removed toc entry"),
+ bfd_elf_sym_name (ibfd, symtab_hdr, sym, NULL));
+ do
+ ++i;
+ while ((skip[i] & (ref_from_discarded | can_optimize)));
+ sym->st_value = (bfd_vma) i << 3;
}
- }
+
+ sym->st_value -= skip[i];
+ symtab_hdr->contents = (unsigned char *) local_syms;
+ }
/* Adjust any global syms defined in this toc input section. */
if (toc_inf.global_toc_syms)