[klee-dev] Compiling a whole application

Kuchta, Tomasz t.kuchta12 at imperial.ac.uk
Tue May 19 09:37:49 BST 2015


Hi Tom,

> On 19 May 2015, at 03:10, Tom Ritter <tom at ritter.vg> wrote:
> 
> On 18 May 2015 at 05:03, Kuchta, Tomasz <t.kuchta12 at imperial.ac.uk> wrote:
>> Hi Tom,
>> 
>> You mentioned that you compile llvm 2.9 from source using clang 2.9.
>> Did you try also with llvm-gcc? I think that if you go for 2.9, that probably needs to be llvm-gcc as well.
> 
> I tried:
> - the binary distribution of llvm-gcc 2.9 (in my first email)
> 
> - compiling the source distribution of llvm-gcc 2.9, it failed with
> this error: GNUmakefile:28: /CoreOS/Standard/Standard.make: No such
> file or directory
> 

I don’t have much experience with the 3.4 unfortunately.
I’ve noticed that you’ve tried 2.9 under CoreOS - is that correct?
I’ve always run it under Ubuntu, currently under version 14.

What I usually do is to take the binary distribution of llvm-gcc and compile the source distribution
of llvm. Have you also tried that by any chance?

Thanks,
Tomek

> - following the 3.4 experimental instructions
> (http://klee.github.io/experimental/), with LLVM_COMPILER=clang and
> LLVM_COMPILER_PATH=/usr/lib/llvm-3.4/bin
> 
> I was able to get further in my experimenting following the 3.4
> experimental instructions though.  I was able to get my target
> applications compiled, but I can't run them.  I'm trying to get
> openssl and tor working as two starting points.
> 
> Application one:
> $ extract-bc tor
> $ klee --libc=uclibc --posix-runtime ./tor.bc version
> KLEE: NOTE: Using klee-uclibc :
> /home/tom/klee/klee-3.4/build/Release+Asserts/lib/klee-uclibc.bca
> KLEE: NOTE: Using model:
> /home/tom/klee/klee-3.4/build/Release+Asserts/lib/libkleeRuntimePOSIX.bca
> KLEE: output directory is "/home/tom/klee/tor/src/or/./klee-out-0"
> LLVM ERROR: Code generator does not support intrinsic function
> 'llvm.objectsize.i64.p0i8'!
> 
> Application one with --optimize:
> $ klee --libc=uclibc --posix-runtime --optimize ./tor.bc version
> 
>                                 1 ↵
> KLEE: NOTE: Using klee-uclibc :
> /home/tom/klee/klee-3.4/build/Release+Asserts/lib/klee-uclibc.bca
> KLEE: NOTE: Using model:
> /home/tom/klee/klee-3.4/build/Release+Asserts/lib/libkleeRuntimePOSIX.bca
> KLEE: output directory is "/home/tom/klee/tor/src/or/./klee-out-1"
> zext source and destination must both be a vector or neither
>  %int_cast_to_i64 = zext <8 x i16> <i16 8, i16 8, i16 8, i16 8, i16
> 8, i16 8, i16 8, i16 8> to i64
> Broken module found, compilation aborted!
> 0  libLLVM-3.4.so.1 0x00007ff2b426c042
> llvm::sys::PrintStackTrace(_IO_FILE*) + 34
> 1  libLLVM-3.4.so.1 0x00007ff2b426be34
> 2  libpthread.so.0  0x00007ff2b316f340
> 3  libc.so.6        0x00007ff2b22e8cc9 gsignal + 57
> 4  libc.so.6        0x00007ff2b22ec0d8 abort + 328
> 5  libLLVM-3.4.so.1 0x00007ff2b3c5b4f1
> 6  libLLVM-3.4.so.1 0x00007ff2b3c645b3
> 7  libLLVM-3.4.so.1 0x00007ff2b3c3ba27
> llvm::FPPassManager::runOnFunction(llvm::Function&) + 471
> 8  libLLVM-3.4.so.1 0x00007ff2b3c3baab
> llvm::FPPassManager::runOnModule(llvm::Module&) + 43
> 9  libLLVM-3.4.so.1 0x00007ff2b3c3df65
> llvm::legacy::PassManagerImpl::run(llvm::Module&) + 693
> 10 klee             0x0000000000495458 llvm::Optimize(llvm::Module*) + 216
> 11 klee             0x0000000000491881
> klee::KModule::prepare(klee::Interpreter::ModuleOptions const&,
> klee::InterpreterHandler*) + 3425
> 12 klee             0x000000000044bd8f
> klee::Executor::setModule(llvm::Module*,
> klee::Interpreter::ModuleOptions const&) + 239
> 13 klee             0x000000000043d874 main + 4164
> 14 libc.so.6        0x00007ff2b22d3ec5 __libc_start_main + 245
> 15 klee             0x0000000000445b50
> [1]    3947 abort (core dumped)  klee --libc=uclibc --posix-runtime
> --optimize ./tor.bc version
> 
> 
> Application two: (FWIW I compiled openssl with 'no-asm')
> $ klee --libc=uclibc --posix-runtime ./openssl.bc version
> KLEE: NOTE: Using klee-uclibc :
> /home/tom/klee/klee-3.4/build/Release+Asserts/lib/klee-uclibc.bca
> KLEE: NOTE: Using model:
> /home/tom/klee/klee-3.4/build/Release+Asserts/lib/libkleeRuntimePOSIX.bca
> KLEE: output directory is "/home/tom/klee/openssl/apps/./klee-out-3"
> KLEE: WARNING ONCE: function "process_responder" has inline asm
> KLEE: WARNING ONCE: function "s_client_main" has inline asm
> KLEE: WARNING ONCE: function "sv_body" has inline asm
> KLEE: WARNING ONCE: function "doConnection" has inline asm
> KLEE: WARNING ONCE: function "__libc_accept" has inline asm
> KLEE: WARNING ONCE: function "bind" has inline asm
> KLEE: WARNING ONCE: function "__libc_connect" has inline asm
> KLEE: WARNING ONCE: function "getsockname" has inline asm
> KLEE: WARNING ONCE: function "getsockopt" has inline asm
> KLEE: WARNING ONCE: function "listen" has inline asm
> KLEE: WARNING ONCE: function "__libc_recvfrom" has inline asm
> KLEE: WARNING ONCE: function "__libc_sendto" has inline asm
> KLEE: WARNING ONCE: function "setsockopt" has inline asm
> KLEE: WARNING ONCE: function "shutdown" has inline asm
> KLEE: WARNING ONCE: function "socket" has inline asm
> KLEE: WARNING: undefined reference to function: __ctype_b_loc
> KLEE: WARNING: undefined reference to function: __ctype_tolower_loc
> KLEE: WARNING: undefined reference to function: __ctype_toupper_loc
> KLEE: WARNING: undefined reference to function: __isoc99_sscanf
> KLEE: WARNING: undefined reference to function: alarm
> KLEE: WARNING: undefined reference to function: dladdr
> KLEE: WARNING: undefined reference to function: dlclose
> KLEE: WARNING: undefined reference to function: dlerror
> KLEE: WARNING: undefined reference to function: dlopen
> KLEE: WARNING: undefined reference to function: dlsym
> KLEE: WARNING: undefined reference to function: poll
> LLVM ERROR: invalid argument to evalConstant()
> 
> Application two with --optimize:
> $ extract-bc openssl
> $ klee --libc=uclibc --posix-runtime --optimize ./openssl.bc version
> 
>                           1 ↵
> KLEE: NOTE: Using klee-uclibc :
> /home/tom/klee/klee-3.4/build/Release+Asserts/lib/klee-uclibc.bca
> KLEE: NOTE: Using model:
> /home/tom/klee/klee-3.4/build/Release+Asserts/lib/libkleeRuntimePOSIX.bca
> KLEE: output directory is "/home/tom/klee/openssl/apps/./klee-out-4"
> Bitcast requires types of same width
>  %int_cast_to_i6470 = bitcast <2 x i64> <i64 16, i64 16> to i64
> Broken module found, compilation aborted!
> 0  libLLVM-3.4.so.1 0x00007f32aa947042
> llvm::sys::PrintStackTrace(_IO_FILE*) + 34
> 1  libLLVM-3.4.so.1 0x00007f32aa946e34
> 2  libpthread.so.0  0x00007f32a984a340
> 3  libc.so.6        0x00007f32a89c3cc9 gsignal + 57
> 4  libc.so.6        0x00007f32a89c70d8 abort + 328
> 5  libLLVM-3.4.so.1 0x00007f32aa3364f1
> 6  libLLVM-3.4.so.1 0x00007f32aa33f5b3
> 7  libLLVM-3.4.so.1 0x00007f32aa316a27
> llvm::FPPassManager::runOnFunction(llvm::Function&) + 471
> 8  libLLVM-3.4.so.1 0x00007f32aa316aab
> llvm::FPPassManager::runOnModule(llvm::Module&) + 43
> 9  libLLVM-3.4.so.1 0x00007f32aa318f65
> llvm::legacy::PassManagerImpl::run(llvm::Module&) + 693
> 10 klee             0x0000000000495458 llvm::Optimize(llvm::Module*) + 216
> 11 klee             0x0000000000491881
> klee::KModule::prepare(klee::Interpreter::ModuleOptions const&,
> klee::InterpreterHandler*) + 3425
> 12 klee             0x000000000044bd8f
> klee::Executor::setModule(llvm::Module*,
> klee::Interpreter::ModuleOptions const&) + 239
> 13 klee             0x000000000043d874 main + 4164
> 14 libc.so.6        0x00007f32a89aeec5 __libc_start_main + 245
> 15 klee             0x0000000000445b50
> [1]    4190 abort (core dumped)  klee --libc=uclibc --posix-runtime
> --optimize ./openssl.bc version

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 7125 bytes
Desc: not available
URL: <http://mailman.ic.ac.uk/pipermail/klee-dev/attachments/20150519/c0a57654/attachment.bin>


More information about the klee-dev mailing list