Changeset d3e938c in mainline for uspace/lib/c/arch/amd64/src/tls.c


Ignore:
Timestamp:
2019-01-08T13:27:05Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
05cb995, 1567471, 1aa9eff, cdec2a1
Parents:
9c4df21
git-author:
Jiri Svoboda <jiri@…> (2018-01-07 22:27:02)
git-committer:
Jiri Svoboda <jiri@…> (2019-01-08 13:27:05)
Message:

Dynamic linking on amd64 (WIP)

After modifying HelenOS.config, it is possible to build with dynamic
linking support, but an attempt to load a shared library will fail.

File:
1 edited

Legend:

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

    r9c4df21 rd3e938c  
    3838#include <stddef.h>
    3939
     40#ifdef CONFIG_RTLD
     41#include <rtld/rtld.h>
     42#endif
     43
    4044tcb_t *tls_alloc_arch(size_t size, size_t align)
    4145{
     
    4852}
    4953
     54/*
     55 * Rtld TLS support
     56 */
     57
     58typedef struct {
     59        unsigned long int ti_module;
     60        unsigned long int ti_offset;
     61} tls_index;
     62
     63void __attribute__((__regparm__(1)))
     64    *__tls_get_addr(tls_index *ti);
     65
     66void __attribute__((__regparm__(1)))
     67    *__tls_get_addr(tls_index *ti)
     68{
     69        uint8_t *tls;
     70
     71#ifdef CONFIG_RTLD
     72        if (runtime_env != NULL) {
     73                return rtld_tls_get_addr(runtime_env, __tcb_get(),
     74                    ti->ti_module, ti->ti_offset);
     75        }
     76#endif
     77        /* Get address of static TLS block */
     78        tls = tls_get();
     79        return tls + ti->ti_offset;
     80}
     81
    5082/** @}
    5183 */
Note: See TracChangeset for help on using the changeset viewer.