From: Tristan Gingold Date: Tue, 9 Feb 2010 13:39:22 +0000 (+0000) Subject: 2010-02-09 Tristan Gingold X-Git-Tag: gdb_7_1-2010-02-18-branchpoint~128 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1523fa24f7d51fecc82338e65a567346b9cef317;p=external%2Fbinutils.git 2010-02-09 Tristan Gingold * mach-o.c (bfd_mach_o_canonicalize_one_reloc): Adjust addend for non-external relocation. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b9e08bf..0e0646e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2010-02-09 Tristan Gingold + + * mach-o.c (bfd_mach_o_canonicalize_one_reloc): Adjust addend for + non-external relocation. + 2010-02-09 Alan Modra * elf64-ppc.c (merge_got_entries): Move earlier in file. diff --git a/bfd/mach-o.c b/bfd/mach-o.c index 57d774b..43e1d85 100644 --- a/bfd/mach-o.c +++ b/bfd/mach-o.c @@ -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;