[llvm-dev] Questions after completed Kaleidoscope Chapter 1

Praveen Velliengiri via llvm-dev
2019-09-12T17:51:02Z

Hi Bjoren,

For question 1:
As you mentioned, it is used to mangle to the symbol name and interning
them, So ORC can find them at runtime in one of the JITDylibs. It would be
helpful to know what you tried? (please attach code lines).

For question 2:
I guess you might be missing to link libraries that your program depend on,
you can do that via setting up your dynamiclibrary search generator or
getCurrentProcess symbols. Plus, Why do you want to hide them, it is an
error?

For question 3:
Currently, every symbol whether it is added via generator or not, must be
defined in a JITDylib. It is more of a design choice, it makes
implementation and resolution logic much easier within ORC.

Thanks
Praveen


On Thu, 12 Sep 2019 at 22:56, David Blaikie via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> (adding Lang Hames, Orcish Scientist, for Orc-related queries)
>
> On Thu, Sep 12, 2019 at 3:23 AM Gaier, Bjoern via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
> >
> > Hello there,
> >
> >
> >
> > I finished Chapter 1 of the Kaleidoscope tutorial for using the Orc
JIT
> API. I played around with some things and ended with some questions.
> >
> >
> >
> > What is the use of “MangleAndInterner”?
> > I read it is used to mangle the name for the lookup search, but I seem
> to be not able to use it correctly. In my first attempt I used the mangled
> name of my function “?helloOrc@@YAHXZ” with the lookup method – that
> worked.
> >
> > Now I tried “int helloOrc()” and it failed/did not found the function.
> Then I tried “?helloOrc@@YAHXZ” again but removed the use of the
> “MangleAndInterner” instance – that worked again.
> >
> > What is that instance used for?
> >
> >
> >
> > JIT session error
> >
> > When I first run the JIT, the message “JIT session error: Symbols not
> found: { __security_check_cookie, __security_cookie }” was printed into the
> console.
> >
> > Origin
> > Is that message coming from "DynamicLibrarySearchGenerator”?
> >
> >
> >
> > Redirect
> > Can I somehow redirect this message to a string or something, or
silence
> it? I want to keep my console output clean.
> >
> >
> >
> > Generator function
> >
> > Why does the generator function looks like this:
“SymbolNameSet(JITDylib
> &Parent, const SymbolNameSet &Names)”?
> >
> > I understood, that the “Parent” will be the value from
> “ES.getMainJITDylib()” while “Names” will have the names that should be
> resolved. I saw an implementation for the Generator function that kinda
> looked like that:
> > {
> >
> >       orc::SymbolNameSet Added;
> >
> >       orc::SymbolMap     NewSymbols;
> >
> >
> >
> >       for(auto &Name : Names)
> >
> >       {
> >
> >             Added.insert(Name);
> >
> >             NewSymbols[Name] = //Something
> >
> >       }
> >
> >
> >
> >       Parent.define(absoluteSymbols(std::move(NewSymbols)));
> >
> >       return Added;
> >
> > }
> >
> >
> >
> > I understood that “SymbolMap NewSymbols” will store a pair of name and
> the address to resolve – but why do I tell the JITDylib about this?
> > And why do I also keep a map of the symbols I added and have to return
> them? (SymbolNameSet Added)
> >
> >
> >
> > I hope my questions are not too stupid and that someone can help me
with
> that!
> >
> > Thank you a lot x3
> >
> >
> >
> > Kind greetings
> >
> > Björn
> >
> > Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816,
> USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert
> Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima.
> Junichi Tajika
> > _______________________________________________
> > 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/20190912/06679bfd/attachment.html>