Skip to content

rrx/rust-linker

Repository files navigation

TLDR

A personal proof-of-concept linker that works only on Linux x86_64, with hot-reload potential

Why

This project is a proof-of-concept linker built in Rust. The purpose of this project was to learn more about how linkers and loaders work. It's one of those things you don't think about until you need to, and if you're like me, you're a little surprised at the complexity that hides behind such a simple interface. But if it was just a linker, that's not very interesting, so I'm also working on adding some hot-reloading functionality that will swap out code at runtime. I wrote a wild blog post about this called Hot-Reloading like it's 1972. It turns out that hot-reloading is a bit of a difficult problem, which is why you don't see it much any more as the focus has moved from developer productivity towards production stability. I still think the developer experience aspect is important though, so I'd like to explore it's potential further as part of my language research.

Limitations

  • Only compiles for Linux on x86_64
  • Limited linker options, only the simplest were used for implementation
  • Hot-reloading is very primitive and not yet usable
  • Single code model
  • Code must by position independent (-fPIC)

Developing

You will need a few libraries to build the test functions. On ubuntu you will need:

# install dependencies
sudo apt install libsigsegv-dev libsdl2-dev libuv1-dev musl-dev

# run test-suite
make test

See the Makefile for examples of usage.

Helpful links

Some helpful links for building linkers:

Similar Work in Rust

About

Prototype linker written in Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published