svf-tools 1.0.1119 → 1.0.1121
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/README.md +1 -0
- package/package.json +1 -1
- package/svf/lib/Util/ExtAPI.cpp +33 -14
package/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
## News
|
|
5
|
+
* <b>SVF now supports new [build system](https://github.com/SVF-tools/SVF/pull/1703) (Thank [Johannes](https://github.com/Johanmyst) for his help!). </b>
|
|
5
6
|
* <b> [SVF-Python](https://github.com/SVF-tools/SVF-Python) is now available, enabling developers to write static analyzers in Python by leveraging the SVF library. </b>
|
|
6
7
|
* <b>New course [Software Security Analysis](https://github.com/SVF-tools/Software-Security-Analysis) for learning code analysis and verification with SVF for fun and expertise! </b>
|
|
7
8
|
* <b>SVF now supports LLVM-16.0.0 with opaque pointers (Contributed by [Xiao Cheng](https://github.com/jumormt)). </b>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1121",
|
|
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": {
|
package/svf/lib/Util/ExtAPI.cpp
CHANGED
|
@@ -122,9 +122,11 @@ static std::string getFilePath(const std::string& path)
|
|
|
122
122
|
// - If SVF is built and loaded as a dynamic library (e.g., libSVFCore.so or .dylib), it returns the path to that shared object file.
|
|
123
123
|
// - If SVF is linked as a static library, it returns the path to the main executable.
|
|
124
124
|
// This is useful for locating resource files (such as extapi.bc) relative to the module at runtime.
|
|
125
|
-
std::string getCurrentSOPath()
|
|
125
|
+
std::string getCurrentSOPath()
|
|
126
|
+
{
|
|
126
127
|
Dl_info info;
|
|
127
|
-
if (dladdr((void*)&getCurrentSOPath, &info) && info.dli_fname)
|
|
128
|
+
if (dladdr((void*)&getCurrentSOPath, &info) && info.dli_fname)
|
|
129
|
+
{
|
|
128
130
|
return std::string(info.dli_fname);
|
|
129
131
|
}
|
|
130
132
|
return "";
|
|
@@ -148,48 +150,65 @@ std::string ExtAPI::getExtBcPath()
|
|
|
148
150
|
return extBcPath;
|
|
149
151
|
|
|
150
152
|
// 2. Use command line argument -extapi=...
|
|
151
|
-
if (setExtBcPath(Options::ExtAPIPath()))
|
|
153
|
+
if (setExtBcPath(Options::ExtAPIPath()))
|
|
154
|
+
{
|
|
152
155
|
return extBcPath;
|
|
153
|
-
}
|
|
156
|
+
}
|
|
157
|
+
else
|
|
158
|
+
{
|
|
154
159
|
candidatePaths.push_back(Options::ExtAPIPath());
|
|
155
160
|
}
|
|
156
161
|
|
|
157
162
|
// 3. SVF developer: try build directory (SVF_BUILD_DIR)
|
|
158
|
-
if (setExtBcPath(SVF_BUILD_DIR "/lib/extapi.bc"))
|
|
163
|
+
if (setExtBcPath(SVF_BUILD_DIR "/lib/extapi.bc"))
|
|
164
|
+
{
|
|
159
165
|
return extBcPath;
|
|
160
|
-
}
|
|
166
|
+
}
|
|
167
|
+
else
|
|
168
|
+
{
|
|
161
169
|
candidatePaths.push_back(SVF_BUILD_DIR "/lib/extapi.bc");
|
|
162
170
|
}
|
|
163
171
|
|
|
164
172
|
// 4. Use $SVF_DIR environment variable + standard relative path
|
|
165
|
-
if (setExtBcPath(getFilePath("SVF_DIR")))
|
|
173
|
+
if (setExtBcPath(getFilePath("SVF_DIR")))
|
|
174
|
+
{
|
|
166
175
|
return extBcPath;
|
|
167
|
-
}
|
|
176
|
+
}
|
|
177
|
+
else
|
|
178
|
+
{
|
|
168
179
|
candidatePaths.push_back(getFilePath("SVF_DIR"));
|
|
169
180
|
}
|
|
170
181
|
|
|
171
182
|
// 5. Use npm root + standard relative path (for npm installations)
|
|
172
|
-
if (setExtBcPath(getFilePath("npm root")))
|
|
183
|
+
if (setExtBcPath(getFilePath("npm root")))
|
|
184
|
+
{
|
|
173
185
|
return extBcPath;
|
|
174
|
-
}
|
|
186
|
+
}
|
|
187
|
+
else
|
|
188
|
+
{
|
|
175
189
|
candidatePaths.push_back(getFilePath("npm root"));
|
|
176
190
|
}
|
|
177
191
|
|
|
178
192
|
// 6. Use the directory of the loaded libSVFCore.so/.dylib + extapi.bc
|
|
179
193
|
std::string soPath = getCurrentSOPath();
|
|
180
|
-
if (!soPath.empty())
|
|
194
|
+
if (!soPath.empty())
|
|
195
|
+
{
|
|
181
196
|
std::string dir = soPath.substr(0, soPath.find_last_of('/'));
|
|
182
197
|
std::string candidate = dir + "/extapi.bc";
|
|
183
|
-
if (setExtBcPath(candidate))
|
|
198
|
+
if (setExtBcPath(candidate))
|
|
199
|
+
{
|
|
184
200
|
return extBcPath;
|
|
185
|
-
}
|
|
201
|
+
}
|
|
202
|
+
else
|
|
203
|
+
{
|
|
186
204
|
candidatePaths.push_back(candidate);
|
|
187
205
|
}
|
|
188
206
|
}
|
|
189
207
|
|
|
190
208
|
// If all candidate paths failed, print error and suggestions
|
|
191
209
|
SVFUtil::errs() << "ERROR: Failed to locate \"extapi.bc\". Tried the following candidate paths:" << std::endl;
|
|
192
|
-
for (const auto& path : candidatePaths)
|
|
210
|
+
for (const auto& path : candidatePaths)
|
|
211
|
+
{
|
|
193
212
|
SVFUtil::errs() << " " << path << std::endl;
|
|
194
213
|
}
|
|
195
214
|
SVFUtil::errs() << "To override the default locations for \"extapi.bc\", you can:" << std::endl
|