RISC-V: don't recognize bogus relocations
authorJan Beulich <jbeulich@suse.com>
Tue, 25 Apr 2023 09:17:19 +0000 (11:17 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 25 Apr 2023 09:17:19 +0000 (11:17 +0200)
With my_getSmallExpression() consistently and silently failing on
relocation operators not fitting an insn, it is no longer necessary to
hand it percent_op_itype[] "just in case" (i.e. to avoid errors when a
subsequent parsing attempt for another operand combination might
succeed). This also eliminates the latent problem of percent_op_itype[]
and percent_op_stype[] growing a non-identical set of recognized
relocation operators.

gas/config/tc-riscv.c

index 6b7112bc7c7b361588d26d33831f6a5e66511d2f..c99bab9b1c4da84c4c8dd41a61a2bf8b1c31a023 100644 (file)
@@ -2531,7 +2531,7 @@ riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr,
 
       imm_expr->X_op = O_absent;
       *imm_reloc = BFD_RELOC_UNUSED;
-      p = percent_op_itype;
+      p = percent_op_null;
 
       for (oparg = insn->args;; ++oparg)
        {
@@ -3247,7 +3247,6 @@ riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr,
              p = percent_op_rtype;
              goto alu_op;
            case '0': /* AMO displacement, which must be zero.  */
-             p = percent_op_null;
            load_store:
              if (riscv_handle_implicit_zero_offset (imm_expr, asarg))
                continue;