problem of this approach is this:
(my understanding)
ELF file format supports several object file types. these are the relevant:
ET_REL - relocatable
ET_EXEC - executable
ET_DYN - shared object
When compiling C files into .o files, no address allocation is done.
this .o will be in
ET_REL format, that just contains all objects in a binary representation. (compiled code, variables, arrays in binary etc)
all these objects are something like sections. one section for every single object (function, variable etc)
the linker loads several files in this format and merges them into a file of format
ET_EXEC where (in our case)
the address of every single object is allocated and the objects are merged into sections they were intended for.
e.g. all functions which were are merged into a single section named .text and variables into .data.
if compiled + linked as shared object, we have
ET_DYN file that is again different.
it is intended for DLLs/.so files and require different handling.
TCC's linker code only supports
ET_REL as it is a "linker" or
ET_DYN but seems to rely on OS functions to load a DLL.
not sure if it can load such DYN objects at all on our cameras. i tried it and it simply didnt work.
(i should try that in an emulator and check where it is failing)
so i am left with
ET_REL as only working solution.
this has some disadvantage.
it is meant as intermediate file in a build process that will get linked to other objects into a final executable or a shared library.
so you can not simply compile several .c files into one .o that can be loaded in ML as single plugin (at least, i dont know how

)
well, the linux kernel uses exactly the same method for its drivers (.ko), so it might be still a good choice.
but i hoped to load .so files (
ET_DYN) which is the cleanest solution imho.
anyway, i will stick to
ET_REL .o files now, hoping that it wont cause too much trouble.
EDIT:
well, using LD with param -r we can output relocateable objects as the linux kernel does.
this sounds like a good solution.
at the moment i am investigating how to add plugins during runtime.
now i can add them all at once, then relocate all those .o's and then run functions.