GOT refcounting broke non-refcount targets
Alan Modra
amodra@bigpond.net.au
Wed Aug 21 16:01:00 GMT 2002
On Wed, Aug 21, 2002 at 06:11:08PM -0400, Daniel Jacobowitz wrote:
> But if got.offset is being used instead of got.refcount, then 0 is a valid
> offset.
Oops. My fault.
> Sparc has the same problem and even worse: the only use of got.refcount in
> elf32-sparc.c is:
> if (h->got.refcount > 0)
> h->got.refcount--;
Rip the code out. elf32_sparc_gc_sweep_hook is bogus. It should
just return true.
> Any comments?
Hmm, perhaps pass "struct elf_backend_data *" to copy_indirect_symbol
(it's always called as bed->elf_backend_copy_indirect_symbol, so
that is no bother), then do
void
_bfd_elf_link_hash_copy_indirect (dir, ind, bed)
struct elf_link_hash_entry *dir, *ind;
struct elf_backend_data *bed;
{
bfd_signed_vma tmp;
bfd_signed_vma lowest_valid = bed->can_refcount;
.
.
tmp = dir->got.refcount;
if (tmp < lowest_valid)
{
dir->got.refcount = ind->got.refcount;
ind->got.refcount = tmp;
}
else
BFD_ASSERT (ind->got.refcount < lowest_valid);
.
.
}
Of course, that means editing more files. I'll do the grunt work if
you a) think it's better, and b) don't want to edit files yourself. :)
> + else
> + BFD_ASSERT (ind->got.refcount <= 0);
I think this test should be < 0
--
Alan Modra
IBM OzLabs - Linux Technology Centre
More information about the Binutils
mailing list