[llvm-dev] Error running clang++ generated bitcode in lli (original) (raw)

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Tue Aug 24 17:58:07 PDT 2021


I /think/ this might be because lli doesn't support global ctors (Lang - can you confirm?) & so c++'s iostreams haven't been initialized. Maybe try a C-style printf hello world, and maybe try printf printing in a global ctor, see if that executes?

C style hello world is just generally simpler/doesn't need to exercise quite so many complicated things as C++ iostream's hello world, so would be a good place to start to narrow down the problem space in any case.

On Tue, Aug 24, 2021 at 5:01 PM Leer Laar via llvm-dev < llvm-dev at lists.llvm.org> wrote:

I am trying to generate a bit code from a c++ source code and running it through the just-in-time compiler. When I compile through the clang++ and generate binary executable it runs perfectly but when I generated the bitcode and tried running through the JIT with lli command it generated a run-time error. Could you please help me understand what's going on.

For example: Let example.cpp contains the following code: #include int main(){ std::cout << "\nHello World!"; return 0; } I am using the following command to generate executable which runs perfectly fine. clang++ example.cpp I am using the following command to generate the bitcode: clang++ -S -emit-llvm example.cpp And then running through the JIT using the following command which generates run-time error: lli example.ll I am getting the following access violation error: Stack dump:0. Program arguments: lli example.ll #0 0x00000000025fd9af llvm::sys::PrintStackTrace(llvm::rawostream&) /home/xpc/llvm/llvm-project1/llvm-project/llvm/lib/Support/Unix/Signals.inc:564:0 #1 0x00000000025fda42 PrintStackTraceSignalHandler(void*) /home/xpc/llvm/llvm-project1/llvm-project/llvm/lib/Support/Unix/Signals.inc:625:0 #2 0x00000000025fb7ca llvm::sys::RunSignalHandlers() /home/xpc/llvm/llvm-project1/llvm-project/llvm/lib/Support/Signals.cpp:68:0 #3 0x00000000025fd329 SignalHandler(int) /home/xpc/llvm/llvm-project1/llvm-project/llvm/lib/Support/Unix/Signals.inc:406:0 _#4 0x00007fa75dbdc390 restorert (/lib/x8664-linux-gnu/libpthread.so.0+0x11390)Segmentation fault (core dumped)


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/20210824/d1e24c14/attachment.html>



More information about the llvm-dev mailing list