Fix use of uninitialized data in elf32-ppc.c

Joseph S. Myers joseph@codesourcery.com
Fri Jan 28 23:25:00 GMT 2011


This patch fixes nondeterministic behavior in the ppc32 linker arising
from the has_sda_refs field in struct ppc_elf_link_hash_entry not
being initialized.

Tested with no regressions with cross to powerpc-linux-gnu.  OK to
commit?

2011-01-28  Joseph Myers  <joseph@codesourcery.com>

	* elf32-ppc.c (ppc_elf_link_hash_newfunc): Initialize has_sda_refs
	field.

Index: elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.290
diff -u -p -r1.290 elf32-ppc.c
--- elf32-ppc.c	25 Oct 2010 15:54:14 -0000	1.290
+++ elf32-ppc.c	28 Jan 2011 23:22:31 -0000
@@ -2785,6 +2785,7 @@ ppc_elf_link_hash_newfunc (struct bfd_ha
       ppc_elf_hash_entry (entry)->linker_section_pointer = NULL;
       ppc_elf_hash_entry (entry)->dyn_relocs = NULL;
       ppc_elf_hash_entry (entry)->tls_mask = 0;
+      ppc_elf_hash_entry (entry)->has_sda_refs = 0;
     }
 
   return entry;

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Binutils mailing list