[LLVMdev] Linking with C Library

Jeffrey Yasskin jyasskin at google.com
Mon Apr 5 18:56:08 PDT 2010


On Mon, Apr 5, 2010 at 3:27 PM, Nyx <mcheva at cs.mcgill.ca> wrote:
>
>>> 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
>

Ok, you've passed my expertise. Maybe you have to link with -lc?
Hopefully one of the ocaml experts will chime in.




More information about the llvm-dev mailing list