fwsGonzo / libriscv

The fastest RISC-V sandbox
BSD 3-Clause "New" or "Revised" License
526 stars 46 forks source link

Add support for loading and running dynamic executables #109

Closed fwsGonzo closed 7 months ago

fwsGonzo commented 7 months ago

While the library itself will not use the interpreter program (ld-linux.so) directly, we can run ld-linux.so with the program as an argument in order to get the same effect. This is because libriscv can now load dynamic/shared executables that does not depend on an interpreter (eg. for glibc). Additionally, this allows the host programmer to fully control all aspects of dynamic ELF loading through open-filter as well as the interpreter.

For now, the example emulator implementation in emulator/src/main.cpp assumes a certain loader.

So, simple rules for dynamic executables:

  1. Static PIE can always be run
  2. Dynamic ELF with interpreter dependency will need to be loaded by the interpreter