aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2003-06-18 03:26:22 +0000
committerAlan Modra <amodra@gmail.com>2003-06-18 03:26:22 +0000
commit0b13192e9fe3aaae7dfe98757b13a2c5515512f5 (patch)
tree393a15b0bacaee6828caa01c485a8079f78633e0 /bfd
parent56f25033dee95dbd9da1014247c048f21c21e1be (diff)
downloadbinutils-0b13192e9fe3aaae7dfe98757b13a2c5515512f5.zip
binutils-0b13192e9fe3aaae7dfe98757b13a2c5515512f5.tar.gz
binutils-0b13192e9fe3aaae7dfe98757b13a2c5515512f5.tar.bz2
* elf64-ppc.c (ppc64_elf_relocate_section): Accept a symbol on
R_PPC64_TOC relocs.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf64-ppc.c23
2 files changed, 20 insertions, 8 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f0570bb..bc40030 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2003-06-18 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_relocate_section): Accept a symbol on
+ R_PPC64_TOC relocs.
+
2003-06-17 H.J. Lu <hongjiu.lu@intel.com>
* section.c (struct sec): Put back kept_section.
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 6ac58cc..b00e41b 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -7305,12 +7305,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
unresolved_reloc = FALSE;
warned = FALSE;
- if (r_type == R_PPC64_TOC)
- {
- /* Relocation value is TOC base. */
- relocation = TOCstart + htab->stub_group[input_section->id].toc_off;
- }
- else if (r_symndx < symtab_hdr->sh_info)
+ if (r_symndx < symtab_hdr->sh_info)
{
/* It's a local symbol. */
sym = local_syms + r_symndx;
@@ -8080,6 +8075,17 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
}
break;
+ case R_PPC64_TOC:
+ /* Relocation value is TOC base. */
+ relocation = TOCstart;
+ if (r_symndx == 0)
+ relocation += htab->stub_group[input_section->id].toc_off;
+ else if (sec != NULL && !unresolved_reloc)
+ relocation += htab->stub_group[sec->id].toc_off;
+ else
+ unresolved_reloc = TRUE;
+ goto dodyn2;
+
/* TOC16 relocs. We want the offset relative to the TOC base,
which is the address of the start of the TOC plus 0x8000.
The TOC consists of sections .got, .toc, .tocbss, and .plt,
@@ -8186,7 +8192,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
break;
/* Fall thru. */
- case R_PPC64_TOC:
+ dodyn2:
if ((input_section->flags & SEC_ALLOC) == 0)
break;
@@ -8247,7 +8253,8 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
memset (&outrel, 0, sizeof outrel);
else if (h != NULL
&& !SYMBOL_REFERENCES_LOCAL (info, h)
- && !is_opd)
+ && !is_opd
+ && r_type != R_PPC64_TOC)
outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
else
{