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

Jim Wilson jimw@sifive.com
Fri Jun 29 22:16:00 GMT 2018


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.

Committed.

Jim

	gas/
	* 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 ();
 
-- 
2.17.1



More information about the Binutils mailing list