clang errors out about use of undefined variables when building
binutils-2.17.
In elf.c, do not increment `s' before it is initialized. At the time
of the increment, `s' is otherwise unused anyway.
In elflink.c, initialize sec_contents and l_sec_contents to make
sure that the free(sec_contents) and free(l_sec_contents) are called
on valid pointers.
ok?
Index: gnu/usr.bin/binutils-2.17/bfd/elf.c
===================================================================
RCS file: /cvs/src/gnu/usr.bin/binutils-2.17/bfd/elf.c,v
retrieving revision 1.10
diff -u -p -r1.10 elf.c
--- gnu/usr.bin/binutils-2.17/bfd/elf.c 26 Jul 2016 02:38:12 -0000 1.10
+++ gnu/usr.bin/binutils-2.17/bfd/elf.c 31 Jul 2016 14:54:14 -0000
@@ -8617,7 +8617,7 @@ _bfd_elf_get_synthetic_symtab (bfd *abfd
count = relplt->size / hdr->sh_entsize;
size = count * sizeof (asymbol);
p = relplt->relocation;
- for (i = 0; i < count; i++, s++, p++)
+ for (i = 0; i < count; i++, p++)
size += strlen ((*p->sym_ptr_ptr)->name) + sizeof ("@plt");
s = *ret = bfd_malloc (size);
Index: gnu/usr.bin/binutils-2.17/bfd/elflink.c
===================================================================
RCS file: /cvs/src/gnu/usr.bin/binutils-2.17/bfd/elflink.c,v
retrieving revision 1.17
diff -u -p -r1.17 elflink.c
--- gnu/usr.bin/binutils-2.17/bfd/elflink.c 22 Jun 2016 13:29:14 -0000
1.17
+++ gnu/usr.bin/binutils-2.17/bfd/elflink.c 31 Jul 2016 14:54:15 -0000
@@ -9862,7 +9862,7 @@ _bfd_elf_section_already_linked (bfd *ab
abfd, sec);
else if (sec->size != 0)
{
- bfd_byte *sec_contents, *l_sec_contents;
+ bfd_byte *sec_contents = NULL, *l_sec_contents = NULL;
if (!bfd_malloc_and_get_section (abfd, sec, &sec_contents))
(*_bfd_error_handler)