[LLVMdev] question about Insert callInst to call a function in library.
Zhang Qiuyu
qiuyu at ucla.edu
Sun Oct 17 00:48:57 PDT 2004
Hi,
Thanks Chris. Following your suggestion, I wrote the code to hide the visible string. Thanks again. Finially, I just realized my LLVM still is 1.2, not 1.3. Now I update it to 1.3.
> > > 5. Insert the for loop that translates the string when main runs.
> > >
> > > For #5, write the for loop you want, compile it with llvmgcc, then figure
> > > out how to generate it at compile time. Alternatively, you could put the
> > > 'decryption' routine in a library and just insert a call to the library.
For decode part. I can write a pass to decode the hide-string bytecode( after hide string pass, I create a globalvariable to store the Key for decode routine. And on the decode pass, I use this Key to recover the orignal bytecode.
It seems not good way to decode. The better way should be to embed the decode routine into the bytecode in the entry of main. So the question is how to do it?
What I can do is that,
I can create call instruction and insert it into entry BB of main. And this call function is able to call the a function of the external library which I could create as I want( just using C style). And I can write decode pass, but I don't know how to build a library as the way you mentioned. Actually, I was thinking the pass I wrote is a dynamic library as libdecode.so. So could I use it? if not, how to build the library you mentioned? I thought the library you mentioned should be similar with the pass. However, I have no idea how combine them?
Thanks
Qiuyu
More information about the llvm-dev
mailing list