[LLVMdev] Linking with C Library

Nyx mcheva at cs.mcgill.ca
Mon Apr 5 15:27:59 PDT 2010


>> You need to figure out how to pass -rdynamic to the linker, like I
said before. http://llvm.org/docs/tutorial/OCamlLangImpl7.html
mentions it, but I don't know enough about the ocaml build process to
say whether that'll work.

I believe I'm already doing that, properly by passing -ccopt -rdynamic to
ocamlopt:
ocamlopt -cc g++ -ccopt -rdynamic -linkall $(LIBFILES) -o alpha $(OBJFILES)

I've also tried writing a dummy "puts" function in a C file and linking that
with my executable. nm -D then shows the following:

000000000054b690 T camlRuntime__rt_fputs_208
000000000054b590 T camlRuntime__rt_puts_198
                 U fputs
0000000000c43044 T puts

However, LLVM *still* gives me:
LLVM ERROR: Tried to execute an unknown external function: i32 (i8*)* puts

Something really wrong is happening. The following thread seems to indicate
that this should all work easily:
http://old.nabble.com/jit-with-external-functions-td7769793.html



-- 
View this message in context: http://old.nabble.com/Linking-with-C-Library-tp28133460p28145523.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.




More information about the llvm-dev mailing list