Changeset 31ea2a7 in mainline for uspace/lib/c/generic/libc.c


Ignore:
Timestamp:
2025-01-26T17:53:49Z (5 months ago)
Author:
Matěj Volf <git@…>
Children:
f215c6ef
Parents:
eff458d
git-author:
Matěj Volf <git@…> (2025-01-25 21:36:13)
git-committer:
Matěj Volf <git@…> (2025-01-26 17:53:49)
Message:

init RTLD runtime at load time even for statically linked binaries

before this, main_fibril of a statically linked binary had wrong thread-local storage

please see PR description for an elaborate explanation of what and why was wrong

File:
1 edited

Legend:

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

    reff458d r31ea2a7  
    9696
    9797#ifdef CONFIG_RTLD
    98         if (__pcb != NULL && __pcb->rtld_runtime != NULL) {
     98        if (__pcb == NULL) {
     99                /*
     100                 * A binary loaded by kernel, not the loader.
     101                 * Init some rudimentary rtld runtime environment.
     102                 */
     103                errno_t rtld_init_result = rtld_init_static();
     104                assert(rtld_init_result == EOK);
     105        } else {
     106                assert(__pcb->rtld_runtime != NULL);
    99107                runtime_env = (rtld_t *) __pcb->rtld_runtime;
    100         } else {
    101                 if (rtld_init_static() != EOK)
    102                         abort();
    103108        }
    104109#endif
Note: See TracChangeset for help on using the changeset viewer.