<html><head><meta http-equiv=Content-Type content="text/html; charset=UTF-8"><META name="Author" content="GroupWise WebAccess"><style type="text/css"> 
body p 

        margin: 0px; 
}
</style></head><body style='font-family: Helvetica, Arial, sans-serif; font-size: 13px; '>Hi all,<br><br>I have two problems with the LLVM lli JIT / Interpreter.<br>First of all I get an error with the following message when the <iostream> header is included (JIT and Interpreter):<br>LLVM ERROR: Program used external function '__dso_handle' which could not be resolved!<br><br>This can be resolved by using the -fno-use-cxa-atexit, but is there another way to avoid this error?<br><br>The second issue is that I get the error "Unknown constant pointer type!" when I try to use lli with -force-interpreter=true. <br>If I use the JIT, the program works fine.<br><br>I produced this error by simply using two classes and two cpp files. If both classes are defined in the same cpp file, the Interpreter works correctly.<br><br>Here are the commands I used:<br><br>#Standalone (both classes in one file)<br><br>$ clang++ -O3 -std=c++11 -c -emit-llvm ../src/Standalone.cpp -o standalone.bc<br>$ lli -force-interpreter=false standalone.bc <br>Result 200<br><br>$ lli -force-interpreter=true standalone.bc <br>Result 200<br><br>#Linked Files (classes in separate files)<br><br>$ clang++ -O3 -std=c++11 -c -emit-llvm ../src/Calculation.cpp ../src/Main.cpp<br>$ llvm-link -v Calculation.bc Main.bc -o prog.bc<br>Loading 'Calculation.bc'<br>Linking in 'Calculation.bc'<br>Loading 'Main.bc'<br>Linking in 'Main.bc'<br>Writing bitcode...<br><br>$ lli -force-interpreter=false prog.bc <br>Result 200<br><br>$ lli -force-interpreter=true prog.bc <br>Unknown constant pointer type!<br>UNREACHABLE executed at /home/ahug/llvm/source/llvm/llvm-5.0.0.src/lib/ExecutionEngine/ExecutionEngine.cpp:914!<br>#0 0x0000000002dcdf8f (lli+0x2dcdf8f)<br>#1 0x0000000002dce022 (lli+0x2dce022)<br>#2 0x0000000002dcc061 (lli+0x2dcc061)<br>#3 0x0000000002dcd760 (lli+0x2dcd760)<br>#4 0x00007f28e5512390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)<br>#5 0x00007f28e407c428 gsignal /build/glibc-bfm8X4/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0<br>#6 0x00007f28e407e02a abort /build/glibc-bfm8X4/glibc-2.23/stdlib/abort.c:91:0<br>#7 0x0000000002d31b14 (lli+0x2d31b14)<br>#8 0x00000000028604ee (lli+0x28604ee)<br>#9 0x0000000002894e8b (lli+0x2894e8b)<br>#10 0x000000000288e290 (lli+0x288e290)<br>#11 0x0000000002895a3d (lli+0x2895a3d)<br>#12 0x0000000002898c50 (lli+0x2898c50)<br>#13 0x0000000002897a9b (lli+0x2897a9b)<br>#14 0x000000000289682f (lli+0x289682f)<br>#15 0x00000000028953c8 (lli+0x28953c8)<br>#16 0x000000000287518c (lli+0x287518c)<br>#17 0x000000000285d696 (lli+0x285d696)<br>#18 0x00000000020d8532 (lli+0x20d8532)<br>#19 0x00007f28e4067830 __libc_start_main /build/glibc-bfm8X4/glibc-2.23/csu/../csu/libc-start.c:325:0<br>#20 0x00000000020d6029 (lli+0x20d6029)<br>Stack dump:<br>0.    Program arguments: lli -force-interpreter=true prog.bc <br>Aborted (core dumped)<br><br>For the background:<br>I use Ubuntu 16.04.3 LTS x86_64 and LLVM 5.0.0 build from source with libffi support<br><br>Can you say what I am doing wrong here?<br><br>The complete code is attached.<br><br>Thanks in advance<br><br>Sincerely,<br>Andreas Hug</body></html>