This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Fix 2 spots in ld that used uninitialized memory
- From: Jakub Jelinek <jakub at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: Mon, 19 Jun 2006 13:44:21 +0200
- Subject: [PATCH] Fix 2 spots in ld that used uninitialized memory
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
MALLOC_PERTURB_=<some_nonzero_value> causes linker failures and running ld
under valgrind reports the same. The following patch initializes the 3
fields that weren't being cleared, although later on ld relied on it.
Ok to commit?
2006-06-19 Jakub Jelinek <jakub@redhat.com>
* bfd.c (bfd_record_phdr): Clear p_align and p_align_valid fields.
* elf.c (_bfd_elf_link_hash_table_init): Clear hplt field.
--- bfd/bfd.c.jj 2006-06-15 14:31:01.000000000 +0200
+++ bfd/bfd.c 2006-06-19 10:47:58.000000000 +0200
@@ -1336,6 +1336,8 @@ bfd_record_phdr (bfd *abfd,
m->includes_filehdr = includes_filehdr;
m->includes_phdrs = includes_phdrs;
m->count = count;
+ m->p_align_valid = FALSE;
+ m->p_align = 0;
if (count > 0)
memcpy (m->sections, secs, count * sizeof (asection *));
--- bfd/elf.c.jj 2006-06-19 10:57:51.000000000 +0200
+++ bfd/elf.c 2006-06-19 10:57:51.000000000 +0200
@@ -1579,6 +1579,7 @@ _bfd_elf_link_hash_table_init
table->bucketcount = 0;
table->needed = NULL;
table->hgot = NULL;
+ table->hplt = NULL;
table->merge_info = NULL;
memset (&table->stab_info, 0, sizeof (table->stab_info));
memset (&table->eh_info, 0, sizeof (table->eh_info));
Jakub