This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug in elf_i386_adjust_dynamic_symbol ?


On Mon, Jan 28, 2002 at 07:05:12PM +0100, Martin Schwidefsky wrote:
> 
> --- elf32-i386.c.orig    Fri Nov 16 22:05:51 2001
> +++ elf32-i386.c    Mon Jan 28 18:52:18 2002
> @@ -1114,7 +1114,9 @@
>        if (h->plt.refcount <= 0
>        || (! info->shared
>            && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
> -          && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0))
> +          && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
> +          && h->root.type != bfd_link_hash_undefweak
> +          && h->root.type != bfd_link_hash_undefined))
>      {
>        /* This case can occur if we saw a PLT32 reloc in an input
>           file, but the symbol was never referred to by a dynamic
> 
> Big question now is: does this sound reasonable ?

I think it's reasonable in view of the current linker treatment
of weak syms, but this raises the question (again) of what exactly
is the correct treatment of weak syms.  Last time this came up,
Ulrich Drepper voiced the opinion that undefined weak syms should
never be dynamic, and referred to some discussion by an "ELF
working group".  See the thread starting at
 http://sources.redhat.com/ml/binutils/2001-07/msg00069.html

I'm inclined to think Ulrich is correct but inertia and a desire
not to break too much at once has stopped me changing the linker.

So go ahead and apply the patch.  When (if) the linker behaviour
is fixed/changed regarding weak syms, your patch will be reverted
along with dozens of other places.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]