feat: Add native Windows compilation support (MSVC & Clang/MinGW) and PowerShell SDK workflows - #1885
feat: Add native Windows compilation support (MSVC & Clang/MinGW) and PowerShell SDK workflows#1885dg1474 wants to merge 15 commits into
Conversation
… SDK support in PowerShell scripts
- Introduced a quickstart guide for compiling SVF on Windows using MSYS2 and the CLANG64 toolchain. - Added modifications to `setup.sh` to accommodate Windows environment, including handling of DLL paths and logging. - Created a testing guide for verifying SVF functionality on Windows, detailing both MSYS2 and PowerShell approaches. - Updated `setup-windows.ps1` to streamline the installation of dependencies and build process without requiring Visual Studio or MSYS2. - Enhanced `setup.ps1` for proper environment variable configuration on Windows. - Modified CMakeLists to support static library linking on Windows and ensure compatibility with LLVM. - Updated LLVMUtil.cpp to handle debugging information extraction for different LLVM versions.
…7 compatibility fixes
…nflicts with MSVC 2026 STL
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1885 +/- ##
==========================================
- Coverage 67.89% 67.51% -0.38%
==========================================
Files 261 261
Lines 26677 26873 +196
Branches 5110 5142 +32
==========================================
+ Hits 18112 18143 +31
- Misses 8565 8730 +165
🚀 New features to boost your workflow:
|
yuleisui
left a comment
There was a problem hiding this comment.
@dg1474 Thanks for the contribution. I’ve made a few suggestions in the reviews:
- Please consider using a separate GitHub CI workflow and defining the version as a macro rather than hardcoding version 22.
- Avoid code formatting in this pull request, as it makes the review more difficult.
- The
#ifndef _WIN32checks look a bit messy, although there may not be a much cleaner alternative. It would be good to think about whether these can be simplified or the number of macro insertions reduced as much as possible.
@mbarbar could you also help review this pull request?
| sudo apt-get install -y cmake gcc g++ nodejs doxygen graphviz lcov libncurses5-dev libtinfo6 libzstd-dev astyle wget | ||
| wget https://apt.llvm.org/llvm.sh | ||
| chmod +x llvm.sh | ||
| sudo ./llvm.sh 22 |
There was a problem hiding this comment.
It would be good not to specify a particular version here. Using a macro would be better, as SVF will keep evolving and specifying the version would make maintenance more difficult.
I would also suggest moving the Windows build to a separate GitHub Action.
| @@ -0,0 +1,207 @@ | |||
| --- | |||
There was a problem hiding this comment.
Could you remove all the newly introduced windows-port files, it makes the docs folder look quite heavy and unncessary?
| @@ -0,0 +1,347 @@ | |||
| <# | |||
There was a problem hiding this comment.
It looks to me like this build.ps1 and setup-windows.ps1 and setup.ps1 files are not needed. Please remove them from this pull request
| if (type == SBV) new (&sbv) SparseBitVector<>(); | ||
| else if (type == CBV) new (&cbv) CoreBitVector(); | ||
| else if (type == BV) new (&bv) BitVector(); | ||
| else assert(false && "PointsTo::PointsTo: unknown type"); | ||
| if (type == SBV) | ||
| new (&sbv) SparseBitVector<>(); | ||
| else if (type == CBV) | ||
| new (&cbv) CoreBitVector(); | ||
| else if (type == BV) | ||
| new (&bv) BitVector(); | ||
| else | ||
| assert(false && "PointsTo::PointsTo: unknown type"); |
There was a problem hiding this comment.
Could you please leave the code formatting unchanged so that we can know what the key changes are in your pull request?
Please do so in the other parts/files of this pull request.
|
I believe this PR needs to be split up before it can be reviewed. These all seem to be independent to me:
Additionally, the style changes need to be reverted, it's impossible to review otherwise. |
Description
This Pull Request introduces native Windows compatibility to the SVF framework, allowing developers to configure,
build, compile, and test SVF on Windows using either MSVC or the Clang/MinGW-w64 toolchain.
Additionally, this PR modularizes C++ ABI name mangling/demangling to dynamically support both the MSVC C++
ABI and the Itanium C++ ABI, updates
extapi.cwith Windows heap API annotations, and configures Windows CItesting.
Key Changes
Dynamic CXXABI Demangling:
svf-llvm/lib/CppUtil.cppinto a modular interface (CXXABI) supportingmultiple ABI layouts.
ItaniumABIas the default for Unix-like platforms and MinGW compiler configurations (utilizing_ZTV,_ZTI, andabi::__cxa_demangle).MSVCABIfor Windows MSVC triple configurations, recognizing MSVC-mangled patterns (such as??_7/??_8for vtables,??_Rfor RTTI/TypeInfo, and??0/??1for constructors/destructors) and leveragingllvm::demangle.CMake Portability:
-fno-rtti,-rdynamic,-fuse-ld=lld) with MSVC equivalents(e.g.,
/GR-) or guarded them to only apply to non-Windows targets.CMakeLists.txtsosvfandsvf-llvmcompile beforeTest-Suite,ensuring target binaries are available when CTests are registered.
Standard Windows Heap API Support:
extapi.cwith allocation rules and annotations for standard Windows heap APIs (HeapAlloc,LocalAlloc,GlobalAlloc, etc.), allowing Saber checkers to run correctly on Windows-compiled bitcode.PowerShell Automation & CI Workflows:
setup-windows.ps1,build.ps1, andsetup.ps1to handle the installation of dependencies (CMake,Ninja, custom Z3 static builds) and configure the local environment PATH automatically.
.github/workflows/github-action.ymlto run Windows compilation tests in GitHub Actions (bothmsvcandmingwtargets) and updated.github/workflows/svf-lib_binaries.ymlto replace NTFS-incompatible colonseparators (
:) with hyphens (-) in performance log filename templates (perf-%Y-%m-%dT%H-%M-%S.txt).Dependencies