[PATCH-NPTL] TLS symbol handling in _dl_find_hash

Joakim Tjernlund joakim.tjernlund at transmode.se
Mon Sep 24 06:57:56 PDT 2007


On Mon, 2007-09-24 at 14:38 +0200, Carmelo AMOROSO wrote:
> Carmelo AMOROSO wrote:
> > 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
> >   
> I have to correct my self... indeed, if _dl_find_hash is called by a non 
> TLS code, NULL can be
> used for the tls_tpnt argument, but actually it will be never passed to 
> the _dl_lookup_hash.
> I did not look at the Jocke's suggestion with the proper attention.
> I'll integrate it while reworking dl_find_hash for the GNU hash support.
> Sorry Jocke ;-)

NP :) 
Curious, are you looking at adding support for the GNU_HASH extension?
That would be very cool.

 Jocke 


More information about the uClibc mailing list