Changeset 6adb775f in mainline for uspace/lib/c/arch/ia32/src/tls.c


Ignore:
Timestamp:
2016-04-25T16:46:31Z (9 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
32573ff
Parents:
dc0d8b52
Message:

TLS for dynamically linked executables and initially loaded DSOs (but must not call dlopen or there will be trouble).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/arch/ia32/src/tls.c

    rdc0d8b52 r6adb775f  
    11/*
    22 * Copyright (c) 2006 Ondrej Palkovsky
     3 * Copyright (c) 2016 Jiri Svoboda
    34 * All rights reserved.
    45 *
     
    3940#include <align.h>
    4041
     42#ifdef CONFIG_RTLD
     43#include <rtld/rtld.h>
     44#endif
     45
    4146tcb_t *tls_alloc_arch(void **data, size_t size)
    4247{
     
    6873
    6974        /* Calculate size of TLS block */
    70         tls_size = ALIGN_UP(&_tbss_end - &_tdata_start, &_tls_alignment);
     75        tls_size = tls_get_size();
    7176
    7277        /* The TLS block is just before TCB */
    7378        tls = (uint8_t *)__tcb_get() - tls_size;
    7479
     80#ifdef CONFIG_RTLD
     81        if (runtime_env != NULL) {
     82                return rtld_tls_get_addr(runtime_env, tls, ti->ti_module,
     83                    ti->ti_offset);
     84        }
     85#endif
    7586        return tls + ti->ti_offset;
    7687}
Note: See TracChangeset for help on using the changeset viewer.