Changeset f215c6ef in mainline for uspace/lib/c/generic/rtld/module.c


Ignore:
Timestamp:
2025-01-26T21:33:13Z (4 weeks ago)
Author:
Matěj Volf <git@…>
Children:
ea77c2d
Parents:
31ea2a7
git-author:
Matěj Volf <git@…> (2025-01-26 21:04:16)
git-committer:
Matěj Volf <git@…> (2025-01-26 21:33:13)
Message:

properly initialize RTLD runtime for static binaries

this is a better approach than what I did of previous commit

see https://github.com/HelenOS/helenos/pull/242 for a lot more context

File:
1 edited

Legend:

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

    r31ea2a7 rf215c6ef  
    6161 * @return EOK on success, ENOMEM if out of memory
    6262 */
    63 errno_t module_create_static_exec(rtld_t *rtld, module_t **rmodule)
     63errno_t module_create_static_exec(const void *elf, rtld_t *rtld)
    6464{
    6565        module_t *module;
     
    7979
    8080        const elf_segment_header_t *tls =
    81             elf_get_phdr(__progsymbols.elfstart, PT_TLS);
     81            elf_get_phdr(elf, PT_TLS);
    8282
    8383        if (tls) {
    84                 uintptr_t bias = elf_get_bias(__progsymbols.elfstart);
     84                uintptr_t bias = elf_get_bias(elf);
    8585                module->tdata = (void *) (tls->p_vaddr + bias);
    8686                module->tdata_size = tls->p_filesz;
     
    9595
    9696        list_append(&module->modules_link, &rtld->modules);
    97 
    98         if (rmodule != NULL)
    99                 *rmodule = module;
    10097        return EOK;
    10198}
Note: See TracChangeset for help on using the changeset viewer.