From c91fc9a5211017d048ba06f8da4cf312c14079ba Mon Sep 17 00:00:00 2001 From: kiwids <60630639+kiwids0220@users.noreply.github.com> Date: Tue, 29 Aug 2023 11:09:28 -0500 Subject: [PATCH] Update LibAFL_CC README.md (#1483) Updated with steps to compile LLVM from source tree --- libafl_cc/README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/libafl_cc/README.md b/libafl_cc/README.md index aaa50ea7a4..7c409c6fe6 100644 --- a/libafl_cc/README.md +++ b/libafl_cc/README.md @@ -6,3 +6,26 @@ The online documentation for this crate is available [here](https://docs.rs/crat Currently, we support LLVM version 11 up to 18, but other versions may work. To install LLVM, use the official [download page](https://releases.llvm.org/download.html). + +The LLVM tools (including clang, clang++) are needed (newer than LLVM 11.0.0 up to LLVM 17.0.0) + - When compiling LLVM tools on Windows, you can try to compile LLVM with the below commands (tested on LLVM 16.0.6). + - NOTE: This assumes you have Visual Studio 17 2022 and MSVC v143 Tools installed under "Individual Components" +```sh +## Start x64 Native Tools Command Prompt for VS 2022 +RUN AS ADMINISTRATOR: %comspec% /k "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" + +## Cloning the LLVM project repo +git clone https://github.com/llvm/llvm-project.git llvm + +## Building Clang project first, the CMAKE_INSTALL_PREFIX is important here, make sure to select a folder path that doesn't contain any spaces in it +$ cmake -S llvm\llvm -B build -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD=X86 -Thost=x64 -DCMAKE_INSTALL_PREFIX=C:\llvm +$ cd build +$ cmake --build . --target install --config release + +## Building lld project first, the CMAKE_INSTALL_PREFIX is important here, make sure to select a folder path that doesn't contain any spaces in it +## Changing back to the previous directory +$ cd .. +$ cmake -S llvm\llvm -B build -DLLVM_ENABLE_PROJECTS=lld -DLLVM_TARGETS_TO_BUILD=X86 -Thost=x64 -DCMAKE_INSTALL_PREFIX=C:\llvm +$ cd build +$ cmake --build . --target install --config release +```