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

[RTLD] Dynamic linker #990

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

[RTLD] Dynamic linker #990

wants to merge 1 commit into from

Conversation

badochov
Copy link
Contributor

@badochov badochov commented Jan 30, 2024

Description

This change contains all changes needed for shared libraries support.
Toolchain needs to be rebuild.
Small example showing how to create a shared library and link dynamically is added sharedlib

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: (list targets here).

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

_user/sharedlib/main.c Outdated Show resolved Hide resolved
_user/sharedlib/main.c Outdated Show resolved Hide resolved
_user/sharedlib/main.c Outdated Show resolved Hide resolved
@badochov badochov force-pushed the badochov/dynamic-linker branch 2 times, most recently from b38309a to ef2ca8f Compare January 30, 2024 15:39
@badochov
Copy link
Contributor Author

[CURRENT STATUS]
This changes will not address dynamic linking on NOMMU platforms. For those other mechanism will be needed.

Currently linking dynamically is only supported on ia32.

Dynamic linker is adaptation of dynamic linker used by NetBSD.
Programs can be linked dynamically.
Libphoenix can be compiled as a shared libraries.
Syspage programs have to be compiled statically(most probably no way around it)

Locally I run nightly test campaign with all binaries linked dynamically and all tests passed but busybox-cp and busybox-tr, both failing with bogus log I/O possible. It is weird as busybox uses different build system and is always linked statically.

TODO:

  • Thread Local Storage support in dynamic libraries
  • Support in kernel for 64bit platforms
  • Support in dynamic linker for other platform than ia32.
    • (To support other platforms asm parts of ld.elf_so have to be rewritten to support Phoenix process startup ABI.)
  • Investigate busybox test fail

Things to consider:

  • I am not sure is dynamic linker can be compiled to support 32bit dynamic linking on 64bit platforms, whereas out kernel may (no idea if someone tested it)run 32bit binaries on 64bit

@badochov badochov force-pushed the badochov/dynamic-linker branch 17 times, most recently from 42f4c00 to 40a8682 Compare February 2, 2024 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant