roc/linker
2021-08-19 23:00:10 -07:00
..
src Extra application function and plt data from platform 2021-08-19 22:54:14 -07:00
tests Change test app to C++ for better check on naming 2021-08-19 23:00:10 -07:00
Cargo.toml Extra application function and plt data from platform 2021-08-19 22:54:14 -07:00
README.md Roc linker library base setup 2021-08-16 20:06:44 -07:00

The Roc Surgical Linker

This linker has the goal of being extremely slim lined and fast. It is focused on the scope of only linking platforms to Roc applications. This restriction enables ignoring most of linking.

General Overview

This linker is run in 2 phases: preprocessing and surigical linking.

Platform Preprocessor

  1. Dynamically link the platform to a dummy Roc application dynamic library
  2. Create metadata related to Roc dynamically linked functions
    • Symbols that need to be redefined
    • Call locations that need to be modified for each symbol
    • Locations of special roc functions (roc_alloc, roc_dealloc, builtins, etc)
  3. Modify the main executable to no longer be dynamically link
    • Delete dependency on dynamic library
    • Remove symbols from the dynamic table (maybe add them to the regular table?)
    • Delete GOT and PLT entries
    • Remove relocations from the dynamic table
    • Add extra header information about new text and data section at end of file

Surgical Linker

  1. Copy over preprocessed platform as base
  2. Append text and data of application, noting offset
    • This could potentially have extra complication around section locations and updating the header
  3. Surgically update all call locations in the platform
  4. Surgically update call information in the application (also dealing with other relocations for builtins)