From: Chung-Lin Tang Date: Thu, 20 Feb 2014 05:40:21 +0000 (-0800) Subject: 2014-02-20 Chung-Lin Tang X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d9972968c1d99f7a159812296a59b1ab68e5b36d;hp=1b281443749cb7e76ab32377c9130eb43adea618;p=binutils-gdb.git 2014-02-20 Chung-Lin Tang * elf32-nios2.c (nios2_elf32_relocate_section): Fix calculation of GOTOFF relocations. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cbeec9bbd0b..c5868efcaee 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2014-02-20 Chung-Lin Tang + + * elf32-nios2.c (nios2_elf32_relocate_section): Fix calculation + of GOTOFF relocations. + 2014-02-19 Igor Zamyatin H.J. Lu diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c index b6a60ff96c1..a7547e8cfb3 100644 --- a/bfd/elf32-nios2.c +++ b/bfd/elf32-nios2.c @@ -3147,9 +3147,13 @@ nios2_elf32_relocate_section (bfd *output_bfd, break; } - /* Adjust the relocation to be relative to the GOT pointer. */ - relocation -= (sgot->output_section->vma - + sgot->output_offset - got_base); + /* Note that sgot->output_offset is not involved in this + calculation. We always want the start of .got. */ + relocation -= sgot->output_section->vma; + + /* Now we adjust the relocation to be relative to the GOT pointer + (the _gp_got symbol), which possibly contains the 0x8000 bias. */ + relocation -= got_base; switch (howto->type) {