-
Notifications
You must be signed in to change notification settings - Fork 44
Analyzing CXX with Crucible LLVM
Ryan Scott edited this page Nov 22, 2022
·
4 revisions
Here are some things to consider when using Crucible-LLVM to analyze C++ code:
- Some parts of the C++ standard library (notably,
iostream
) use global variables that are initialized in functions that run beforemain
, which Crucible doesn't automatically set up. - C++ code often uses templates, which are expanded to code that is included in the LLVM module. This is nice, because it doesn't result in more external functions that require overrides. However, it results in much larger LLVM modules, and the code the templates expand to can contain fishy / probably-not-defined behavior.
- Virtual method dispatch won't work for objects with a non-concrete type (Crucible can't mux fuction pointers). See this issue, as well as a prototype here.
- C++ exceptions are not yet supported.
- Compiling programs with
-fno-threadsafe-statics
avoids some unnecessary inclusion ofpthreads
material. - You will have to compile
libc++
(or another C++ standard library) to bitcode and link it with your application withllvm-link
(or use Crux-LLVM, which does this for you). See also this issue.
There are a few assorted tips about C++ on the SAW wiki.