diff options
author | Hans-Peter Nilsson <hp@axis.com> | 2011-10-14 06:52:46 +0000 |
---|---|---|
committer | Hans-Peter Nilsson <hp@axis.com> | 2011-10-14 06:52:46 +0000 |
commit | 970d488d05590ebfea5804e5a58e5fa7c85ac0b4 (patch) | |
tree | f8bed377b8359844c9917d97dae13e22b0d274f5 | |
parent | 357f012bf45351de32e15e29f1b4ee6deae74754 (diff) | |
download | gdb-970d488d05590ebfea5804e5a58e5fa7c85ac0b4.zip gdb-970d488d05590ebfea5804e5a58e5fa7c85ac0b4.tar.gz gdb-970d488d05590ebfea5804e5a58e5fa7c85ac0b4.tar.bz2 |
* elf32-cris.c (cris_elf_gc_sweep_hook) <R_CRIS_16_GOTPLT>
<R_CRIS_32_GOTPLT>: Fix missing update of gotplt refcount for
global symbols.
<R_CRIS_8, R_CRIS_16, R_CRIS_32>: New cases for similar missing
updates of the plt refcount.
(elf_cris_adjust_gotplt_to_got): Assert integrity of the gotplt
refcount in relation to the plt refcount.
-rw-r--r-- | bfd/ChangeLog | 10 | ||||
-rw-r--r-- | bfd/elf32-cris.c | 12 |
2 files changed, 22 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 42ef646..13242ba 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,13 @@ +2011-10-14 Hans-Peter Nilsson <hp@axis.com> + + * elf32-cris.c (cris_elf_gc_sweep_hook) <R_CRIS_16_GOTPLT> + <R_CRIS_32_GOTPLT>: Fix missing update of gotplt refcount for + global symbols. + <R_CRIS_8, R_CRIS_16, R_CRIS_32>: New cases for similar missing + updates of the plt refcount. + (elf_cris_adjust_gotplt_to_got): Assert integrity of the gotplt + refcount in relation to the plt refcount. + 2011-10-13 Richard Sandiford <richard.sandiford@linaro.org> * elf32-arm.c (elf32_arm_final_link_relocate): Mark PLT calls via diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index ea5043a..243a8ec 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -2663,6 +2663,9 @@ cris_elf_gc_sweep_hook (bfd *abfd, /* For local symbols, treat these like GOT relocs. */ if (h == NULL) goto local_got_reloc; + else + /* For global symbols, adjust the reloc-specific refcount. */ + elf_cris_hash_entry (h)->gotplt_refcount--; /* Fall through. */ case R_CRIS_32_PLT_GOTREL: @@ -2671,10 +2674,14 @@ cris_elf_gc_sweep_hook (bfd *abfd, local_got_refcounts[-1]--; /* Fall through. */ + case R_CRIS_8: + case R_CRIS_16: + case R_CRIS_32: case R_CRIS_8_PCREL: case R_CRIS_16_PCREL: case R_CRIS_32_PCREL: case R_CRIS_32_PLT_PCREL: + /* Negate the increment we did in cris_elf_check_relocs. */ if (h != NULL) { if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT @@ -2733,6 +2740,11 @@ elf_cris_adjust_gotplt_to_got (h, 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. */ + BFD_ASSERT (h->gotplt_refcount == 0 + || h->gotplt_refcount <= h->root.plt.refcount); + /* If nobody wanted a GOTPLT with this symbol, we're done. */ if (h->gotplt_refcount <= 0) return TRUE; |