This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
elf64ppc.c edit_opd fix
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Cc: Yuri L Volobuev <volobuev at us dot ibm dot com>
- Date: Tue, 19 Nov 2002 17:01:40 +1030
- Subject: elf64ppc.c edit_opd fix
This fixes a problem with the emitted relocs when editing .opd during
a relocatable link.
* elf64-ppc.c (ppc64_elf_edit_opd): When deleting relocs, adjust
rel_hdr.sh_size too.
Applying mainline (the 2.13 branch doesn't edit .opd during ld -r).
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.71
diff -u -p -r1.71 elf64-ppc.c
--- bfd/elf64-ppc.c 12 Nov 2002 07:55:43 -0000 1.71
+++ bfd/elf64-ppc.c 19 Nov 2002 06:22:38 -0000
@@ -3866,6 +3866,11 @@ ppc64_elf_edit_opd (obfd, info)
sec->_cooked_size = wptr - sec->contents;
sec->reloc_count = write_rel - relstart;
+ /* Fudge the size too, as this is used later in
+ elf_bfd_final_link if we are emitting relocs. */
+ elf_section_data (sec)->rel_hdr.sh_size
+ = sec->reloc_count * elf_section_data (sec)->rel_hdr.sh_entsize;
+ BFD_ASSERT (elf_section_data (sec)->rel_hdr2 == NULL);
}
else if (elf_section_data (sec)->relocs != relstart)
free (relstart);
--
Alan Modra
IBM OzLabs - Linux Technology Centre