aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2002-09-20 05:54:41 +0000
committerH.J. Lu <hjl.tools@gmail.com>2002-09-20 05:54:41 +0000
commit2243deae67bead2b61b88bdd123502d71880e8ad (patch)
tree1f973981d399297b2a0c727d682f1233b486e760
parentf6cf69d7004da45c2a12f10e3b78290c6f40a13c (diff)
downloadgdb-2243deae67bead2b61b88bdd123502d71880e8ad.zip
gdb-2243deae67bead2b61b88bdd123502d71880e8ad.tar.gz
gdb-2243deae67bead2b61b88bdd123502d71880e8ad.tar.bz2
2002-09-19 Jakub Jelinek <jakub@redhat.com>
* elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Clear .got word even if generating R_PPC_RELATIVE reloc. (ppc_elf_relocate_section): Make sure relocation is performed if skip == -2. Clear memory at r_offset when creating dynamic relocation.
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/elf32-ppc.c23
2 files changed, 23 insertions, 8 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e697ce3..8874b8c 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,13 @@
2002-09-19 Jakub Jelinek <jakub@redhat.com>
+ * elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Clear .got word
+ even if generating R_PPC_RELATIVE reloc.
+ (ppc_elf_relocate_section): Make sure relocation is performed
+ if skip == -2. Clear memory at r_offset when creating dynamic
+ relocation.
+
+2002-09-19 Jakub Jelinek <jakub@redhat.com>
+
* reloc.c (BFD_RELOC_386_TLS_TPOFF, BFD_RELOC_386_TLS_IE,
BFD_RELOC_386_TLS_GOTIE): Add.
* bfd-in2.h, libbfd.h: Rebuilt.
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index d5ed0c4..a2a0a6d 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -2743,11 +2743,11 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
else
{
BFD_ASSERT ((h->got.offset & 1) == 0);
- bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_GLOB_DAT);
rela.r_addend = 0;
}
+ bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
bfd_elf32_swap_reloca_out (output_bfd, &rela,
((Elf32_External_Rela *) srela->contents
+ srela->reloc_count));
@@ -3287,13 +3287,19 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
+ sreloc->reloc_count));
++sreloc->reloc_count;
- /* This reloc will be computed at runtime, so there's no
- need to do anything now, unless this is a RELATIVE
- reloc in an unallocated section. */
- if (skip != -1
- || (input_section->flags & SEC_ALLOC) != 0
- || ELF32_R_TYPE (outrel.r_info) != R_PPC_RELATIVE)
+ if (skip == -1)
continue;
+
+ /* This reloc will be computed at runtime. We clear the memory
+ so that it contains predictable value. */
+ if (! skip
+ && ((input_section->flags & SEC_ALLOC) != 0
+ || ELF32_R_TYPE (outrel.r_info) != R_PPC_RELATIVE))
+ {
+ relocation = howto->pc_relative ? outrel.r_offset : 0;
+ addend = 0;
+ break;
+ }
}
/* Arithmetic adjust relocations that aren't going into a
@@ -3390,7 +3396,6 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
off &= ~1;
else
{
- bfd_put_32 (output_bfd, relocation, sgot->contents + off);
if (info->shared)
{
@@ -3412,8 +3417,10 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
srelgot->contents)
+ srelgot->reloc_count));
++srelgot->reloc_count;
+ relocation = 0;
}
+ bfd_put_32 (output_bfd, relocation, sgot->contents + off);
local_got_offsets[r_symndx] |= 1;
}