public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [committed/darwin]: Fix uninitialized variable
@ 2010-02-08  9:13 Tristan Gingold
  0 siblings, 0 replies; only message in thread
From: Tristan Gingold @ 2010-02-08  9:13 UTC (permalink / raw)
  To: binutils

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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-02-08  9:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-08  9:13 [committed/darwin]: Fix uninitialized variable Tristan Gingold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).