[PATCH-NPTL] TLS symbol handling in _dl_find_hash

Carmelo AMOROSO carmelo.amoroso at st.com
Mon Sep 24 00:05:11 PDT 2007


Joakim Tjernlund wrote:
> Hi Carmelo
>  
> Had a look at you dl_find hash again, it came up on IRC.
> I think you should change
>   char *_dl_find_hash(const char *name, struct dyn_elf *rpnt, struct 
> elf_resolve *mytpnt, int type_class
>  #ifdef USE_TLS
>  ,struct elf_resolve **tls_tpnt
>  #endif
>  )
>  
> Into(module syntax errors):
> rename _dl_find_hash to _dl_lookup_hash:
>   char *_dl_lookup_hash(const char *name, struct dyn_elf *rpnt, struct 
> elf_resolve *mytpnt, int type_class
>   #ifdef USE_TLS
>   ,struct elf_resolve **tls_tpnt
>   #endif
>  )
>  
> In header file do:
>  static __inline__ char *_dl_find_hash(const char *name, struct 
> dyn_elf *rpnt, struct elf_resolve *mytpnt,
>                                                        int type_class, 
> struct elf_resolve **tls_tpnt)
> {
> #ifdef USE_TLS
>         return _dl_lookup_hash(name, rpnt, mytpnt, type_class, tls_tpnt);
> #else
>         return _dl_lookup_hash(name, rpnt, mytpnt, type_class);
> #endif
> }
>
> This way the call sites will look the same wrt. NTPL or No NPTL
>  
>  Jocke
Hi Jocke,
this makes sense, but the caller still needs to use #ifdef USE_TLS 
around tls_tpnt variable definition...
so it is cannot be fully unaware of the TLS stuff.
Anyway, due to some code rework I'm doing on _dl_find_hash generally, 
I'll take into account
your suggestion.

Carmelo

>     ------------------------------------------------------------------------
>     *From:* uclibc-bounces at uclibc.org
>     [mailto:uclibc-bounces at uclibc.org] *On Behalf Of *Carmelo AMOROSO
>     *Sent:* den 25 augusti 2006 10:31
>     *To:* uclibc at uclibc.org
>     *Subject:* [PATCH-NPTL] TLS symbol handling in _dl_find_hash
>
>     Hi Steve, All
>     I had a look into _dl_find_hash changes to handle TLS symbol.
>     Both CodeSourcery's and Steve's implementation are defining a new
>     _dl_find_hash function suitable
>     to handle TLS symbols.
>     I'd like to submit to your attention my own implementation. I simply
>     uses an I/O parameter referring to the
>     TLS module which resolves the target TLS symbol.
>     Only few changes are required in calling functions to meet the new
>     interface (that is guarded by USE_TLS).
>     Note that the patch is against uClinc-nptl branch at April, 28th. For
>     you convenience I attached both the patch
>     and the source file.
>
>     Rgds,
>     Carmelo
>



More information about the uClibc mailing list