Skip to content

Implement simple cross-platform/arch ELF loader for executables #5351

Closed

Description

@benvanik

Today we are using platform-native shared libraries for dynamically loading compiled executables. This is a good path for tooling as then platform-native debuggers, profilers, and backtraces all work correctly. It's not a good path for deployment, though, as it requires us to embed a compiled artifact per architecture crossed with each target platform. Instead we should just use ELF everywhere and load ourselves. Our shared libraries are by design extremely simple and we control all of the linker parameters for them meaning that we only need to implement a tiny subset of features. There are still cases where we may want platform-native libraries (like iOS to satisfy code signing) but they would become opt-in with the generic ELF used for everything by default.

#3845 (comment) mentions a few tricks. Relatively simple technique, just needs per-arch relocation shims and ABI thunks to marshal registers, which is about 100 lines of code/arch total and easy to incrementally add.

Activity

  1. added
    hal/cpu
    on Apr 8, 2021
  2. self-assigned this
    on Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

hal/cpu

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions