This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: PATCH: [BZ #15030]: do_lookup_x returns undefined symbol entry


On Thu, Jan 17, 2013 at 12:34 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> On Thu, Jan 17, 2013 at 12:30:03PM -0800, H.J. Lu wrote:
>> do_lookup_x has
>>
>>           /* Use the old SysV-style hash table.  Search the appropriate
>>              hash bucket in this object's symbol table for a definition
>>              for the same symbol name.  */
>>           for (symidx = map->l_buckets[*old_hash % map->l_nbuckets];
>>                symidx != STN_UNDEF;
>>                symidx = map->l_chain[symidx])
>>             {
>>               sym = check_match (&symtab[symidx]);
>>               if (sym != NULL)
>>                 goto found_it;
>>             }
>>
>>
>> With the old SysV-style hash table, we may return undefined symbol entry.
>> We don't run into this problem often since GNU-style hash table is enabled
>> by most GCC.  This patch skips undefined symbol entry.  Tested on ia32
>> and x86-64.  OK to install?
>>
>>
>
> It should be SHN_UNDEF, not STN_UNDEF.
>
>
> H.J.
> ---
> 2013-01-17  H.J. Lu  <hongjiu.lu@intel.com>
>
>         [BZ #15030]
>         * dl-lookup.c (do_lookup_x): Skip undefined symbol entry with
>         the old SysV-style hash table.
>
> diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
> index 68f8dac..dc8ecef 100644
> --- a/elf/dl-lookup.c
> +++ b/elf/dl-lookup.c
> @@ -270,7 +270,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
>                symidx = map->l_chain[symidx])
>             {
>               sym = check_match (&symtab[symidx]);
> -             if (sym != NULL)
> +             if (sym != NULL && sym->st_shndx != SHN_UNDEF)
>                 goto found_it;
>             }
>         }

I withdrew this patch and resolve size relocation against non-empty TLS
symbol at link-time instead:

http://sourceware.org/ml/binutils/2013-01/msg00309.html

-- 
H.J.


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