diff --git a/CMakeLists.txt b/CMakeLists.txt index c55c2ecca..59c9995cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,7 @@ option(SYSZ_SUPPORT "SystemZ support" ON) option(XCORE_SUPPORT "XCore support" ON) option(X86_SUPPORT "x86 support" ON) option(X86_REDUCE "x86 with reduce instruction sets to minimize library" OFF) +option(X86_ATT_DISABLE, "Disable x86 AT&T syntax" OFF) if (BUILD_DIET) add_definitions(-DCAPSTONE_DIET) @@ -35,6 +36,10 @@ if (X86_REDUCE) add_definitions(-DCAPSTONE_X86_REDUCE) endif () +if (X86_ATT_DISABLE) + add_definitions(-DCAPSTONE_X86_ATT_DISABLE) +endif () + ## sources set(SOURCES cs.c diff --git a/COMPILE.TXT b/COMPILE.TXT index bc63cccd4..f65aa27a0 100644 --- a/COMPILE.TXT +++ b/COMPILE.TXT @@ -21,12 +21,13 @@ Capstone requires no prerequisite packages, so it is easy to compile & install. The other way of customize Capstone without having to edit config.mk is to pass the desired options on the commandline to ./make.sh. Currently, - Capstone supports 4 options, as followings. + Capstone supports 5 options, as followings. - CAPSTONE_ARCHS: specify list of architectures to compiled in. - CAPSTONE_USE_SYS_DYN_MEM: change this if you have your own dynamic memory management. - CAPSTONE_DIET: use this to make the output binaries more compact. - CAPSTONE_X86_REDUCE: another option to make X86 binary smaller. + - CAPSTONE_X86_ATT_DISABLE: disables AT&T syntax on x86 By default, Capstone use system dynamic memory management, and both DIET and X86_REDUCE modes are disable. diff --git a/Makefile b/Makefile index 18ea3094f..7033086f4 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,10 @@ else CFLAGS ?= -O3 endif +ifneq (,$(findstring yes,$(CAPSTONE_X86_ATT_DISABLE))) +CFLAGS += -DCAPSTONE_X86_ATT_DISABLE +endif + CFLAGS += -fPIC -Wall -Iinclude ifeq ($(CAPSTONE_USE_SYS_DYN_MEM),yes) @@ -201,7 +205,9 @@ ifneq (,$(findstring x86,$(CAPSTONE_ARCHS))) LIBOBJ_X86 += $(OBJDIR)/arch/X86/X86IntelInstPrinter.o # assembly syntax is irrelevant in Diet mode, when this info is suppressed ifeq (,$(findstring yes,$(CAPSTONE_DIET))) +ifeq (,$(findstring yes,$(CAPSTONE_X86_ATT_DISABLE))) LIBOBJ_X86 += $(OBJDIR)/arch/X86/X86ATTInstPrinter.o +endif endif LIBOBJ_X86 += $(OBJDIR)/arch/X86/X86Mapping.o LIBOBJ_X86 += $(OBJDIR)/arch/X86/X86Module.o diff --git a/arch/X86/X86ATTInstPrinter.c b/arch/X86/X86ATTInstPrinter.c index d0ec9c7e5..0ebc41d26 100644 --- a/arch/X86/X86ATTInstPrinter.c +++ b/arch/X86/X86ATTInstPrinter.c @@ -16,7 +16,7 @@ /* By Nguyen Anh Quynh , 2013-2014 */ // this code is only relevant when DIET mode is disable -#if defined(CAPSTONE_HAS_X86) && !defined(CAPSTONE_DIET) && !defined(CAPSTONE_NO_ATT) +#if defined(CAPSTONE_HAS_X86) && !defined(CAPSTONE_DIET) && !defined(CAPSTONE_X86_ATT_DISABLE) #include #include diff --git a/arch/X86/X86Module.c b/arch/X86/X86Module.c index 58547bc53..ccbe2b2f3 100644 --- a/arch/X86/X86Module.c +++ b/arch/X86/X86Module.c @@ -44,7 +44,7 @@ static cs_err option(cs_struct *handle, cs_opt_type type, size_t value) break; case CS_OPT_SYNTAX_ATT: -#if !defined(CAPSTONE_DIET) && !defined(CAPSTONE_NO_ATT) +#if !defined(CAPSTONE_DIET) && !defined(CAPSTONE_X86_ATT_DISABLE) handle->printer = X86_ATT_printInst; handle->syntax = CS_OPT_SYNTAX_ATT; break; diff --git a/config.mk b/config.mk index 8b66b5aa5..2504f7f90 100644 --- a/config.mk +++ b/config.mk @@ -55,6 +55,11 @@ CAPSTONE_DIET ?= no CAPSTONE_X86_REDUCE ?= no +################################################################################ +# Change 'CAPSTONE_X86_ATT_DISABLE = no' to 'CAPSTONE_X86_ATT_DISABLE = yes' to +# disable AT&T syntax on x86 to reduce library size. + +CAPSTONE_X86_ATT_DISABLE ?= no ################################################################################ # Change 'CAPSTONE_STATIC = yes' to 'CAPSTONE_STATIC = no' to avoid building