]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
RISC-V/GAS: Support more relocs against constant addresses
authorAndrew Waterman <andrew@sifive.com>
Thu, 22 Dec 2016 02:05:28 +0000 (18:05 -0800)
committerPalmer Dabbelt <palmer@dabbelt.com>
Tue, 17 Jan 2017 05:33:14 +0000 (21:33 -0800)
Previously, some pseudoinstructions like "call" only accepted
symbolic addresses and rejected constant addresses with an
esoteric internal error.  This patch enables them by deferring
application of constant relocations to md_apply_fix, rather than
eagerly applying them during instruction assembly.

gas/ChangeLog

2017-01-09  Andrew Waterman <andrew@sifive.com>

* config/tc-riscv.c (append_insn): Don't eagerly apply relocations
against constants.
(md_apply_fix): Mark relocations against constants as "done."

gas/ChangeLog
gas/config/tc-riscv.c

index 80857d7e378e728ebcdb87ddefeff1358344595f..4069f545475f37dfbdd7229f4770a56b3f4aef76 100644 (file)
        against constants.
        (md_apply_fix): Mark relocations against constants as "done."
 
+2017-01-09  Andrew Waterman <andrew@sifive.com>
+
+       * config/tc-riscv.c (append_insn): Don't eagerly apply relocations
+       against constants.
+       (md_apply_fix): Mark relocations against constants as "done."
+
 2017-01-09  Palmer Dabbelt <palmer@dabbelt.com>
            Kito Cheng <kito.cheng@gmail.com>
 
index bf870e66d8549693f4a5bf1402ea05b3dcfa347a..ec5b0bb03629d506bc76250eed4eb2cb0a25a655 100644 (file)
@@ -682,9 +682,6 @@ append_insn (struct riscv_cl_insn *ip, expressionS *address_expr,
                            address_expr->X_add_number);
          return;
        }
-      else if (address_expr->X_op == O_constant)
-       ip->insn_opcode |= riscv_apply_const_reloc (reloc_type,
-                                                   address_expr->X_add_number);
       else
        {
          howto = bfd_reloc_type_lookup (stdoutput, reloc_type);
@@ -1851,6 +1848,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
     case BFD_RELOC_RISCV_LO12_S:
       bfd_putl32 (riscv_apply_const_reloc (fixP->fx_r_type, *valP)
                  | bfd_getl32 (buf), buf);
+      if (fixP->fx_addsy == NULL)
+       fixP->fx_done = TRUE;
       relaxable = TRUE;
       break;