[LLVMdev] C Compiler written in OCaml, Pointers Wanted
Maxime Chevalier-Boisvert
mcheva at cs.mcgill.ca
Tue Feb 23 20:18:00 PST 2010
>> Is writing the runtime part of the assignment? In any case, to get
yourself up and running, if you have declarations of the runtime
functions in your module with external linkage, the JIT will dlsym them
if it can't find a definition for them in your module. So if you have
malloc, strlen, etc. linked into your binary (which I'm guessing you
would, since I'm sure LLVM links in libc), it should be able to call those.
I don't think I have to write the runtime myself. Whether or not the
binary links with libc would depend on whether OCaml does or not though.
Can LLVM load pre-compiled object files for use with a JIT is what I
really want to know. Although, if there was a way to force it to use a
specific .so file to resolve symbols, that would be good also.
>> I would guess that since you can call LLVM from OCaml, you can use
any memory allocation strategy that you might normally use in a C/C++
program. ie, mmap some address space and go nuts. :)
That kind of goes back to the previous point though... How do I resolve
the mmap function? I'm guessing though, if I can actually resolve libc's
malloc, that saves me the trouble of having to implement my own memory
allocation scheme.
- Max
More information about the llvm-dev
mailing list