Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d7536f0
Remove binding breaking statements (#1543)
keenk Oct 8, 2019
5809774
bindings: update after the last header fix
aquynh Oct 8, 2019
ae273a1
build: add xlc and AIX support (#1559)
kamiyaa Oct 30, 2019
d74d37f
systemz: fix base/index printing (#1561)
kamiyaa Nov 5, 2019
7a2357e
Use GNUInstallDirs for the headers too (#1570)
Begasus Dec 15, 2019
9fe1087
MOS65XX: C90 compatibility
aquynh Dec 15, 2019
aaffb38
Constify backends (#1549)
rth7680 Dec 23, 2019
02af597
Update top-level COMPILE.TXT file (#1578)
c0rejump Jan 1, 2020
74136ca
python: classifier Python3 for setup.py
aquynh Jan 26, 2020
ce54809
Fix installation path on FreeBSD and DragonFly (#1589)
0mp Feb 19, 2020
ade0076
fix: Remove wrong write in ARM_t2STMDB_UPD instruction (#1588)
Feb 21, 2020
b2544a0
Bug solved: SSE variant of MOVSD incorrectly decoded as REPNE MOVSD (…
NicolasDerumigny Feb 21, 2020
0de88ed
CIFuzz action (#1590)
Feb 24, 2020
efb6458
Add Ruby binding by david942j (#1599)
david942j Mar 10, 2020
7432164
Fixed anon type in anon union error in m68k.h (#1597)
netromdk Mar 19, 2020
8ca0564
Add Common Lisp bindings (#1605)
eschulte Mar 23, 2020
5bdb008
Merge branch 'next' of github.com:aquynh/capstone into next
aquynh Mar 23, 2020
5a5fea5
Add vcpkg installation instructions (#1602)
NancyLi1013 Mar 24, 2020
e3f1067
Add ARM64_GRP_PAC group for Pointer Authentication (#1607)
Mar 30, 2020
4a4e40e
Fix Makefile CAPSTONE_BUILD_CORE_ONLY (#1617)
Summus-31c04089c3cd80 May 4, 2020
f34c396
Add __repr__ for capstone.CsInsn (#1625)
disconnect3d May 4, 2020
f7efa08
x86: fix testcase of MOVSD
aquynh May 7, 2020
28de604
arm64: some POST instructions miss IMM operand. this fixes issue #1627
aquynh May 9, 2020
968e9bd
ARM64: Populate implicitly used/modified registers and map ARM64_GRP_…
May 9, 2020
1766485
Add more cases for LD1 instruction immediate fixups (#1632)
ekilmer May 10, 2020
387b576
fix bug in displacement offset (#1600)
aeflores May 10, 2020
34e5b16
Allow to override PYTHON[23] in Makefiles (#1639)
sh1r4s3 May 30, 2020
852c075
Add cmake config and export targets. (#1637)
mcmtroffaes Jun 2, 2020
a42f9fa
Fixed incorrect read of 32-bit imm for bsr (#1644)
emoon Jun 12, 2020
d956ced
Change include path to fix error with embedded cmake builds (#1649)
heshpdx Jun 25, 2020
6bb4bda
M68K: fix MOVEC operand transfer direction. (#1663)
maximumspatium Jul 19, 2020
34e57ee
capstone.pc.in: use CMAKE_INSTALL_LIBDIR for libdir (#1659)
Jul 19, 2020
f8b1b83
fix CS_ mips_ OP structure comment error (#1674)
junchao-loongson Aug 6, 2020
298864e
include: avoid UB with signed overflow/shift (#1675)
carenas Sep 15, 2020
dbc2958
systemz: pad instruction width up to 6 bytes (#1679)
carenas Sep 3, 2020
ceb308c
Two RISC-V fixes (#1682)
rth7680 Sep 16, 2020
c66bb33
MCInst: fix uninitialized value in operand value (#1685)
StalkR Sep 16, 2020
2f38802
Added export for Python CS_MODE_RISCVC binding (#1691)
TobiasFaller Sep 18, 2020
aff05e6
Option to generate install target (#1700)
Oct 28, 2020
c93fa3a
M680X - remove unused s_cpu_type (#1695)
XVilka Oct 29, 2020
6d5d982
Swift binding (#1707)
zydeco Nov 25, 2020
786a6b3
bindings: update Arm64 register enum
aquynh Nov 25, 2020
ab962a1
add Swift binding to README
aquynh Nov 25, 2020
bfb2e45
fix cstest compile issue
aquynh Nov 27, 2020
86596fd
Honour direction bit in fmove instruction (#1709)
michalsc Dec 3, 2020
3f46b83
code style fix
aquynh Dec 3, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CIFuzz
on: [pull_request]
jobs:
Fuzzing:
runs-on: ubuntu-latest
steps:
- name: Build Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'capstone'
dry-run: false
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'capstone'
fuzz-seconds: 600
dry-run: false
- name: Upload Crash
uses: actions/upload-artifact@v1
if: failure()
with:
name: artifacts
path: ./out/artifacts
46 changes: 40 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ option(CAPSTONE_BUILD_CSTOOL "Build cstool" ON)
option(CAPSTONE_USE_DEFAULT_ALLOC "Use default memory allocation functions" ON)
option(CAPSTONE_ARCHITECTURE_DEFAULT "Whether architectures are enabled by default" ON)
option(CAPSTONE_DEBUG "Whether to enable extra debug assertions" OFF)
option(CAPSTONE_INSTALL "Generate install target" OFF)

set(SUPPORTED_ARCHITECTURES ARM ARM64 M68K MIPS PPC SPARC SYSZ XCORE X86 TMS320C64X M680X EVM MOS65XX WASM BPF RISCV)
set(SUPPORTED_ARCHITECTURE_LABELS ARM ARM64 M68K MIPS PowerPC Sparc SystemZ XCore x86 TMS320C64x M680x EVM MOS65XX WASM BPF RISCV)
Expand Down Expand Up @@ -655,28 +656,61 @@ source_group("Include\\RISCV" FILES ${HEADERS_RISCV})
include("GNUInstallDirs")

## installation
install(FILES ${HEADERS_COMMON} DESTINATION include/capstone)
if (CAPSTONE_INSTALL)
install(FILES ${HEADERS_COMMON} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/capstone)
endif ()
configure_file(capstone.pc.in ${CMAKE_BINARY_DIR}/capstone.pc @ONLY)

include(CMakePackageConfigHelpers)
set(CAPSTONE_CMAKE_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/capstone")
configure_package_config_file(
capstone-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/capstone-config.cmake
INSTALL_DESTINATION ${CAPSTONE_CMAKE_CONFIG_INSTALL_DIR}
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/capstone-config-version.cmake
VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
COMPATIBILITY SameMajorVersion
)

if (CAPSTONE_INSTALL)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/capstone-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/capstone-config-version.cmake"
DESTINATION ${CAPSTONE_CMAKE_CONFIG_INSTALL_DIR}
)

if (CAPSTONE_BUILD_STATIC)
install(TARGETS capstone-static
RUNTIME DESTINATION bin
EXPORT capstone-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif ()

if (CAPSTONE_BUILD_SHARED)
install(TARGETS capstone-shared
RUNTIME DESTINATION bin
EXPORT capstone-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif ()

install(EXPORT capstone-targets
NAMESPACE capstone::
DESTINATION ${CAPSTONE_CMAKE_CONFIG_INSTALL_DIR})
endif ()

if (CAPSTONE_BUILD_SHARED AND CAPSTONE_BUILD_CSTOOL)
FILE(GLOB CSTOOL_SRC cstool/*.c)
add_executable(cstool ${CSTOOL_SRC})
target_link_libraries(cstool ${default-target})

install(TARGETS cstool DESTINATION bin)
if (CAPSTONE_INSTALL)
install(TARGETS cstool DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${CMAKE_BINARY_DIR}/capstone.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif ()
endif ()
17 changes: 9 additions & 8 deletions COMPILE.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,25 @@ Capstone requires no prerequisite packages, so it is easy to compile & install.
NOTE: The core framework installed by "./make.sh install" consist of
following files:

/usr/include/capstone/capstone.h
/usr/include/capstone/x86.h
/usr/include/capstone/arm.h
/usr/include/capstone/arm64.h
/usr/include/capstone/bpf.h
/usr/include/capstone/capstone.h
/usr/include/capstone/evm.h
/usr/include/capstone/wasm.h
/usr/include/capstone/m68k.h
/usr/include/capstone/m680x.h
/usr/include/capstone/m68k.h
/usr/include/capstone/mips.h
/usr/include/capstone/mos65xx.h
/usr/include/capstone/platform.h
/usr/include/capstone/ppc.h
/usr/include/capstone/sparc.h
/usr/include/capstone/systemz.h
/usr/include/capstone/tms320c64x.h
/usr/include/capstone/wasm.h
/usr/include/capstone/x86.h
/usr/include/capstone/xcore.h
/usr/include/capstone/bpf.h
/usr/include/capstone/platform.h
/usr/lib/libcapstone.so (for Linux/*nix), or /usr/lib/libcapstone.dylib (OSX)
/usr/lib/libcapstone.a
/usr/lib/libcapstone.so (for Linux/*nix), or /usr/lib/libcapstone.dylib (OSX)



Expand All @@ -124,7 +125,7 @@ Capstone requires no prerequisite packages, so it is easy to compile & install.

(4) Cross-compile for iOS from Mac OSX.

To cross-compile for iOS (iPhone/iPad/iPod), Mac OSX with XCode installed is required.
To cross-compile for iOS (iPhone/iPad/iPod), Mac OSX with XCode installed is required.

- To cross-compile for ArmV7 (iPod 4, iPad 1/2/3, iPhone4, iPhone4S), run:
$ ./make.sh ios_armv7
Expand Down
14 changes: 14 additions & 0 deletions COMPILE_MSVC.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,17 @@ versions, and Windows Driver Kit 8.1 Update 1 or newer versions are required.

>sc delete test_winkernel
>bcdedit /deletevalue testsigning



(3) Installing and building capstone via vcpkg

You can download and install capstone using the vcpkg(https://github.com/Microsoft/vcpkg) dependency manager:

git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
vcpkg install capstone

The capstone port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository(https://github.com/Microsoft/vcpkg).
1 change: 1 addition & 0 deletions MCInst.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ void MCInst_Init(MCInst *inst)

for (i = 0; i < 48; i++) {
inst->Operands[i].Kind = kInvalid;
inst->Operands[i].ImmVal = 0;
}

inst->Opcode = 0;
Expand Down
30 changes: 26 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ RANLIB = $(CROSS)ranlib
STRIP = $(CROSS)strip
endif

ifeq ($(OS),OS/390)
RANLIB = touch
endif

ifneq (,$(findstring yes,$(CAPSTONE_DIET)))
CFLAGS ?= -Os
CFLAGS += -DCAPSTONE_DIET
Expand All @@ -45,7 +49,14 @@ ifneq (,$(findstring yes,$(CAPSTONE_X86_ATT_DISABLE)))
CFLAGS += -DCAPSTONE_X86_ATT_DISABLE
endif

ifeq ($(CC),xlc)
CFLAGS += -qcpluscmt -qkeyword=inline -qlanglvl=extc1x -Iinclude
ifneq ($(OS),OS/390)
CFLAGS += -fPIC
endif
else
CFLAGS += -fPIC -Wall -Wwrite-strings -Wmissing-prototypes -Iinclude
endif

ifeq ($(CAPSTONE_USE_SYS_DYN_MEM),yes)
CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM
Expand Down Expand Up @@ -88,10 +99,10 @@ LIBDATADIR = $(LIBDIR)

ifndef USE_GENERIC_LIBDATADIR
ifeq ($(UNAME_S), FreeBSD)
LIBDATADIR = $(PREFIX)/libdata
LIBDATADIR = $(DESTDIR)$(PREFIX)/libdata
endif
ifeq ($(UNAME_S), DragonFly)
LIBDATADIR = $(PREFIX)/libdata
LIBDATADIR = $(DESTDIR)$(PREFIX)/libdata
endif
endif

Expand Down Expand Up @@ -335,7 +346,11 @@ endif
else
CFLAGS += $(foreach arch,$(LIBARCHS),-arch $(arch))
LDFLAGS += $(foreach arch,$(LIBARCHS),-arch $(arch))
ifeq ($(OS), AIX)
$(LIBNAME)_LDFLAGS += -qmkshrobj
else
$(LIBNAME)_LDFLAGS += -shared
endif
# Cygwin?
IS_CYGWIN := $(shell $(CC) -dumpmachine 2>/dev/null | grep -i cygwin | wc -l)
ifeq ($(IS_CYGWIN),1)
Expand Down Expand Up @@ -465,24 +480,28 @@ endif
$(INSTALL_DATA) include/capstone/*.h $(DESTDIR)$(INCDIR)/$(LIBNAME)
mkdir -p $(PKGCFGDIR)
$(INSTALL_DATA) $(PKGCFGF) $(PKGCFGDIR)
ifeq (,$(findstring yes,$(CAPSTONE_BUILD_CORE_ONLY)))
mkdir -p $(BINDIR)
$(INSTALL_LIB) cstool/cstool $(BINDIR)
endif

uninstall:
rm -rf $(DESTDIR)$(INCDIR)/$(LIBNAME)
rm -f $(LIBDIR)/lib$(LIBNAME).*
rm -f $(PKGCFGDIR)/$(LIBNAME).pc
ifeq (,$(findstring yes,$(CAPSTONE_BUILD_CORE_ONLY)))
rm -f $(BINDIR)/cstool
endif

clean:
rm -f $(LIBOBJ)
rm -f $(BLDIR)/lib$(LIBNAME).* $(BLDIR)/$(LIBNAME).pc
rm -f $(PKGCFGF)
rm -f $(AUTODEPS)
[ "${ANDROID}" = "1" ] && rm -rf android-ndk-* || true
$(MAKE) -C cstool clean

ifeq (,$(findstring yes,$(CAPSTONE_BUILD_CORE_ONLY)))
$(MAKE) -C cstool clean
$(MAKE) -C tests clean
$(MAKE) -C suite/fuzz clean
rm -f $(BLDIR)/tests/lib$(LIBNAME).$(EXT)
Expand Down Expand Up @@ -556,9 +575,12 @@ define install-library
endef
endif

ifeq ($(AR_FLAGS),)
AR_FLAGS := q
endif

define create-archive
$(AR) q $(ARCHIVE) $(LIBOBJ)
$(AR) $(AR_FLAGS) $(ARCHIVE) $(LIBOBJ)
$(RANLIB) $(ARCHIVE)
endef

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Capstone offers some unparalleled features:
- Provide semantics of the disassembled instruction, such as list of implicit
registers read & written.

- Implemented in pure C language, with lightweight bindings for D, Clojure, F#,
- Implemented in pure C language, with lightweight bindings for Swift, D, Clojure, F#,
Common Lisp, Visual Basic, PHP, PowerShell, Emacs, Haskell, Perl, Python,
Ruby, C#, NodeJS, Java, GO, C++, OCaml, Lua, Rust, Delphi, Free Pascal & Vala
ready either in main code, or provided externally by the community).
Expand Down
Loading