diff options
author | Chung-Lin Tang <cltang@codesourcery.com> | 2014-02-19 21:40:21 -0800 |
---|---|---|
committer | Chung-Lin Tang <cltang@codesourcery.com> | 2014-02-19 21:40:21 -0800 |
commit | d9972968c1d99f7a159812296a59b1ab68e5b36d (patch) | |
tree | 570435da34a813c5dd82c9f35e87505210213d46 /bfd/elf32-nios2.c | |
parent | 1b281443749cb7e76ab32377c9130eb43adea618 (diff) | |
download | gdb-d9972968c1d99f7a159812296a59b1ab68e5b36d.zip gdb-d9972968c1d99f7a159812296a59b1ab68e5b36d.tar.gz gdb-d9972968c1d99f7a159812296a59b1ab68e5b36d.tar.bz2 |
2014-02-20 Chung-Lin Tang <cltang@codesourcery.com>
* elf32-nios2.c (nios2_elf32_relocate_section): Fix calculation
of GOTOFF relocations.
Diffstat (limited to 'bfd/elf32-nios2.c')
-rw-r--r-- | bfd/elf32-nios2.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c index b6a60ff..a7547e8 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) { |