* Add support for MSP430 * Fix test-all.sh * Use corrected TableGen output files * Fix bindings for EVM and MSP430 * Remove LLVM_CONSTEXPR (like upstream LLVM did) and fix Java binding See https://github.com/llvm-mirror/llvm/commit/6feedc56f7855aa24baf759f3bc17112ecbf5699#diff-d14f03e012a2bdbf93486dc1c4ce95ec * Revert bindings * Remove added files as well * Add back changes for bindings created by const_gnerator * Add back changes for other bindings * Update CREDITS.TXT * Fix ADRP instruction encoding * Trigger checks on PR again, it failed for some reason unrelated to my code * Add correct offset checks back in * added llvm support post jan 2 * Remove bounds check on ppc branch instructions target address (fix issue 423) * Fix vm address reset in aliased PPC instructions * Fix vm address reset in aliased PPC instructions (cherry picked from commit06425a32f3) * Remove bounds check on ppc branch instructions target address (fix issue 423) (cherry picked from commit06afb493e0) * Clean up test for issue #427 Co-authored-by: Trey Keown <trey@redballoonsecurity.com> Co-authored-by: Dan Pesce <dan@redballoonsecurity.com> Co-authored-by: Trey Keown <jfktrey@gmail.com> Co-authored-by: Nguyen Anh Quynh <aquynh@gmail.com>
3.4 KiB
This documentation explains how to build & install Keystone on all kind of nix OS. For Windows, see COMPILE-WINDOWS.md
- Dependency
CMake is required to build keystone.
-
On Mac OS X, you can install "cmake" with "brew".
$ brew install cmake -
On Ubuntu Linux, install "cmake" with:
$ sudo apt-get install cmake
-
From the root directory of Keystone source, compile its dynamic library with the following commands.
$ mkdir build $ cd build $ ../make-share.shIn the case you want to compile with all the debug information, replace the last line with:
$ ../make-share.sh debugFor Linux distributions following the "Filesystem Hierarchy Standard" and put x64 libraries under $PREFIX/lib64, such as Fedora, Redhat & Suse, add "lib64" option at the end of make-share.sh script, like below.
$ ../make-share.sh lib64By default, this builds all architectures, which is: AArch64, ARM, Hexagon, Mips, MSP430, PowerPC, Sparc, SystemZ & X86. To compile just some selected ones, pass a semicolon-separated list of targets to LLVM_TARGETS_TO_BUILD, like follows if we only want AArch64 & X86.
$ cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DLLVM_TARGETS_TO_BUILD="AArch64;X86" -G "Unix Makefiles" .. $ make -j8You can also compile static a library with:
$ mkdir build $ cd build $ ../make-lib.shIn the case you want to compile with all the debug information, replace the last line with:
$ ../make-lib.sh debugFor Linux distributions following the "Filesystem Hierarchy Standard" and put x64 libraries under $PREFIX/lib64, such as Fedora, Redhat & Suse, add "lib64" option at the end of make-share.sh script, like below.
$ ../make-lib.sh lib64Like above, this builds all architectures. To compile just some selected ones, pass a semicolon-separated list of targets to LLVM_TARGETS_TO_BUILD, like follows if we only want AArch64 & X86.
$ cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DLLVM_TARGETS_TO_BUILD="AArch64, X86" -G "Unix Makefiles" .. $ make -j8To customize your build by specifying PREFIX or other installation directories, pass one of the variables at https://cmake.org/cmake/help/v3.0/module/GNUInstallDirs.html to cmake. For example:
$ cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DLLVM_TARGETS_TO_BUILD="AArch64, X86" -G "Unix Makefiles" .. $ make -j8 -
Right after building, install Keystone.
$ sudo make installKeystone is installed in
/usr/local, depending on your distribution (eg. Ubuntu) you might need to add/usr/local/libto/etc/ld.so.conf. Then update the dynamic linker with:$ sudo ldconfigBesides the libraries & C header files under directory "include/keystone", this step also installs a tool named "kstool" on the system. (The source of "kstool" is in the directory "kstool/kstool")
-
Test Keystone with "kstool" like below.
$ kstool x32 "add eax, ebx"Run "kstool" without any option to find out how to use this handy tool.
-
Learn more on how to code your own tools with our samples.
For C sample code, see code in directory samples/
For Python sample code, see code in directory bindings/python/