This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: GOT refcounting broke non-refcount targets
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Date: Thu, 22 Aug 2002 08:31:03 +0930
- Subject: Re: GOT refcounting broke non-refcount targets
- References: <20020821221108.GA18270@nevyn.them.org>
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