Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couple of refactorings to make adding dynamic linker support easier #111

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Commits on Mar 5, 2024

  1. Move the relocate call from init_runtime to entry

    Self-relocation is not actually initializing runtime state, but making
    it possible to safely run any code at all. When using a dynamic linker
    the dynamic linker needs to be relocated before it can do dynamic
    linking, but some of the runtime intialization needs to happen after
    dynamic linking when all static DSO's that use thread local storage are
    known.
    bjorn3 committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    be9a9e5 View commit details
    Browse the repository at this point in the history
  2. Always write thread_id field after initializing thread metadata

    Also move writing __stack_chk_guard earlier. This makes future
    refactorings easier.
    bjorn3 committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    a932dc2 View commit details
    Browse the repository at this point in the history
  3. Unify TLS allocation between the main thread and newly spawned threads

    Also move the TLS for spawned threads away from the stack to simplify
    the logic and possibly allow using the regular memory allocator for
    allocating the TLS block for all threads other than the main thread.
    bjorn3 committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    71c6e84 View commit details
    Browse the repository at this point in the history