From c8c7ecd01c550855af7c69b2c35f1834d9ba6ccb Mon Sep 17 00:00:00 2001
From: Nguyen Anh Quynh <aquynh@gmail.com>
Date: Sat, 30 Apr 2016 23:39:44 +0800
Subject: [PATCH] x86: added GNU GAS syntax, which is similar to AT&T syntax

---
 include/keystone/keystone.h | 3 ++-
 llvm/keystone/ks.cpp        | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/keystone/keystone.h b/include/keystone/keystone.h
index 9e7f355..28ce0ce 100644
--- a/include/keystone/keystone.h
+++ b/include/keystone/keystone.h
@@ -139,7 +139,8 @@ typedef enum ks_opt_value {
 	KS_OPT_SYNTAX_INTEL = 1 << 0, // X86 Intel syntax - default on X86 (KS_OPT_SYNTAX).
 	KS_OPT_SYNTAX_ATT   = 1 << 1, // X86 ATT asm syntax (KS_OPT_SYNTAX).
 	KS_OPT_SYNTAX_NASM  = 1 << 2, // X86 Nasm syntax (KS_OPT_SYNTAX).
-	KS_OPT_SYNTAX_MASM  = 1 << 3, // X86 Masm syntax (KS_OPT_SYNTAX).
+	KS_OPT_SYNTAX_MASM  = 1 << 3, // X86 Masm syntax (KS_OPT_SYNTAX) - unsupported yet.
+	KS_OPT_SYNTAX_GAS   = 1 << 4, // X86 GAS syntax (KS_OPT_SYNTAX)
 } ks_opt_value;
 
 
diff --git a/llvm/keystone/ks.cpp b/llvm/keystone/ks.cpp
index 6195c0b..eab3b10 100644
--- a/llvm/keystone/ks.cpp
+++ b/llvm/keystone/ks.cpp
@@ -418,6 +418,7 @@ ks_err ks_option(ks_engine *ks, ks_opt_type type, size_t value)
                     ks->syntax = (ks_opt_value)value;
                     ks->MAI->setAssemblerDialect(1);
                     break;
+                case KS_OPT_SYNTAX_GAS:
                 case KS_OPT_SYNTAX_ATT:
                     ks->syntax = (ks_opt_value)value;
                     ks->MAI->setAssemblerDialect(0);
-- 
GitLab