123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- #ifndef TLSDESCHTAB_H
- # define TLSDESCHTAB_H 1
- # ifdef SHARED
- # include <inline-hashtab.h>
- inline static int
- hash_tlsdesc (void *p)
- {
- struct tlsdesc_dynamic_arg *td = p;
-
- return td->tlsinfo.ti_offset;
- }
- inline static int
- eq_tlsdesc (void *p, void *q)
- {
- struct tlsdesc_dynamic_arg *tdp = p, *tdq = q;
- return tdp->tlsinfo.ti_offset == tdq->tlsinfo.ti_offset;
- }
- inline static int
- map_generation (struct link_map *map)
- {
- size_t idx = map->l_tls_modid;
- struct dtv_slotinfo_list *listp = GL(dl_tls_dtv_slotinfo_list);
-
- do
- {
-
- if (idx < listp->len)
- {
-
- if (listp->slotinfo[idx].gen)
- return listp->slotinfo[idx].gen;
- else
- break;
- }
- idx -= listp->len;
- listp = listp->next;
- }
- while (listp != NULL);
-
- return GL(dl_tls_generation) + 1;
- }
- void *
- internal_function
- _dl_make_tlsdesc_dynamic (struct link_map *map, size_t ti_offset)
- {
- struct funcdesc_ht *ht;
- void **entry;
- struct tlsdesc_dynamic_arg *td, test;
- ht = map->l_tlsdesc_table;
- if (! ht)
- {
- ht = htab_create ();
- if (! ht)
- return 0;
- map->l_tlsdesc_table = ht;
- }
- test.tlsinfo.ti_module = map->l_tls_modid;
- test.tlsinfo.ti_offset = ti_offset;
- entry = htab_find_slot (ht, &test, 1, hash_tlsdesc, eq_tlsdesc);
- if (entry == NULL)
- _dl_exit(1);
- if (*entry)
- {
- td = *entry;
- return td;
- }
- *entry = td = _dl_malloc (sizeof (struct tlsdesc_dynamic_arg));
-
- td->gen_count = map_generation (map);
- td->tlsinfo = test.tlsinfo;
- return td;
- }
- # endif
- #endif
|