RISC-V: Add gas support for "fp" register.

Message ID 20180629221606.11991-1-jimw@sifive.com
State New
Headers show
  • RISC-V: Add gas support for "fp" register.
Related show

Commit Message

Jim Wilson June 29, 2018, 10:16 p.m.
The architecture manual lists fp as an alias for x8/s0, and gdb supports it
as an alias, but gas does not.  This makes gas consistent with gdb.

Tested with some small hand written testcases, and the usual cross build and
make check for riscv{32,64}-{elf,linux}.  There were no regressions.



	* config/tc-riscv.c (md_begin): Call hash_reg_name for "fp".
 gas/config/tc-riscv.c | 3 +++
 1 file changed, 3 insertions(+)



diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index bdec30741b..5ba997e6ca 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -853,6 +853,9 @@  md_begin (void)
   hash_reg_names (RCLASS_FPR, riscv_fpr_names_numeric, NFPR);
   hash_reg_names (RCLASS_FPR, riscv_fpr_names_abi, NFPR);
+  /* Add "fp" as an alias for "s0".  */
+  hash_reg_name (RCLASS_GPR, "fp", 8);
   opcode_names_hash = hash_new ();
   init_opcode_names_hash ();