aboutsummaryrefslogtreecommitdiff
path: root/bfd/mach-o.c
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2010-02-09 13:39:22 +0000
committerTristan Gingold <gingold@adacore.com>2010-02-09 13:39:22 +0000
commit1523fa24f7d51fecc82338e65a567346b9cef317 (patch)
tree7702e8eb177191463141d5dd0485b35d93d0fdb5 /bfd/mach-o.c
parentdadf0e9c7a2409d46fc5ff8e1b1a1c7b086dedbf (diff)
downloadfsf-binutils-gdb-1523fa24f7d51fecc82338e65a567346b9cef317.zip
fsf-binutils-gdb-1523fa24f7d51fecc82338e65a567346b9cef317.tar.gz
fsf-binutils-gdb-1523fa24f7d51fecc82338e65a567346b9cef317.tar.bz2
2010-02-09 Tristan Gingold <gingold@adacore.com>
* mach-o.c (bfd_mach_o_canonicalize_one_reloc): Adjust addend for non-external relocation.
Diffstat (limited to 'bfd/mach-o.c')
-rw-r--r--bfd/mach-o.c6
1 files changed, 6 insertions, 0 deletions
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;