i want to integrate a C source JITer into my application but the resulting executables are too large
is it possible to reduce the resulting libs/exe some way?
current VS2017/svn build example: llvm-build\Release\bin\clang-interpreter.exe ~36MB
for now (that can change later)
- i want to jit simple c-code
- no std library or something
- x64 only
- no deep/full architecture optimization needed
- no c++/templates etc.
Have you tried building LLVM in MinSizeRelease and only enable X64 backend?
Other aspects might require some advanced modification to LLVM/Clang’s source which I’m no professional with
libClang’s EmitLLVMAction(or whatever its called) + LLVM’s MCJIT( skipping all optimizations as a whole) should in theory IMHO achieve what you need. I’m not sure if there are extra internal dependencies though.
and only enable X64 backend?
im on Win7 x64
so i the CMaker parameter enables only the x64 backed
will try MinSizeRelease
36MB is quite small already. I guess you already built only one backend?
(-DLLVM_TARGETS_TO_BUILD=host) I don't think it will get much smaller.
Your requirements, however, sound like you could easily use a more
specialized compiler, like TinyCC? If your project is LGPL compatible, I
am sure you can make it codegen to a memory buffer. NativeJIT has good
data structures for that. The bigger task then is resolving relocations
and figuring out dependencies (especially on Windows). I guess you could
find all that in LLVM and use it without the entire engine behind.