Changeset 9c07c3d in mainline
- Timestamp:
- 2016-05-19T06:45:09Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 97696ab
- Parents:
- d2bb25e7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/rtld/rtld.c
rd2bb25e7 r9c07c3d 221 221 unsigned long offset) 222 222 { 223 if (DTV_GN(tcb->dtv) < mod_id || tcb->dtv[mod_id] == NULL) { 224 printf("Module is not initial. aborting.\n"); 225 abort(); 223 module_t *m; 224 size_t dtv_len; 225 void *tls_block; 226 227 dtv_len = DTV_GN(tcb->dtv); 228 if (dtv_len < mod_id) { 229 /* Vector is short */ 230 231 tcb->dtv = realloc(tcb->dtv, (1 + mod_id) * sizeof(void *)); 232 /* XXX This can fail if OOM */ 233 assert(tcb->dtv != NULL); 234 /* Zero out new part of vector */ 235 memset(tcb->dtv + (1 + dtv_len), 0, (mod_id - dtv_len) * 236 sizeof(void *)); 237 } 238 239 if (tcb->dtv[mod_id] == NULL) { 240 /* TLS block is not allocated */ 241 242 m = module_by_id(rtld, mod_id); 243 assert(m != NULL); 244 /* Should not be initial module, those have TLS pre-allocated */ 245 assert(!link_used(&m->imodules_link)); 246 247 tls_block = malloc(m->tdata_size + m->tbss_size); 248 /* XXX This can fail if OOM */ 249 assert(tls_block != NULL); 250 251 /* Copy tdata */ 252 memcpy(tls_block, m->tdata, m->tdata_size); 253 /* Zero out tbss */ 254 memset(tls_block + m->tdata_size, 0, m->tbss_size); 255 256 tcb->dtv[mod_id] = tls_block; 226 257 } 227 258
Note:
See TracChangeset
for help on using the changeset viewer.