Changeset 29405ac in mainline for uspace/lib/c/generic/rtld/rtld.c


Ignore:
Timestamp:
2016-05-16T18:10:00Z (9 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bab0f42
Parents:
0dc9a474
Message:

DTPMOD relocations with null symbol name should return the current module index. Implement TPOFF relocations. dltest -n to not run dlfcn tests. Now dltest -n works like a charm. Place TLS images in descending order for variant II just to be safe. Propagate TLS alignment info.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/rtld/rtld.c

    r0dc9a474 r29405ac  
    9595        prog->tdata_size = p_info->tls.tdata_size;
    9696        prog->tbss_size = p_info->tls.tbss_size;
     97        prog->tls_align = p_info->tls.tls_align;
    9798
    9899        printf("prog tdata at %p size %zu, tbss size %zu\n",
     
    116117        module_load_deps(prog, 0);
    117118
     119        /* Compute static TLS size */
     120        modules_process_tls(env);
     121
    118122        /*
    119123         * Now relocate/link all modules together.
     
    124128        modules_process_relocs(env, prog);
    125129
    126         modules_process_tls(env);
    127 
    128130        *rre = env;
    129131        return EOK;
     
    149151         */
    150152
     153#ifdef CONFIG_TLS_VARIANT_1
     154        /*
     155         * Ascending addresses
     156         */
    151157        offset = 0;
    152158        list_foreach(rtld->modules, modules_link, module_t, m) {
     
    157163                offset += m->tbss_size;
    158164        }
     165#else /* CONFIG_TLS_VARIANT_2 */
     166        /*
     167         * Descending addresses
     168         */
     169        offset = 0;
     170        list_foreach(rtld->modules, modules_link, module_t, m) {
     171                assert(offset + m->tdata_size + m->tbss_size <= rtld->tls_size);
     172                offset += m->tbss_size;
     173                memset(data + rtld->tls_size - offset, 0, m->tbss_size);
     174                offset += m->tdata_size;
     175                memcpy(data + rtld->tls_size - offset, m->tdata, m->tdata_size);
     176        }
     177#endif
    159178
    160179        return tcb;
Note: See TracChangeset for help on using the changeset viewer.