Praveen Velliengiri via llvm-dev
2019-Sep-18 19:38 UTC
[llvm-dev] (How) Can I add C standard libraries to JIT?
Hi Yafei, As david told, you can make the symbols of your host process visible to the JIT'd code through DynamicLibrarySearchGenerator::getForCurrentProcess. On Thu, 19 Sep 2019 at 00:46, David Blaikie via llvm-dev < llvm-dev at lists.llvm.org> wrote:> +Lang Hames <lhames at gmail.com> , JITer of JITs. > > I believe there's some kind of resolver you can add that finds symbols in > the current process. Yes, lli uses some of the same pieces of JIT > infrastructure so you could go look at its source code to see how it's > managing this. > > On Wed, Sep 18, 2019 at 2:23 AM Yafei Liu via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> When I declare some functions in my IR code which belongs to the C >> standard library(printf for example), the JIT will report that symbol >> cannot found. >> >> So is there any way I can add these libraries to my JIT? >> >> P.S. When I using lli, the printf will work, I guess lli is a >> JIT(right?) and it somehow knows where to find the symbol printf >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190919/8c105504/attachment.html>
Yafei Liu via llvm-dev
2019-Sep-19 09:51 UTC
[llvm-dev] (How) Can I add C standard libraries to JIT?
Thanks Praveen, it works. On Thu, Sep 19, 2019 at 3:39 AM Praveen Velliengiri < praveenvelliengiri at gmail.com> wrote:> Hi Yafei, > As david told, you can make the symbols of your host process visible to > the JIT'd code through DynamicLibrarySearchGenerator::getForCurrentProcess. > > > On Thu, 19 Sep 2019 at 00:46, David Blaikie via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> +Lang Hames <lhames at gmail.com> , JITer of JITs. >> >> I believe there's some kind of resolver you can add that finds symbols in >> the current process. Yes, lli uses some of the same pieces of JIT >> infrastructure so you could go look at its source code to see how it's >> managing this. >> >> On Wed, Sep 18, 2019 at 2:23 AM Yafei Liu via llvm-dev < >> llvm-dev at lists.llvm.org> wrote: >> >>> When I declare some functions in my IR code which belongs to the C >>> standard library(printf for example), the JIT will report that symbol >>> cannot found. >>> >>> So is there any way I can add these libraries to my JIT? >>> >>> P.S. When I using lli, the printf will work, I guess lli is a >>> JIT(right?) and it somehow knows where to find the symbol printf >>> _______________________________________________ >>> LLVM Developers mailing list >>> llvm-dev at lists.llvm.org >>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >>> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190919/e3fedf98/attachment.html>
Praveen Velliengiri via llvm-dev
2019-Sep-19 09:52 UTC
[llvm-dev] (How) Can I add C standard libraries to JIT?
You're welcome! On Thu, 19 Sep 2019 at 15:21, Yafei Liu <yfliu at mobvoi.com> wrote:> Thanks Praveen, it works. > > On Thu, Sep 19, 2019 at 3:39 AM Praveen Velliengiri < > praveenvelliengiri at gmail.com> wrote: > >> Hi Yafei, >> As david told, you can make the symbols of your host process visible to >> the JIT'd code through DynamicLibrarySearchGenerator::getForCurrentProcess. >> >> >> On Thu, 19 Sep 2019 at 00:46, David Blaikie via llvm-dev < >> llvm-dev at lists.llvm.org> wrote: >> >>> +Lang Hames <lhames at gmail.com> , JITer of JITs. >>> >>> I believe there's some kind of resolver you can add that finds symbols >>> in the current process. Yes, lli uses some of the same pieces of JIT >>> infrastructure so you could go look at its source code to see how it's >>> managing this. >>> >>> On Wed, Sep 18, 2019 at 2:23 AM Yafei Liu via llvm-dev < >>> llvm-dev at lists.llvm.org> wrote: >>> >>>> When I declare some functions in my IR code which belongs to the C >>>> standard library(printf for example), the JIT will report that symbol >>>> cannot found. >>>> >>>> So is there any way I can add these libraries to my JIT? >>>> >>>> P.S. When I using lli, the printf will work, I guess lli is a >>>> JIT(right?) and it somehow knows where to find the symbol printf >>>> _______________________________________________ >>>> LLVM Developers mailing list >>>> llvm-dev at lists.llvm.org >>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >>>> >>> _______________________________________________ >>> LLVM Developers mailing list >>> llvm-dev at lists.llvm.org >>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >>> >>-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190919/37dd985e/attachment.html>