我已将Wireshark
编译成LLVM
然后我继续链接到一些我编译成LLVM
的库。
我链接的图书馆是libwsutil
,libz
和libpcap
。但是KLEE仍然给我一个libpcap
未定义函数的警告。
我使用这些标志编译了libpcap:
CC="llvm-gcc" CFLAGS="-flto -c" AR="llvm-ar" LD="llvm-ld"
这些标志也适用于其他图书馆。
可能是什么原因?
KLEE: WARNING ONCE: function "capture_loop_dispatch" has inline asm
KLEE: WARNING ONCE: function "__user_main" has inline asm
KLEE: WARNING: undefined reference to function: __ctype_b_loc
KLEE: WARNING: undefined reference to function: __xstat64
KLEE: WARNING: undefined reference to function: bpf_image
KLEE: WARNING: undefined reference to function: cap_free
KLEE: WARNING: undefined reference to function: cap_init
KLEE: WARNING: undefined reference to function: cap_set_flag
KLEE: WARNING: undefined reference to function: cap_set_proc
...
...
KLEE: WARNING: undefined reference to function: lseek64
KLEE: WARNING: undefined reference to function: pcap_activate
KLEE: WARNING: undefined reference to function: pcap_breakloop
KLEE: WARNING: undefined reference to function: pcap_can_set_rfmon
KLEE: WARNING: undefined reference to function: pcap_close
KLEE: WARNING: undefined reference to function: pcap_compile
KLEE: WARNING: undefined reference to function: pcap_create
KLEE: WARNING: undefined reference to function: pcap_datalink
KLEE: WARNING: undefined reference to function: pcap_datalink_name_to_val
KLEE: WARNING: undefined reference to function: pcap_datalink_val_to_description
KLEE: WARNING: undefined reference to function: pcap_datalink_val_to_name
KLEE: WARNING: undefined reference to function: pcap_dispatch
KLEE: WARNING: undefined reference to function: pcap_findalldevs
KLEE: WARNING: undefined reference to function: pcap_free_datalinks
KLEE: WARNING: undefined reference to function: pcap_freealldevs
KLEE: WARNING: undefined reference to function: pcap_freecode
KLEE: WARNING: undefined reference to function: pcap_get_selectable_fd
KLEE: WARNING: undefined reference to function: pcap_geterr
KLEE: WARNING: undefined reference to function: pcap_lib_version
KLEE: WARNING: undefined reference to function: pcap_list_datalinks
KLEE: WARNING: undefined reference to function: pcap_lookupnet
KLEE: WARNING: undefined reference to function: pcap_open_live
KLEE: WARNING: undefined reference to function: pcap_set_buffer_size
KLEE: WARNING: undefined reference to function: pcap_set_datalink
KLEE: WARNING: undefined reference to function: pcap_set_promisc
KLEE: WARNING: undefined reference to function: pcap_set_rfmon
KLEE: WARNING: undefined reference to function: pcap_set_snaplen
KLEE: WARNING: undefined reference to function: pcap_set_timeout
KLEE: WARNING: undefined reference to function: pcap_setfilter
KLEE: WARNING: undefined reference to function: pcap_snapshot
KLEE: WARNING: undefined reference to function: pcap_stats
KLEE: WARNING: undefined reference to function: pcap_statustostr
KLEE: WARNING: undefined reference to function: prctl
答案 0 :(得分:2)
阅读"入门" KLEE在Getting Started
默认情况下,KLEE适用于已关闭的程序(不使用任何程序的程序) 外部代码,如C库函数)。但是,如果你愿意的话 使用KLEE运行您想要启用KLEE POSIX的实际程序 运行时,它建立在uClibc C库之上。
因此,KLEE默认不能使用C库函数,如果您使用带有选项import re
import os
import sys
import numpy as np
import numpy.linalg as LA
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
trainingdataDir = 'C:\\data\\Training data'
tfidf_vectorizer = TfidfVectorizer()
transformer = TfidfTransformer()
def readfile(trainingdataDir):
train_set = []
for file in os.listdir(trainingdataDir):
trainingfiles = os.path.join(trainingdataDir, file)
if os.path.isfile(trainingfiles):
data = open(trainingfiles, 'r')
data_set=str.decode(data.read())
train_set.append(data_set)
return train_set
tfidf_matrix_train = tfidf_vectorizer.fit_transform(readfile(trainingdataDir))
print 'Fit Vectorizer to train set',tfidf_matrix_train
print "cosine scores ==> ",cosine_similarity(tfidf_matrix_train[0:1], tfidf_matrix_train)
的KLEE,KLEE会将外部函数链接到您的IR代码,并执行IR代码