[llvm-dev] Questions after completed Kaleidoscope Chapter 1

David Blaikie via llvm-dev
2019-09-12T17:26:18Z

(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