[LLVMdev] How to translate library functions into LLVM IR bitcode?

Yabin Hu yabin.hwu at gmail.com
Sun Sep 14 20:30:22 PDT 2014


Hi Liwei,

You may at first look into whether there is a llvm intrinsic for the
function you want to call. In case there is not, I would suggest you
wrapped the original function in your own project and call the wrapped one
instead. And at last you may dynamically load the original library and link
to it at runtime (using dlopen).

Regards,
Yabin

2014-09-14 11:49 GMT+08:00 Liwei Yang <yangliwei.uestc at gmail.com>:

> Hello,
>
> I run into a situation where I need to provide the library functions, such
> as sqrt() from <math.h> and rand() from <stdlib.h>, in the format of LLVM
> IR bitcode files. Then I can try to link the bitcode of my program against
> these library bitcode files to formulate a holistic bitcode file.
>
> However, these library functions are only available in object format. And
> the source files of them I found have many references to other library
> files.
>
> So, is there any way to translate the library source files into bitcode
> files, so that all the information that the library functions need is
> included and can provide the implementation of these functions to the
> calling program after linking?
>
> Thanks for any suggestions:)
>
> --
> Best Regards
> Liwei
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140915/79b66e84/attachment.html>


More information about the llvm-dev mailing list