[PATCH-NPTL] TLS symbol handling in _dl_find_hash

Carmelo AMOROSO carmelo.amoroso at st.com
Mon Sep 24 12:38:47 UTC 2007


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 ;-)

Cheers,
Carmelo



More information about the uClibc mailing list