diff --git a/bindings/nodejs/consts/keystone.js b/bindings/nodejs/consts/keystone.js index d66b6815dbf9cc675f8ca8d3c3a8e130a8f53189..df6504d0622404f2e3b6c0b4b588296824e21c52 100644 --- a/bindings/nodejs/consts/keystone.js +++ b/bindings/nodejs/consts/keystone.js @@ -53,17 +53,18 @@ module.exports.ERR_ASM_DIRECTIVE_FPOINT = 136 module.exports.ERR_ASM_VARIANT_INVALID = 137 module.exports.ERR_ASM_EXPR_BRACKET = 138 module.exports.ERR_ASM_SYMBOL_MODIFIER = 139 -module.exports.ERR_ASM_RPAREN = 140 -module.exports.ERR_ASM_STAT_TOKEN = 141 -module.exports.ERR_ASM_UNSUPPORTED = 142 -module.exports.ERR_ASM_MACRO_TOKEN = 143 -module.exports.ERR_ASM_MACRO_PAREN = 144 -module.exports.ERR_ASM_MACRO_EQU = 145 -module.exports.ERR_ASM_MACRO_ARGS = 146 -module.exports.ERR_ASM_MACRO_LEVELS_EXCEED = 147 -module.exports.ERR_ASM_ESC_BACKSLASH = 148 -module.exports.ERR_ASM_ESC_OCTAL = 149 -module.exports.ERR_ASM_ESC_SEQUENCE = 150 +module.exports.ERR_ASM_SYMBOL_REDEFINED = 140 +module.exports.ERR_ASM_RPAREN = 141 +module.exports.ERR_ASM_STAT_TOKEN = 142 +module.exports.ERR_ASM_UNSUPPORTED = 143 +module.exports.ERR_ASM_MACRO_TOKEN = 144 +module.exports.ERR_ASM_MACRO_PAREN = 145 +module.exports.ERR_ASM_MACRO_EQU = 146 +module.exports.ERR_ASM_MACRO_ARGS = 147 +module.exports.ERR_ASM_MACRO_LEVELS_EXCEED = 148 +module.exports.ERR_ASM_ESC_BACKSLASH = 149 +module.exports.ERR_ASM_ESC_OCTAL = 150 +module.exports.ERR_ASM_ESC_SEQUENCE = 151 module.exports.ERR_ASM_INVALIDOPERAND = 512 module.exports.ERR_ASM_MISSINGFEATURE = 513 module.exports.ERR_ASM_MNEMONICFAIL = 514 diff --git a/bindings/python/keystone/keystone_const.py b/bindings/python/keystone/keystone_const.py index 5f39d130657cf44f0f360c24473623922f656994..96162774621587081e17de1ba3c8b9fe8cd9911c 100644 --- a/bindings/python/keystone/keystone_const.py +++ b/bindings/python/keystone/keystone_const.py @@ -53,17 +53,18 @@ KS_ERR_ASM_DIRECTIVE_FPOINT = 136 KS_ERR_ASM_VARIANT_INVALID = 137 KS_ERR_ASM_EXPR_BRACKET = 138 KS_ERR_ASM_SYMBOL_MODIFIER = 139 -KS_ERR_ASM_RPAREN = 140 -KS_ERR_ASM_STAT_TOKEN = 141 -KS_ERR_ASM_UNSUPPORTED = 142 -KS_ERR_ASM_MACRO_TOKEN = 143 -KS_ERR_ASM_MACRO_PAREN = 144 -KS_ERR_ASM_MACRO_EQU = 145 -KS_ERR_ASM_MACRO_ARGS = 146 -KS_ERR_ASM_MACRO_LEVELS_EXCEED = 147 -KS_ERR_ASM_ESC_BACKSLASH = 148 -KS_ERR_ASM_ESC_OCTAL = 149 -KS_ERR_ASM_ESC_SEQUENCE = 150 +KS_ERR_ASM_SYMBOL_REDEFINED = 140 +KS_ERR_ASM_RPAREN = 141 +KS_ERR_ASM_STAT_TOKEN = 142 +KS_ERR_ASM_UNSUPPORTED = 143 +KS_ERR_ASM_MACRO_TOKEN = 144 +KS_ERR_ASM_MACRO_PAREN = 145 +KS_ERR_ASM_MACRO_EQU = 146 +KS_ERR_ASM_MACRO_ARGS = 147 +KS_ERR_ASM_MACRO_LEVELS_EXCEED = 148 +KS_ERR_ASM_ESC_BACKSLASH = 149 +KS_ERR_ASM_ESC_OCTAL = 150 +KS_ERR_ASM_ESC_SEQUENCE = 151 KS_ERR_ASM_INVALIDOPERAND = 512 KS_ERR_ASM_MISSINGFEATURE = 513 KS_ERR_ASM_MNEMONICFAIL = 514 diff --git a/bindings/ruby/keystone_gem/lib/keystone/keystone_const.rb b/bindings/ruby/keystone_gem/lib/keystone/keystone_const.rb index 5d88e69ee7cdca14754b3bf199bb2c35704dd9e1..81dc47c9dcaf81752c90096de90304d1c50fc682 100644 --- a/bindings/ruby/keystone_gem/lib/keystone/keystone_const.rb +++ b/bindings/ruby/keystone_gem/lib/keystone/keystone_const.rb @@ -55,17 +55,18 @@ module Keystone KS_ERR_ASM_VARIANT_INVALID = 137 KS_ERR_ASM_EXPR_BRACKET = 138 KS_ERR_ASM_SYMBOL_MODIFIER = 139 - KS_ERR_ASM_RPAREN = 140 - KS_ERR_ASM_STAT_TOKEN = 141 - KS_ERR_ASM_UNSUPPORTED = 142 - KS_ERR_ASM_MACRO_TOKEN = 143 - KS_ERR_ASM_MACRO_PAREN = 144 - KS_ERR_ASM_MACRO_EQU = 145 - KS_ERR_ASM_MACRO_ARGS = 146 - KS_ERR_ASM_MACRO_LEVELS_EXCEED = 147 - KS_ERR_ASM_ESC_BACKSLASH = 148 - KS_ERR_ASM_ESC_OCTAL = 149 - KS_ERR_ASM_ESC_SEQUENCE = 150 + KS_ERR_ASM_SYMBOL_REDEFINED = 140 + KS_ERR_ASM_RPAREN = 141 + KS_ERR_ASM_STAT_TOKEN = 142 + KS_ERR_ASM_UNSUPPORTED = 143 + KS_ERR_ASM_MACRO_TOKEN = 144 + KS_ERR_ASM_MACRO_PAREN = 145 + KS_ERR_ASM_MACRO_EQU = 146 + KS_ERR_ASM_MACRO_ARGS = 147 + KS_ERR_ASM_MACRO_LEVELS_EXCEED = 148 + KS_ERR_ASM_ESC_BACKSLASH = 149 + KS_ERR_ASM_ESC_OCTAL = 150 + KS_ERR_ASM_ESC_SEQUENCE = 151 KS_ERR_ASM_INVALIDOPERAND = 512 KS_ERR_ASM_MISSINGFEATURE = 513 KS_ERR_ASM_MNEMONICFAIL = 514 diff --git a/include/keystone/keystone.h b/include/keystone/keystone.h index 07078ff9947598e61e95d33785544620f08cb325..dfd776fee0b5950dc6d87bcef6dc38ff194d2741 100644 --- a/include/keystone/keystone.h +++ b/include/keystone/keystone.h @@ -109,6 +109,7 @@ typedef enum ks_err { KS_ERR_ASM_VARIANT_INVALID, // invalid variant KS_ERR_ASM_EXPR_BRACKET, // brackets expression not supported on this target KS_ERR_ASM_SYMBOL_MODIFIER, // unexpected symbol modifier following '@' + KS_ERR_ASM_SYMBOL_REDEFINED, // invalid symbol redefinition KS_ERR_ASM_RPAREN, // expected ')' in parentheses expression KS_ERR_ASM_STAT_TOKEN, // unexpected token at start of statement KS_ERR_ASM_UNSUPPORTED, // unsupported token yet diff --git a/llvm/keystone/ks.cpp b/llvm/keystone/ks.cpp index 77d26da829c4359d2dea5669ab1c13b1d98916b6..fe3f0ba3d557dbd2f851afd9abd9f7c018b52eb0 100644 --- a/llvm/keystone/ks.cpp +++ b/llvm/keystone/ks.cpp @@ -92,6 +92,8 @@ const char *ks_strerror(ks_err code) return "Brackets expression not supported (KS_ERR_ASM_EXPR_BRACKET)"; case KS_ERR_ASM_SYMBOL_MODIFIER: // unexpected symbol modifier following '@' return "Unexpected symbol modifier following '@' (KS_ERR_ASM_SYMBOL_MODIFIER)"; + case KS_ERR_ASM_SYMBOL_REDEFINED: + return "Invalid symbol redefined (KS_ERR_ASM_SYMBOL_REDEFINED)"; case KS_ERR_ASM_RPAREN: // expected ')' in parentheses expression return "Expected ')' (KS_ERR_ASM_RPAREN)"; case KS_ERR_ASM_STAT_TOKEN: // unexpected token at start of statement diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index af71af799afafba25a077cba471ad86cf1b4e8a2..8378438f1a5dc150c193e9c28e9c25513ed17086 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -1551,8 +1551,11 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info, Sym->redefineIfPossible(); - if (!Sym->isUndefined() || Sym->isVariable()) - return Error(IDLoc, "invalid symbol redefinition"); + if (!Sym->isUndefined() || Sym->isVariable()) { + //return Error(IDLoc, "invalid symbol redefinition"); + Info.KsError = KS_ERR_ASM_SYMBOL_REDEFINED; + return true; + } // Emit the label. if (!ParsingInlineAsm)