Alternatively, join us on Discord.
You can help CodeWalrus stay online by donating here.

dynamic linking PoC for the TI nspire

Started by nspiredev500, November 09, 2019, 09:24:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


I managed to get a system working (in firebird, not yet tested on hardware) that lets programms request function tables from libraries (sort-of dynamic linking from what I understand, maybe I'll do a proper dynamic linker with resolving missing symbols in the files, but I currently don't know enough about that).
When handled by header files to define function pointers with the right names and parameters, a programm doesn't have to include the functions, thus reducing the size of the binary and the size occupied in RAM if multiple programms use the same library.
It would also make it easier to update a library inside a program, you would just update your library.
I have a PoC on a github repo along with a short screen recoding showing that it works.

If you're interested, it works by replacing itself as the system call handler and then catches system calls that have a certain signature and runs them.
There are 2 system calls: registering a function table as a library with a specific name, and requesting a function table with a name.
It searches in a path (in this case /documents/ndless/) for a library with that name and runs it. The library should register itself with its name and the functions it wants to export.
Because the swi handler address isn't os-specific, this PoC should work on every hardware and software version. I testet it in firebid with 4.5 CX CAS HW W, 4.5 CX HW W and 4.5 HW J.

For anyone wondering why I even did this, I plan to make a programm that is divided up into modules, and these modules should be easily replacable by a user without recompilation (no one would do that and it is some work to get the ndless-sdk running).
In this case it would be as easy as swapping out one file.
  • Calculators owned: TI-Nspire CX CAS

Powered by EzPortal