Skip to content

Make self linker outputs loadable shared objects for Ruby dlopen #46

@katsyoshi

Description

@katsyoshi

Goal:
Produce shared objects from gcc-generated object files that can be loaded at runtime (Ruby dlopen path).

Scope:

  • Define and implement the minimum linker requirements for a loadable .so from gcc .o inputs.
  • Prioritize runtime-load correctness over broad feature coverage.
  • Cover the basic runtime path:
    1. dlopen succeeds
    2. expected symbol is resolvable (dlsym/equivalent)
    3. callable function returns expected value

Implementation plan (incremental):

  • Start from a minimal -fPIC fixture (single exported function, no complex deps).
  • Enumerate relocations emitted by gcc for that fixture and support required subset.
  • Keep unsupported relocations as explicit linker errors (no silent output corruption).
  • Add E2E test(s) in Ruby-side runtime loading path (Fiddle or equivalent wrapper).

Acceptance criteria:

  • A self-linked .so from the minimal fixture is loadable and callable from Ruby runtime.
  • Tests assert load + symbol resolution + function result.
  • Failure mode for unsupported relocations is explicit and deterministic.

Out of scope (for this issue):

  • Full relocation-family support across all gcc outputs.
  • Property-based testing expansion (tracked separately).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions