This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[committed/darwin]: Fix uninitialized variable
- From: Tristan Gingold <gingold at adacore dot com>
- To: binutils at sourceware dot org
- Date: Mon, 8 Feb 2010 10:13:34 +0100
- Subject: [committed/darwin]: Fix uninitialized variable
Hi,
this patch fixes a stupid mistakes: r_extern was not always initialized before calling the swap_reloc_in
operation in the Mach-O backend.
Tristan.
bfd
2010-02-08 Tristan Gingold <gingold@adacore.com>
* mach-o.c (bfd_mach_o_canonicalize_one_reloc): Set reloc.r_extern
for non-scattered relocations.
Index: mach-o.c
===================================================================
RCS file: /cvs/src/src/bfd/mach-o.c,v
retrieving revision 1.52
diff -c -r1.52 mach-o.c
*** mach-o.c 26 Jan 2010 13:42:26 -0000 1.52
--- mach-o.c 8 Feb 2010 09:11:32 -0000
***************
*** 705,716 ****
res->addend = 0;
res->address = addr;
if (symnum & BFD_MACH_O_R_EXTERN)
! sym = syms + num;
else
{
BFD_ASSERT (num != 0);
BFD_ASSERT (num <= mdata->nsects);
sym = mdata->sections[num - 1]->bfdsection->symbol_ptr_ptr;
}
res->sym_ptr_ptr = sym;
reloc.r_type = BFD_MACH_O_GET_R_TYPE (symnum);
--- 705,720 ----
res->addend = 0;
res->address = addr;
if (symnum & BFD_MACH_O_R_EXTERN)
! {
! sym = syms + num;
! reloc.r_extern = 1;
! }
else
{
BFD_ASSERT (num != 0);
BFD_ASSERT (num <= mdata->nsects);
sym = mdata->sections[num - 1]->bfdsection->symbol_ptr_ptr;
+ reloc.r_extern = 0;
}
res->sym_ptr_ptr = sym;
reloc.r_type = BFD_MACH_O_GET_R_TYPE (symnum);