aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@bitrange.com>2017-03-28 23:43:09 +0200
committerHans-Peter Nilsson <hp@bitrange.com>2017-03-28 23:43:09 +0200
commit086554e8e6b222518f12acab34e6cc7b5af7fde7 (patch)
tree2659c075142a0cdf2d7daf584d94e2fdea462403 /bfd
parentfe5f7374bef8f23ffa0fe0dee0f9b05e0a218a29 (diff)
downloadbinutils-086554e8e6b222518f12acab34e6cc7b5af7fde7.zip
binutils-086554e8e6b222518f12acab34e6cc7b5af7fde7.tar.gz
binutils-086554e8e6b222518f12acab34e6cc7b5af7fde7.tar.bz2
Fix for PR ld/16044: elf32-cris.c h->plt.refcount inconsistency
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/elf32-cris.c9
2 files changed, 16 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 04d84f1..cf5e762 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
+2017-03-28 Hans-Peter Nilsson <hp@axis.com>
+
+ PR ld/16044
+ * elf32-cris.c (elf_cris_adjust_gotplt_to_got): Adjust BFD_ASSERT
+ to handle a local symbol with a hash-symbol-entry; without PLT.
+ Add BFD_ASSERT for an incidental case with GOT entry present.
+ (cris_elf_check_relocs): Increment PLT refcount only if the symbol
+ isn't forced-or-set local.
+
2017-03-27 Pip Cet <pipcet@gmail.com>
* wasm-module.c: New file to support WebAssembly modules.
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index 97b8cc3..d4bbceb 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -2714,8 +2714,9 @@ elf_cris_adjust_gotplt_to_got (struct elf_cris_link_hash_entry *h, void * p)
struct bfd_link_info *info = (struct bfd_link_info *) p;
/* A GOTPLT reloc, when activated, is supposed to be included into
- the PLT refcount. */
+ the PLT refcount, when the symbol isn't set-or-forced local. */
BFD_ASSERT (h->gotplt_refcount == 0
+ || h->root.plt.refcount == -1
|| h->gotplt_refcount <= h->root.plt.refcount);
/* If nobody wanted a GOTPLT with this symbol, we're done. */
@@ -2741,6 +2742,7 @@ elf_cris_adjust_gotplt_to_got (struct elf_cris_link_hash_entry *h, void * p)
srelgot = elf_hash_table (info)->srelgot;
/* Put accurate refcounts there. */
+ BFD_ASSERT (h->root.got.refcount >= 0);
h->root.got.refcount += h->gotplt_refcount;
h->reg_got_refcount = h->gotplt_refcount;
@@ -3476,7 +3478,10 @@ cris_elf_check_relocs (bfd *abfd,
continue;
h->needs_plt = 1;
- h->plt.refcount++;
+
+ /* If the symbol is forced local, the refcount is unavailable. */
+ if (h->plt.refcount != -1)
+ h->plt.refcount++;
break;
case R_CRIS_8: