svf-tools 1.0.1297 → 1.0.1299
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build.sh
CHANGED
|
@@ -30,9 +30,11 @@ UbuntuArmLLVM="https://github.com/llvm/llvm-project/releases/download/llvmorg-${
|
|
|
30
30
|
UbuntuLLVM_RTTI="https://github.com/bjjwwang/SVF-LLVM/releases/download/${LLVMVer}/llvm-${LLVMVer}-ubuntu22-rtti-x86-64.tar.gz"
|
|
31
31
|
UbuntuLLVM="https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVMVer}/clang+llvm-${LLVMVer}-x86_64-linux-gnu-ubuntu-18.04.tar.xz"
|
|
32
32
|
SourceLLVM="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${LLVMVer}.zip"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
Z3Ver=4.15.4
|
|
34
|
+
Z3PrebuiltBase="https://github.com/SVF-tools/SVF-npm/raw/prebuilt-libs"
|
|
35
|
+
UbuntuZ3="${Z3PrebuiltBase}/z3-${Z3Ver}-x86_64-ubuntu-22.04.zip"
|
|
36
|
+
UbuntuZ3Arm="${Z3PrebuiltBase}/z3-${Z3Ver}-arm64-ubuntu-22.04.zip"
|
|
37
|
+
MacOSZ3Arm="${Z3PrebuiltBase}/z3-${Z3Ver}-arm64-macos-14.zip"
|
|
36
38
|
|
|
37
39
|
# Keep LLVM version suffix for version checking and better debugging
|
|
38
40
|
# keep the version consistent with LLVM_DIR in setup.sh and llvm_version in Dockerfile
|
|
@@ -116,27 +118,6 @@ function check_xz {
|
|
|
116
118
|
fi
|
|
117
119
|
}
|
|
118
120
|
|
|
119
|
-
function build_z3_from_source {
|
|
120
|
-
mkdir "$Z3Home"
|
|
121
|
-
echo "Downloading Z3 source..."
|
|
122
|
-
generic_download_file "$SourceZ3" z3.zip
|
|
123
|
-
check_unzip
|
|
124
|
-
echo "Unzipping Z3 source..."
|
|
125
|
-
mkdir z3-source
|
|
126
|
-
unzip z3.zip -d z3-source
|
|
127
|
-
|
|
128
|
-
echo "Building Z3..."
|
|
129
|
-
mkdir z3-build
|
|
130
|
-
cd z3-build
|
|
131
|
-
# /* is a dirty hack to get z3-version...
|
|
132
|
-
cmake -DCMAKE_INSTALL_PREFIX="$SVFHOME/$Z3Home" -DZ3_BUILD_LIBZ3_SHARED=false ../z3-source/*
|
|
133
|
-
cmake --build . -j ${jobs}
|
|
134
|
-
cmake --install .
|
|
135
|
-
|
|
136
|
-
cd ..
|
|
137
|
-
rm -r z3-source z3-build z3.zip
|
|
138
|
-
}
|
|
139
|
-
|
|
140
121
|
function build_llvm_from_source {
|
|
141
122
|
mkdir "$LLVMHome"
|
|
142
123
|
echo "Downloading LLVM source..."
|
|
@@ -179,6 +160,64 @@ function check_and_install_brew {
|
|
|
179
160
|
fi
|
|
180
161
|
}
|
|
181
162
|
|
|
163
|
+
function unpack_z3_package {
|
|
164
|
+
if [[ $# -ne 1 ]]; then
|
|
165
|
+
echo "$0: bad args to unpack_z3_package!"
|
|
166
|
+
exit 1
|
|
167
|
+
fi
|
|
168
|
+
|
|
169
|
+
local archive="$1"
|
|
170
|
+
local unpack_dir="z3-unpack"
|
|
171
|
+
local nested_zip=""
|
|
172
|
+
local z3_dir=""
|
|
173
|
+
|
|
174
|
+
rm -rf "$unpack_dir" "$Z3Home"
|
|
175
|
+
mkdir "$unpack_dir"
|
|
176
|
+
unzip -q "$archive" -d "$unpack_dir"
|
|
177
|
+
|
|
178
|
+
if [[ -d "$unpack_dir/z3.obj" ]]; then
|
|
179
|
+
mv "$unpack_dir/z3.obj" "$Z3Home"
|
|
180
|
+
else
|
|
181
|
+
nested_zip=$(find "$unpack_dir" -maxdepth 1 -type f -name 'z3-*.zip' | head -n 1)
|
|
182
|
+
if [[ -n "$nested_zip" ]]; then
|
|
183
|
+
mkdir "$unpack_dir/nested"
|
|
184
|
+
unzip -q "$nested_zip" -d "$unpack_dir/nested"
|
|
185
|
+
if [[ -d "$unpack_dir/nested/z3.obj" ]]; then
|
|
186
|
+
mv "$unpack_dir/nested/z3.obj" "$Z3Home"
|
|
187
|
+
else
|
|
188
|
+
z3_dir=$(find "$unpack_dir/nested" -mindepth 1 -maxdepth 1 -type d -name 'z3-*' | head -n 1)
|
|
189
|
+
[[ -n "$z3_dir" ]] && mv "$z3_dir" "$Z3Home"
|
|
190
|
+
fi
|
|
191
|
+
else
|
|
192
|
+
z3_dir=$(find "$unpack_dir" -mindepth 1 -maxdepth 1 -type d -name 'z3-*' | head -n 1)
|
|
193
|
+
[[ -n "$z3_dir" ]] && mv "$z3_dir" "$Z3Home"
|
|
194
|
+
fi
|
|
195
|
+
fi
|
|
196
|
+
|
|
197
|
+
rm -rf "$unpack_dir"
|
|
198
|
+
|
|
199
|
+
if [[ ! -d "$Z3Home/include" || ! -d "$Z3Home/bin" ]]; then
|
|
200
|
+
echo "Z3 package did not contain the expected $Z3Home/bin and $Z3Home/include layout."
|
|
201
|
+
exit 1
|
|
202
|
+
fi
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function fix_macos_z3_install_name {
|
|
206
|
+
if [[ "$sysOS" != "Darwin" ]]; then
|
|
207
|
+
return
|
|
208
|
+
fi
|
|
209
|
+
|
|
210
|
+
# Only rewrite the prebuilt Z3 that build.sh owns, not a user-provided Z3_DIR.
|
|
211
|
+
if [[ "$Z3_DIR" != "$SVFHOME/$Z3Home" ]]; then
|
|
212
|
+
return
|
|
213
|
+
fi
|
|
214
|
+
|
|
215
|
+
local z3_dylib="$Z3_DIR/bin/libz3.dylib"
|
|
216
|
+
if [[ -f "$z3_dylib" ]]; then
|
|
217
|
+
install_name_tool -id "@rpath/libz3.dylib" "$z3_dylib"
|
|
218
|
+
fi
|
|
219
|
+
}
|
|
220
|
+
|
|
182
221
|
# OS-specific values.
|
|
183
222
|
urlLLVM=""
|
|
184
223
|
urlZ3=""
|
|
@@ -188,9 +227,17 @@ urlZ3=""
|
|
|
188
227
|
# M1 Macs give back arm64, some Linuxes can give aarch64 for arm architecture
|
|
189
228
|
#######
|
|
190
229
|
if [[ $sysOS == "Darwin" ]]; then
|
|
191
|
-
|
|
230
|
+
if [[ "$arch" == "arm64" ]]; then
|
|
231
|
+
urlZ3="$MacOSZ3Arm"
|
|
232
|
+
else
|
|
233
|
+
if [[ -z "$Z3_DIR" && ! -d "$Z3Home" ]]; then
|
|
234
|
+
echo "No prebuilt Z3 package is available for macOS architecture '$arch'."
|
|
235
|
+
echo "Set Z3_DIR to a compatible z3.obj directory before running build.sh."
|
|
236
|
+
exit 1
|
|
237
|
+
fi
|
|
238
|
+
fi
|
|
192
239
|
elif [[ $sysOS == "Linux" ]]; then
|
|
193
|
-
if [[ "$arch" == "aarch64" ]]; then
|
|
240
|
+
if [[ "$arch" == "aarch64" || "$arch" == "arm64" ]]; then
|
|
194
241
|
if [[ "$BUILD_DYN_LIB" == "ON" ]]; then
|
|
195
242
|
urlLLVM="$UbuntuArmLLVM_RTTI"
|
|
196
243
|
else
|
|
@@ -221,6 +268,7 @@ if [[ ! -d "$LLVM_DIR" ]]; then
|
|
|
221
268
|
if [[ ! -d "$LLVMHome" ]]; then
|
|
222
269
|
if [[ "$sysOS" = "Darwin" ]]; then
|
|
223
270
|
echo "Installing LLVM binary for $OSDisplayName"
|
|
271
|
+
check_and_install_brew
|
|
224
272
|
brew install llvm@${MajorLLVMVer}
|
|
225
273
|
# check whether llvm is installed
|
|
226
274
|
if [ $? -eq 0 ]; then
|
|
@@ -250,35 +298,23 @@ fi
|
|
|
250
298
|
#######
|
|
251
299
|
if [[ ! -d "$Z3_DIR" ]]; then
|
|
252
300
|
if [[ ! -d "$Z3Home" ]]; then
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
else
|
|
260
|
-
echo "z3 binary installation failed."
|
|
261
|
-
exit 1
|
|
262
|
-
fi
|
|
263
|
-
mkdir -p $SVFHOME/$Z3Home
|
|
264
|
-
ln -s $(brew --prefix z3)/* $SVFHOME/$Z3Home
|
|
265
|
-
else
|
|
266
|
-
# everything else downloads pre-built lib
|
|
267
|
-
echo "Downloading Z3 binary for $OSDisplayName"
|
|
268
|
-
generic_download_file "$urlZ3" z3.zip
|
|
269
|
-
check_unzip
|
|
270
|
-
echo "Unzipping z3 package..."
|
|
271
|
-
unzip -q "z3.zip" && mv ./z3-* ./$Z3Home
|
|
272
|
-
rm z3.zip
|
|
273
|
-
fi
|
|
301
|
+
echo "Downloading prebuilt Z3 ${Z3Ver} package for $sysOS/$arch"
|
|
302
|
+
generic_download_file "$urlZ3" z3.zip
|
|
303
|
+
check_unzip
|
|
304
|
+
echo "Unzipping z3 package..."
|
|
305
|
+
unpack_z3_package z3.zip
|
|
306
|
+
rm z3.zip
|
|
274
307
|
fi
|
|
275
308
|
|
|
276
309
|
export Z3_DIR="$SVFHOME/$Z3Home"
|
|
277
310
|
fi
|
|
278
311
|
|
|
312
|
+
fix_macos_z3_install_name
|
|
313
|
+
|
|
279
314
|
# Add LLVM & Z3 to $PATH and $LD_LIBRARY_PATH (prepend so that selected instances will be used first)
|
|
280
|
-
PATH=$LLVM_DIR/bin:$Z3_DIR/bin:$PATH
|
|
281
|
-
LD_LIBRARY_PATH=$LLVM_DIR/lib:$
|
|
315
|
+
export PATH=$LLVM_DIR/bin:$Z3_DIR/bin:$PATH
|
|
316
|
+
export LD_LIBRARY_PATH=$LLVM_DIR/lib:$Z3_DIR/bin:$LD_LIBRARY_PATH
|
|
317
|
+
export DYLD_LIBRARY_PATH=$LLVM_DIR/lib:$Z3_DIR/bin:$DYLD_LIBRARY_PATH
|
|
282
318
|
|
|
283
319
|
echo "LLVM_DIR=$LLVM_DIR"
|
|
284
320
|
echo "Z3_DIR=$Z3_DIR"
|
|
@@ -293,6 +329,15 @@ else
|
|
|
293
329
|
fi
|
|
294
330
|
BUILD_DIR="./${BUILD_TYPE}-build"
|
|
295
331
|
|
|
332
|
+
CMAKE_RPATH_ARGS=()
|
|
333
|
+
if [[ "$sysOS" == "Darwin" ]]; then
|
|
334
|
+
CMAKE_RPATH_ARGS=(
|
|
335
|
+
-DCMAKE_MACOSX_RPATH=ON
|
|
336
|
+
"-DCMAKE_BUILD_RPATH=@loader_path/../lib;@loader_path/../../${Z3Home}/bin"
|
|
337
|
+
"-DCMAKE_INSTALL_RPATH=@loader_path/../lib;@loader_path/../../../${Z3Home}/bin"
|
|
338
|
+
)
|
|
339
|
+
fi
|
|
340
|
+
|
|
296
341
|
rm -rf "${BUILD_DIR}"
|
|
297
342
|
mkdir "${BUILD_DIR}"
|
|
298
343
|
# If you need shared libs, turn BUILD_SHARED_LIBS on
|
|
@@ -300,6 +345,7 @@ cmake -D CMAKE_BUILD_TYPE:STRING="${BUILD_TYPE}" \
|
|
|
300
345
|
-DSVF_ENABLE_ASSERTIONS:BOOL=true \
|
|
301
346
|
-DSVF_SANITIZE="${SVF_SANITIZER}" \
|
|
302
347
|
-DBUILD_SHARED_LIBS=${BUILD_DYN_LIB} \
|
|
348
|
+
"${CMAKE_RPATH_ARGS[@]}" \
|
|
303
349
|
-S "${SVFHOME}" -B "${BUILD_DIR}"
|
|
304
350
|
cmake --build "${BUILD_DIR}" -j ${jobs}
|
|
305
351
|
|
|
@@ -4,30 +4,62 @@
|
|
|
4
4
|
|
|
5
5
|
include(GNUInstallDirs)
|
|
6
6
|
|
|
7
|
+
set(_Z3_HINTS ${Z3_HOME} $ENV{Z3_HOME} ${Z3_DIR} $ENV{Z3_DIR})
|
|
8
|
+
set(_Z3_EXPLICIT_ROOT "")
|
|
9
|
+
foreach(_Z3_HINT IN LISTS _Z3_HINTS)
|
|
10
|
+
if(_Z3_HINT AND EXISTS "${_Z3_HINT}/include/z3++.h")
|
|
11
|
+
set(_Z3_EXPLICIT_ROOT "${_Z3_HINT}")
|
|
12
|
+
break()
|
|
13
|
+
endif()
|
|
14
|
+
endforeach()
|
|
15
|
+
|
|
7
16
|
# Try upstream/system CONFIG package first; use it if found (sets required variables):
|
|
8
|
-
|
|
17
|
+
if(NOT _Z3_EXPLICIT_ROOT)
|
|
18
|
+
find_package(Z3 CONFIG QUIET HINTS ${_Z3_HINTS})
|
|
19
|
+
endif()
|
|
9
20
|
if(Z3_FOUND)
|
|
10
21
|
if(NOT Z3_FIND_QUIETLY)
|
|
11
22
|
message(STATUS "Found upstream/system Z3 package (Z3Config.cmake)")
|
|
12
23
|
endif()
|
|
13
24
|
else()
|
|
14
25
|
if(NOT Z3_FIND_QUIETLY)
|
|
15
|
-
|
|
26
|
+
if(_Z3_EXPLICIT_ROOT)
|
|
27
|
+
message(STATUS "Using explicit Z3 root: ${_Z3_EXPLICIT_ROOT}")
|
|
28
|
+
else()
|
|
29
|
+
message(STATUS "Failed to find upstream/system Z3 package; reverting to manual search")
|
|
30
|
+
endif()
|
|
16
31
|
endif()
|
|
17
32
|
|
|
18
33
|
# Fall back to explicit manual header + lib search (prioritise searching $Z3_DIR)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
if(_Z3_EXPLICIT_ROOT)
|
|
35
|
+
find_library(
|
|
36
|
+
Z3_LIBRARY_DIR
|
|
37
|
+
NAMES z3 libz3
|
|
38
|
+
HINTS ${_Z3_EXPLICIT_ROOT}
|
|
39
|
+
PATH_SUFFIXES bin lib ${CMAKE_INSTALL_BINDIR} ${CMAKE_INSTALL_LIBDIR}
|
|
40
|
+
NO_DEFAULT_PATH
|
|
41
|
+
)
|
|
42
|
+
find_path(
|
|
43
|
+
Z3_INCLUDE_DIR
|
|
44
|
+
NAMES z3++.h
|
|
45
|
+
HINTS ${_Z3_EXPLICIT_ROOT}
|
|
46
|
+
PATH_SUFFIXES include ${CMAKE_INSTALL_INCLUDEDIR}
|
|
47
|
+
NO_DEFAULT_PATH
|
|
48
|
+
)
|
|
49
|
+
else()
|
|
50
|
+
find_library(
|
|
51
|
+
Z3_LIBRARY_DIR
|
|
52
|
+
NAMES z3 libz3
|
|
53
|
+
HINTS ${_Z3_HINTS}
|
|
54
|
+
PATH_SUFFIXES bin lib ${CMAKE_INSTALL_BINDIR} ${CMAKE_INSTALL_LIBDIR}
|
|
55
|
+
)
|
|
56
|
+
find_path(
|
|
57
|
+
Z3_INCLUDE_DIR
|
|
58
|
+
NAMES z3++.h
|
|
59
|
+
HINTS ${_Z3_HINTS}
|
|
60
|
+
PATH_SUFFIXES include ${CMAKE_INSTALL_INCLUDEDIR}
|
|
61
|
+
)
|
|
62
|
+
endif()
|
|
31
63
|
|
|
32
64
|
# If the headers were found, find & extract the Z3 version number
|
|
33
65
|
set(_ver_h "${Z3_INCLUDE_DIR}/z3_version.h")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1299",
|
|
4
4
|
"description": "* <b>[TypeClone](https://github.com/SVF-tools/SVF/wiki/TypeClone) published in our [ECOOP paper](https://yuleisui.github.io/publications/ecoop20.pdf) is now available in SVF </b> * <b>SVF now uses a single script for its build. Just type [`source ./build.sh`](https://github.com/SVF-tools/SVF/blob/master/build.sh) in your terminal, that's it!</b> * <b>SVF now supports LLVM-10.0.0! </b> * <b>We thank [bsauce](https://github.com/bsauce) for writing a user manual of SVF ([link1](https://www.jianshu.com/p/068a08ec749c) and [link2](https://www.jianshu.com/p/777c30d4240e)) in Chinese </b> * <b>SVF now supports LLVM-9.0.0 (Thank [Byoungyoung Lee](https://github.com/SVF-tools/SVF/issues/142) for his help!). </b> * <b>SVF now supports a set of [field-sensitive pointer analyses](https://yuleisui.github.io/publications/sas2019a.pdf). </b> * <b>[Use SVF as an external lib](https://github.com/SVF-tools/SVF/wiki/Using-SVF-as-a-lib-in-your-own-tool) for your own project (Contributed by [Hongxu Chen](https://github.com/HongxuChen)). </b> * <b>SVF now supports LLVM-7.0.0. </b> * <b>SVF now supports Docker. [Try SVF in Docker](https://github.com/SVF-tools/SVF/wiki/Try-SVF-in-Docker)! </b> * <b>SVF now supports [LLVM-6.0.0](https://github.com/svf-tools/SVF/pull/38) (Contributed by [Jack Anthony](https://github.com/jackanth)). </b> * <b>SVF now supports [LLVM-4.0.0](https://github.com/svf-tools/SVF/pull/23) (Contributed by Jared Carlson. Thank [Jared](https://github.com/jcarlson23) and [Will](https://github.com/dtzWill) for their in-depth [discussions](https://github.com/svf-tools/SVF/pull/18) about updating SVF!) </b> * <b>SVF now supports analysis for C++ programs.</b> <br />",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -536,7 +536,9 @@ class SparseBitVector
|
|
|
536
536
|
|
|
537
537
|
// Make sure our current iterator is valid.
|
|
538
538
|
if (CurrElementIter == End)
|
|
539
|
+
{
|
|
539
540
|
--CurrElementIter;
|
|
541
|
+
}
|
|
540
542
|
|
|
541
543
|
// Search from our current iterator, either backwards or forwards,
|
|
542
544
|
// depending on what element we are looking for.
|
|
@@ -755,7 +757,9 @@ public:
|
|
|
755
757
|
// is nothing more to do.
|
|
756
758
|
if (ElementIter == Elements.end() ||
|
|
757
759
|
ElementIter->index() != ElementIndex)
|
|
760
|
+
{
|
|
758
761
|
return false;
|
|
762
|
+
}
|
|
759
763
|
return ElementIter->test(Idx % ElementSize);
|
|
760
764
|
}
|
|
761
765
|
|