[PATCH 2/4] CSKY: Add version flag in eflag and fix bug in disassembling register.

Cooper Qu cooper.qu@linux.alibaba.com
Mon Oct 12 14:30:18 GMT 2020


gas/
	* config/tc-csky.c (md_begin): Add version flag in eflag.

include/
	* opcode/csky.h (CSKY_VERSION_V1): Define, currently used.
	(CSKY_VERSION_V2): Define.
	(CSKY_VERSION_V3): Define.

opcodes/
	* csky-dis.c (get_gr_name): Fix bug in disassembling register.
	(get_cr_name): Likewise.

Change-Id: Iafe3a9ce6fe544880a225b9fae439275a828bb34
---
 gas/config/tc-csky.c  | 2 +-
 include/opcode/csky.h | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gas/config/tc-csky.c b/gas/config/tc-csky.c
index 23481b838b1..10272fede1c 100644
--- a/gas/config/tc-csky.c
+++ b/gas/config/tc-csky.c
@@ -1852,7 +1852,7 @@ md_begin (void)
     str_hash_insert (csky_macros_hash,
 		     v2_lrw_macro_opcode.name, &v2_lrw_macro_opcode, 0);
   /* Set e_flag to ELF Head.  */
-  bfd_set_private_flags (stdoutput, mach_flag & ~(0xffff));
+  bfd_set_private_flags (stdoutput, mach_flag | CSKY_VERSION_V1);
   /* Set bfd_mach to bfd backend data.  */
   bfd_set_arch_mach (stdoutput, bfd_arch_csky, bfd_mach_flag);
 
diff --git a/include/opcode/csky.h b/include/opcode/csky.h
index 1ff9dfa20f8..e368478b857 100644
--- a/include/opcode/csky.h
+++ b/include/opcode/csky.h
@@ -93,6 +93,11 @@
 #define CSKY_ARCH_JAVA      (1 << 8)
 #define CSKY_ARCH_APS       (1 << 7)
 
+/* eflag's Versions.  */
+#define CSKY_VERSION_V1     (1 << 24)
+#define CSKY_VERSION_V2     (2 << 24)
+#define CSKY_VERSION_V3     (3 << 24)
+
 #define IS_CSKY_V1(a) \
   (((a) & CSKY_ABI_MASK) == CSKY_ABI_V1)
 #define IS_CSKY_V2(a) \
-- 
2.26.2



More information about the Binutils mailing list