diff --git a/COMPILE.TXT b/COMPILE.TXT index f65aa27a..f9dfaeaf 100644 --- a/COMPILE.TXT +++ b/COMPILE.TXT @@ -27,7 +27,7 @@ Capstone requires no prerequisite packages, so it is easy to compile & install. - 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 + - 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/COMPILE_CMAKE.TXT b/COMPILE_CMAKE.TXT index d41d7d4e..a19ba431 100644 --- a/COMPILE_CMAKE.TXT +++ b/COMPILE_CMAKE.TXT @@ -37,7 +37,7 @@ Get CMake for free from http://www.cmake.org. - USE_SYS_DYN_MEM: change this to OFF to use your own dynamic memory management. - BUILD_DIET: change this to ON to make the binaries more compact. - X86_REDUCE: change this to ON to make X86 binary smaller. - - X86_ATT_DISABLE: change this to ON to disable AT&T syntax on x86 + - X86_ATT_DISABLE: change this to ON to disable AT&T syntax on x86. By default, Capstone use system dynamic memory management, and both DIET and X86_REDUCE modes are disabled. To use your own memory allocations, turn ON both DIET & diff --git a/arch/X86/X86Module.c b/arch/X86/X86Module.c index ccbe2b2f..ce1de150 100644 --- a/arch/X86/X86Module.c +++ b/arch/X86/X86Module.c @@ -48,6 +48,10 @@ static cs_err option(cs_struct *handle, cs_opt_type type, size_t value) handle->printer = X86_ATT_printInst; handle->syntax = CS_OPT_SYNTAX_ATT; break; +#elif !defined(CAPSTONE_DIET) && defined(CAPSTONE_X86_ATT_DISABLE) + // ATT syntax is unsupported + handle->errnum = CS_ERR_X86_ATT; + return CS_ERR_X86_ATT; #else // this is irrelevant in CAPSTONE_DIET mode handle->errnum = CS_ERR_DIET; diff --git a/include/capstone.h b/include/capstone.h index 2872846f..7518eaa5 100644 --- a/include/capstone.h +++ b/include/capstone.h @@ -243,6 +243,8 @@ typedef enum cs_err { CS_ERR_VERSION, // Unsupported version (bindings) CS_ERR_DIET, // Access irrelevant data in "diet" engine CS_ERR_SKIPDATA, // Access irrelevant data for "data" instruction in SKIPDATA mode + CS_ERR_X86_ATT, // X86 AT&T syntax is unsupported (opt-out at compile time) + CS_ERR_X86_INTEL, // X86 Intel syntax is unsupported (opt-out at compile time) } cs_err; /*