[llvm-dev] Questions after completed Kaleidoscope Chapter 1

Gaier, Bjoern via llvm-dev
2019-09-12T10:23:25Z

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.


  1.  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?



  1.  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.



  1.  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
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20190912/b4fcc869/attachment.html>