denzp / rustc-llvm-proxy

Proxy LLVM calls into Rust own shared library in runtime
MIT License
32 stars 13 forks source link

Undefined Reference to LLVMRunFunction #2

Closed termoshtt closed 6 years ago

termoshtt commented 6 years ago

Hi, this crate is great for me :)

I met a link issue while testing a simple code generation example of LLVM:

https://github.com/termoshtt/rustc-llvm-proxy-example/blob/master/src/main.rs

/home/travis/build/termoshtt/rustc-llvm-proxy-example/src/main.rs:87: undefined reference to `LLVMVerifyModule'
/home/travis/build/termoshtt/rustc-llvm-proxy-example/src/main.rs:110: undefined reference to `LLVMLinkInInterpreter'
/home/travis/build/termoshtt/rustc-llvm-proxy-example/src/main.rs:111: undefined reference to `LLVMCreateInterpreterForModule'
/home/travis/build/termoshtt/rustc-llvm-proxy-example/src/main.rs:123: undefined reference to `LLVMRunFunction'
/home/travis/build/termoshtt/rustc-llvm-proxy-example/src/main.rs:130: undefined reference to `LLVMGenericValueToInt'
collect2: error: ld returned 1 exit status

https://travis-ci.org/termoshtt/rustc-llvm-proxy-example/jobs/429177101

rustc-llvm-proxy does links basic APIs e.g. LLVMCreateBuilder, LLVMModuleCreateWithName, and so on, but some APIs are lacked as listed above. I guess it missing to link libLLVMExecutionEngine.a and libLLVMAnalysis.a. Is this intended behavior or bug?

denzp commented 6 years ago

Thanks for reporting and I glad the crate is useful for you :)

Normally, every function fromllvm-sys can be exported from the proxy. I whitelisted the additional modules, so the missing functions should work in 0.1.3.

termoshtt commented 6 years ago

It works, thanks!