aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorJim Wilson <jimw@sifive.com>2018-06-21 11:45:43 -0700
committerJim Wilson <jimw@sifive.com>2018-06-21 11:45:43 -0700
commit25eb8346acc04b10d62295eb4c67c928b01a8aaf (patch)
tree16053669852dc7c5fb30a57b1440b332faade8f7 /bfd
parent00431a78b28f913a9d5c912c49680e39cfd20847 (diff)
downloadgdb-25eb8346acc04b10d62295eb4c67c928b01a8aaf.zip
gdb-25eb8346acc04b10d62295eb4c67c928b01a8aaf.tar.gz
gdb-25eb8346acc04b10d62295eb4c67c928b01a8aaf.tar.bz2
RISC-V: Fix 3 PIE related ld testsuite failures.
bfd/ * elfnn-riscv.c (riscv_elf_finish_dynamic_symbol): Update comment. Use SYMBOL_REFERENCES_LOCAL. Add asserts for h->got.offset.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elfnn-riscv.c9
2 files changed, 10 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 46e314d..e962822 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2018-06-21 Jim Wilson <jimw@sifive.com>
+
+ * elfnn-riscv.c (riscv_elf_finish_dynamic_symbol): Update comment.
+ Use SYMBOL_REFERENCES_LOCAL. Add asserts for h->got.offset.
+
2018-06-21 Alan Modra <amodra@gmail.com>
* doc/Makefile.am (AUTOMAKE_OPTIONS): Add "foreign".
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index 7b1ca47..934704a 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -2394,15 +2394,15 @@ riscv_elf_finish_dynamic_symbol (bfd *output_bfd,
rela.r_offset = sec_addr (sgot) + (h->got.offset &~ (bfd_vma) 1);
- /* If this is a -Bsymbolic link, and the symbol is defined
- locally, we just want to emit a RELATIVE reloc. Likewise if
+ /* If this is a local symbol reference, we just want to emit a RELATIVE
+ reloc. This can happen if it is a -Bsymbolic link, or a pie link, or
the symbol was forced to be local because of a version file.
The entry in the global offset table will already have been
initialized in the relocate_section function. */
if (bfd_link_pic (info)
- && (info->symbolic || h->dynindx == -1)
- && h->def_regular)
+ && SYMBOL_REFERENCES_LOCAL (info, h))
{
+ BFD_ASSERT((h->got.offset & 1) != 0);
asection *sec = h->root.u.def.section;
rela.r_info = ELFNN_R_INFO (0, R_RISCV_RELATIVE);
rela.r_addend = (h->root.u.def.value
@@ -2411,6 +2411,7 @@ riscv_elf_finish_dynamic_symbol (bfd *output_bfd,
}
else
{
+ BFD_ASSERT((h->got.offset & 1) == 0);
BFD_ASSERT (h->dynindx != -1);
rela.r_info = ELFNN_R_INFO (h->dynindx, R_RISCV_NN);
rela.r_addend = 0;