diff options
-rw-r--r-- | gas/config/tc-riscv.c | 9 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/tprel-add.l | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index 160161c..6b7112b 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -2279,6 +2279,15 @@ my_getSmallExpression (expressionS *ep, bfd_reloc_code_real_type *reloc, && reloc_index < 1 && parse_relocation (&str, reloc, percent_op)); + if (*str == '%') + { + /* expression() will choke on anything looking like an (unrecognized) + relocation specifier. Don't even call it, avoiding multiple (and + perhaps redundant) error messages; our caller will issue one. */ + ep->X_op = O_illegal; + return 0; + } + my_getExpression (ep, crux); str = expr_parse_end; diff --git a/gas/testsuite/gas/riscv/tprel-add.l b/gas/testsuite/gas/riscv/tprel-add.l index 74bb535..1378c27 100644 --- a/gas/testsuite/gas/riscv/tprel-add.l +++ b/gas/testsuite/gas/riscv/tprel-add.l @@ -1,4 +1,3 @@ .*: Assembler messages: -.*: Error: bad expression .*: Error: illegal operands `amoadd.w x8,x9,%tprel_add\(i\)\(x10\)' .*: Error: illegal operands `add a5,a5,tp,0' |