2010-02-09 Tristan Gingold <gingold@adacore.com>
authorTristan Gingold <gingold@adacore.com>
Tue, 9 Feb 2010 13:39:22 +0000 (13:39 +0000)
committerTristan Gingold <gingold@adacore.com>
Tue, 9 Feb 2010 13:39:22 +0000 (13:39 +0000)
* mach-o.c (bfd_mach_o_canonicalize_one_reloc): Adjust addend for
non-external relocation.

bfd/ChangeLog
bfd/mach-o.c

index b9e08bfc91495c6b542254267d89d282300447e6..0e0646ee205836ff7fdf0859a4d4c1bae7c2b0f9 100644 (file)
@@ -1,3 +1,8 @@
+2010-02-09  Tristan Gingold  <gingold@adacore.com>
+
+       * mach-o.c (bfd_mach_o_canonicalize_one_reloc): Adjust addend for
+       non-external relocation.
+
 2010-02-09  Alan Modra  <amodra@gmail.com>
 
        * elf64-ppc.c (merge_got_entries): Move earlier in file.
index 57d774ba4afae155445e97584e0ba869e05fde69..43e1d85d00d17855f4ea3f1923b3ec3add1cd00d 100644 (file)
@@ -714,6 +714,12 @@ bfd_mach_o_canonicalize_one_reloc (bfd *abfd, char *buf,
           BFD_ASSERT (num != 0);
           BFD_ASSERT (num <= mdata->nsects);
           sym = mdata->sections[num - 1]->bfdsection->symbol_ptr_ptr;
+          /* For a symbol defined in section S, the addend (stored in the
+             binary) contains the address of the section.  To comply with
+             bfd conventio, substract the section address.
+             Use the address from the header, so that the user can modify
+             the vma of the section.  */
+          res->addend = -mdata->sections[num - 1]->addr;
           reloc.r_extern = 0;
         }
       res->sym_ptr_ptr = sym;