aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCooper Qu <cooper.qu@linux.alibaba.com>2020-08-26 11:21:14 +0800
committerLifang Xia <lifang_xia@c-sky.com>2020-08-28 17:23:24 +0800
commit0861f561ebdd283e389c2c2fdb099bffadffecfa (patch)
treee5f13278de132426df58f2af728f1c7b747b790c /include
parent6194b866b7a89969d8c66f8a97d40acc028373b1 (diff)
downloadfsf-binutils-gdb-0861f561ebdd283e389c2c2fdb099bffadffecfa.zip
fsf-binutils-gdb-0861f561ebdd283e389c2c2fdb099bffadffecfa.tar.gz
fsf-binutils-gdb-0861f561ebdd283e389c2c2fdb099bffadffecfa.tar.bz2
CSKY: Support attribute section.
bfd * elf32-csky.c (csky_archs): Fix arch names. (csky_find_arch_with_name): New. (elf32_csky_merge_attributes): New. (csky_elf_merge_private_bfd_data): Add process of merge attribute section. (elf32_csky_obj_attrs_arg_type): New. (elf32_csky_obj_attrs_handle_unknown): New. (elf_backend_obj_attrs_vendor): Define. (elf_backend_obj_attrs_section): Define. (elf_backend_obj_attrs_arg_type): Define. (elf_backend_obj_attrs_section_type): Define. binutils/ * readelf.c (get_csky_section_type_name): New. (get_section_type_name): Add handler for CSKY. (display_csky_attribute): New. (process_arch_specific): Add handler for CSKY. * testsuite/binutils-all/strip-3.d: Remove .csky.attributes section. elfcpp/ * elfcpp.h (enum SHT): New enum SHT_CSKY_ATTRIBUTES. gas/ * gas/config/tc-csky.c (md_begin): Set attributes. (isa_flag): Change type to unsigned 64 bits. (struct csky_cpu_info): Likewise. (struct csky_macro_info): Likewise. (set_csky_attribute): New. * testsuite/gas/csky/802j.d: Ignore .csky.attributes section. * testsuite/gas/csky/all.d: Likewise. * testsuite/gas/csky/bsr1.d: Likewise. * testsuite/gas/csky/csky_vdsp.d: Likewise. * testsuite/gas/csky/cskyv2_all.d: Likewise. * testsuite/gas/csky/cskyv2_ck803r2.d: Likewise. * testsuite/gas/csky/cskyv2_ck860.d: Likewise. * testsuite/gas/csky/cskyv2_dsp.d: Likewise. * testsuite/gas/csky/cskyv2_elrw.d: Likewise. * testsuite/gas/csky/cskyv2_float.d: Likewise. * testsuite/gas/csky/enhance_dsp.d: Likewise. * testsuite/gas/csky/java.d: Likewise. * testsuite/gas/csky/v1_float.d: Likewise. * testsuite/gas/csky/v2_float_part1.d: Likewise. * testsuite/gas/csky/v2_float_part2.d: Likewise. * testsuite/gas/csky/v2_tls_gd.d: Likewise. * testsuite/gas/csky/v2_tls_ie.d: Likewise. * testsuite/gas/csky/v2_tls_ld.d: Likewise. * testsuite/gas/csky/v2_tls_le.d: Likewise. * testsuite/gas/elf/elf.exp: Add handler for CSKY. * testsuite/gas/elf/section2.e-csky: New. include/ * elf/csky.h (SHT_CSKY_ATTRIBUTES): Define. (Tag_CSKY_ARCH_NAME): New enum constant. (Tag_CSKY_CPU_NAME): Likewise. (Tag_CSKY_ISA_FLAGS): Likewise. (Tag_CSKY_DSP_VERSION): Likewise. (Tag_CSKY_VDSP_VERSION): Likewise. (Tag_CSKY_FPU_VERSION): Likewise. (Tag_CSKY_FPU_ABI): Likewise. (Tag_CSKY_FPU_ROUNDING): Likewise. (Tag_CSKY_FPU_DENORMAL): Likewise. (Tag_CSKY_FPU_Exception): Likewise. (Tag_CSKY_FPU_NUMBER_MODULE): Likewise. (Tag_CSKY_FPU_HARDFP): Likewise. (Tag_CSKY_MAX): Likewise. (VAL_CSKY_DSP_VERSION_EXTENSION): Likewise. (VAL_CSKY_DSP_VERSION_2): Likewise. (VAL_CSKY_VDSP_VERSION_1): Likewise. (VAL_CSKY_VDSP_VERSION_2): Likewise. (VAL_CSKY_FPU_ABI_SOFT): Likewise. (VAL_CSKY_FPU_ABI_SOFTFP): Likewise. (VAL_CSKY_FPU_ABI_HARD): Likewise. (VAL_CSKY_FPU_HARDFP_HALF): Likewise. (VAL_CSKY_FPU_HARDFP_SINGLE): Likewise. (VAL_CSKY_FPU_HARDFP_DOUBLE): Likewise. * opcode/csky.h (CSKY_ISA_VDSP_V2): Define. CSKYV1_ISA_E1: Change to long constant type. CSKYV2_ISA_E1: Likewise. CSKYV2_ISA_1E2: Likewise. CSKYV2_ISA_2E3: Likewise. CSKYV2_ISA_3E7: Likewise. CSKYV2_ISA_7E10: Likewise. CSKYV2_ISA_3E3R1: Likewise. CSKYV2_ISA_3E3R2: Likewise. CSKYV2_ISA_10E60: Likewise. CSKY_ISA_TRUST: Likewise. CSKY_ISA_CACHE: Likewise. CSKY_ISA_NVIC: Likewise. CSKY_ISA_CP: Likewise. CSKY_ISA_MP: Likewise. CSKY_ISA_MP_1E2: Likewise. CSKY_ISA_JAVA: Likewise. CSKY_ISA_MAC: Likewise. CSKY_ISA_MAC_DSP: Likewise. CSKY_ISA_DSP: Likewise. CSKY_ISA_DSP_1E2: Likewise. CSKY_ISA_DSP_ENHANCE: Likewise. CSKY_ISA_FLOAT_E1: Likewise. CSKY_ISA_FLOAT_1E2: Likewise. CSKY_ISA_FLOAT_1E3: Likewise. CSKY_ISA_FLOAT_3E4: Likewise. CSKY_ISA_VDSP: Likewise. ld/ * emulparams/cskyelf.sh: Support attribute section. * testsuite/ld-csky/tls-le-v1.d: Match .csky.attributes section. * ld/testsuite/ld-csky/tls-le.d: Likewise. * testsuite/ld-elf/non-contiguous.ld: Ignore .csky.attributes section. opcodes/ * csky-dis.c (CSKY_DEFAULT_ISA): Define. (csky_dis_info): Add member isa. (csky_find_inst_info): Skip instructions that do not belong to current CPU. (csky_get_disassembler): Get infomation from attribute section. (print_insn_csky): Set defualt ISA flag. * csky.h (CSKY_ISA_VDSP_2): Rename from CSKY_ISA_VDSP_V2. * csky-opc.h (struct csky_opcode): Change isa_flag16 and isa_flag32'type to unsigned 64 bits.
Diffstat (limited to 'include')
-rw-r--r--include/ChangeLog54
-rw-r--r--include/elf/csky.h75
-rw-r--r--include/opcode/csky.h55
3 files changed, 157 insertions, 27 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index c53e405..4da03f8 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,57 @@
+2020-08-28 Cooper Qu <cooper.qu@linux.alibaba.com>
+
+ * elf/csky.h (SHT_CSKY_ATTRIBUTES): Define.
+ (Tag_CSKY_ARCH_NAME): New enum constant.
+ (Tag_CSKY_CPU_NAME): Likewise.
+ (Tag_CSKY_ISA_FLAGS): Likewise.
+ (Tag_CSKY_DSP_VERSION): Likewise.
+ (Tag_CSKY_VDSP_VERSION): Likewise.
+ (Tag_CSKY_FPU_VERSION): Likewise.
+ (Tag_CSKY_FPU_ABI): Likewise.
+ (Tag_CSKY_FPU_ROUNDING): Likewise.
+ (Tag_CSKY_FPU_DENORMAL): Likewise.
+ (Tag_CSKY_FPU_Exception): Likewise.
+ (Tag_CSKY_FPU_NUMBER_MODULE): Likewise.
+ (Tag_CSKY_FPU_HARDFP): Likewise.
+ (Tag_CSKY_MAX): Likewise.
+ (VAL_CSKY_DSP_VERSION_EXTENSION): Likewise.
+ (VAL_CSKY_DSP_VERSION_2): Likewise.
+ (VAL_CSKY_VDSP_VERSION_1): Likewise.
+ (VAL_CSKY_VDSP_VERSION_2): Likewise.
+ (VAL_CSKY_FPU_ABI_SOFT): Likewise.
+ (VAL_CSKY_FPU_ABI_SOFTFP): Likewise.
+ (VAL_CSKY_FPU_ABI_HARD): Likewise.
+ (VAL_CSKY_FPU_HARDFP_HALF): Likewise.
+ (VAL_CSKY_FPU_HARDFP_SINGLE): Likewise.
+ (VAL_CSKY_FPU_HARDFP_DOUBLE): Likewise.
+ * opcode/csky.h (CSKY_ISA_VDSP_V2): Define.
+ CSKYV1_ISA_E1: Change to long constant type.
+ CSKYV2_ISA_E1: Likewise.
+ CSKYV2_ISA_1E2: Likewise.
+ CSKYV2_ISA_2E3: Likewise.
+ CSKYV2_ISA_3E7: Likewise.
+ CSKYV2_ISA_7E10: Likewise.
+ CSKYV2_ISA_3E3R1: Likewise.
+ CSKYV2_ISA_3E3R2: Likewise.
+ CSKYV2_ISA_10E60: Likewise.
+ CSKY_ISA_TRUST: Likewise.
+ CSKY_ISA_CACHE: Likewise.
+ CSKY_ISA_NVIC: Likewise.
+ CSKY_ISA_CP: Likewise.
+ CSKY_ISA_MP: Likewise.
+ CSKY_ISA_MP_1E2: Likewise.
+ CSKY_ISA_JAVA: Likewise.
+ CSKY_ISA_MAC: Likewise.
+ CSKY_ISA_MAC_DSP: Likewise.
+ CSKY_ISA_DSP: Likewise.
+ CSKY_ISA_DSP_1E2: Likewise.
+ CSKY_ISA_DSP_ENHANCE: Likewise.
+ CSKY_ISA_FLOAT_E1: Likewise.
+ CSKY_ISA_FLOAT_1E2: Likewise.
+ CSKY_ISA_FLOAT_1E3: Likewise.
+ CSKY_ISA_FLOAT_3E4: Likewise.
+ CSKY_ISA_VDSP: Likewise.
+
2020-08-27 Nick Alcock <nick.alcock@oracle.com>
* ctf-api.h (ctf_errwarning_next): New err parameter.
diff --git a/include/elf/csky.h b/include/elf/csky.h
index a057139..cbce6c0 100644
--- a/include/elf/csky.h
+++ b/include/elf/csky.h
@@ -94,4 +94,79 @@ START_RELOC_NUMBERS (elf_csky_reloc_type)
RELOC_NUMBER (R_CKCORE_PCREL_BLOOP_IMM12BY4, 64)
END_RELOC_NUMBERS (R_CKCORE_MAX)
+/* Additional section types. */
+#define SHT_CSKY_ATTRIBUTES 0x70000001 /* Section holds attributes. */
+
+/* Object attribute tags. */
+enum
+{
+ /* 0-3 are generic. */
+ /* Arch name for this object file. */
+ Tag_CSKY_ARCH_NAME = 4,
+ Tag_CSKY_CPU_NAME = 5,
+
+ /* ISA flags for this object file. */
+ Tag_CSKY_ISA_FLAGS,
+ Tag_CSKY_ISA_EXT_FLAGS,
+
+ /* CSKY DSP version used by this object file. */
+ Tag_CSKY_DSP_VERSION,
+
+ /* CSKY VDSP version used by this object file. */
+ Tag_CSKY_VDSP_VERSION,
+
+ /* CSKY FPU version used by this object file. */
+ Tag_CSKY_FPU_VERSION = 0x10,
+ /* FPU ABI. params: Soft GR/Hard GR/Hard FR. */
+ Tag_CSKY_FPU_ABI,
+ /* Rounding Support. */
+ Tag_CSKY_FPU_ROUNDING,
+ /* Denormal Support. */
+ Tag_CSKY_FPU_DENORMAL,
+ /* Exeception Support. */
+ Tag_CSKY_FPU_Exception,
+ /* Number Module Support("IEEE 754"). */
+ Tag_CSKY_FPU_NUMBER_MODULE,
+ /* Half/Single/Double. */
+ Tag_CSKY_FPU_HARDFP,
+
+ Tag_CSKY_MAX,
+};
+
+/* Object attribute values. */
+enum
+{
+ /* Values defined for Tag_CSKY_DSP_VERSION. */
+ VAL_CSKY_DSP_VERSION_EXTENSION = 1, /* hi-lo DSP extension. */
+ VAL_CSKY_DSP_VERSION_2 = 2, /* CK803s EDSP. */
+};
+
+enum
+{
+ /* Values defined for Tag_CSKY_VDSP_VERSION. */
+ VAL_CSKY_VDSP_VERSION_1 = 1, /* VDSP version 1. */
+ VAL_CSKY_VDSP_VERSION_2 /* VDSP version 1. */
+};
+
+enum
+{
+ /* Values defined for Tag_CSKY_FPU_VERSION. */
+ VAL_CSKY_FPU_VERSION_1 = 1, /* ABIV1 FPU. */
+ VAL_CSKY_FPU_VERSION_2, /* ABIV2 FPU. */
+};
+
+enum
+{
+ VAL_CSKY_FPU_ABI_SOFT = 1,
+ VAL_CSKY_FPU_ABI_SOFTFP,
+ VAL_CSKY_FPU_ABI_HARD,
+};
+
+enum
+{
+ VAL_CSKY_FPU_HARDFP_HALF = 1,
+ VAL_CSKY_FPU_HARDFP_SINGLE = 2,
+ VAL_CSKY_FPU_HARDFP_DOUBLE = 4,
+};
+
#endif /* _ELF_CSKY_H */
diff --git a/include/opcode/csky.h b/include/opcode/csky.h
index 098bdc9..493e822 100644
--- a/include/opcode/csky.h
+++ b/include/opcode/csky.h
@@ -22,41 +22,42 @@
#include "dis-asm.h"
/* The following bitmasks control instruction set architecture. */
-#define CSKYV1_ISA_E1 (1 << 0)
-#define CSKYV2_ISA_E1 (1 << 1)
-#define CSKYV2_ISA_1E2 (1 << 2)
-#define CSKYV2_ISA_2E3 (1 << 3)
-#define CSKYV2_ISA_3E7 (1 << 4)
-#define CSKYV2_ISA_7E10 (1 << 5)
-#define CSKYV2_ISA_3E3R1 (1 << 6)
-#define CSKYV2_ISA_3E3R2 (1 << 7)
-#define CSKYV2_ISA_10E60 (1 << 8)
-
-#define CSKY_ISA_TRUST (1 << 11)
-#define CSKY_ISA_CACHE (1 << 12)
-#define CSKY_ISA_NVIC (1 << 13)
-#define CSKY_ISA_CP (1 << 14)
-#define CSKY_ISA_MP (1 << 15)
-#define CSKY_ISA_MP_1E2 (1 << 16)
-#define CSKY_ISA_JAVA (1 << 17)
-#define CSKY_ISA_MAC (1 << 18)
-#define CSKY_ISA_MAC_DSP (1 << 19)
+#define CSKYV1_ISA_E1 (1L << 0)
+#define CSKYV2_ISA_E1 (1L << 1)
+#define CSKYV2_ISA_1E2 (1L << 2)
+#define CSKYV2_ISA_2E3 (1L << 3)
+#define CSKYV2_ISA_3E7 (1L << 4)
+#define CSKYV2_ISA_7E10 (1L << 5)
+#define CSKYV2_ISA_3E3R1 (1L << 6)
+#define CSKYV2_ISA_3E3R2 (1L << 7)
+#define CSKYV2_ISA_10E60 (1L << 8)
+
+#define CSKY_ISA_TRUST (1L << 11)
+#define CSKY_ISA_CACHE (1L << 12)
+#define CSKY_ISA_NVIC (1L << 13)
+#define CSKY_ISA_CP (1L << 14)
+#define CSKY_ISA_MP (1L << 15)
+#define CSKY_ISA_MP_1E2 (1L << 16)
+#define CSKY_ISA_JAVA (1L << 17)
+#define CSKY_ISA_MAC (1L << 18)
+#define CSKY_ISA_MAC_DSP (1L << 19)
/* Base ISA for csky v1 and v2. */
-#define CSKY_ISA_DSP (1 << 20)
-#define CSKY_ISA_DSP_1E2 (1 << 21)
-#define CSKY_ISA_DSP_ENHANCE (1 << 22)
+#define CSKY_ISA_DSP (1L << 20)
+#define CSKY_ISA_DSP_1E2 (1L << 21)
+#define CSKY_ISA_DSP_ENHANCE (1L << 22)
/* Base float instruction (803f & 810f). */
-#define CSKY_ISA_FLOAT_E1 (1 << 25)
+#define CSKY_ISA_FLOAT_E1 (1L << 25)
/* M_FLOAT support (810f). */
-#define CSKY_ISA_FLOAT_1E2 (1 << 26)
+#define CSKY_ISA_FLOAT_1E2 (1L << 26)
/* 803 support (803f). */
-#define CSKY_ISA_FLOAT_1E3 (1 << 27)
+#define CSKY_ISA_FLOAT_1E3 (1L << 27)
/* 807 support (803f & 807f). */
-#define CSKY_ISA_FLOAT_3E4 (1 << 28)
+#define CSKY_ISA_FLOAT_3E4 (1L << 28)
/* Vector DSP support. */
-#define CSKY_ISA_VDSP (1 << 29)
+#define CSKY_ISA_VDSP (1L << 29)
+#define CSKY_ISA_VDSP_2 (1L << 30)
/* The following bitmasks control cpu architecture for CSKY. */
#define CSKY_ABI_V1 (1 << 28)