[1/4] arc: Add XML target features for Linux targets

Message ID 20200326125206.13120-2-shahab.vahedi@gmail.com
State Superseded
Headers show
Series
  • arc: Add GNU/Linux support
Related show

Commit Message

Simon Marchi via Gdb-patches March 26, 2020, 12:52 p.m.
From: Anton Kolesov <Anton.Kolesov@synopsys.com>


Add XML target features for Linux targets.  Compared to default
Linux features:

- Explicitly specify CPU machine.
- Remove baremetal only ILINK{,1,2} registers.
- Add LP_START and LP_END registers for hardware loops - required to
  properly evaluate possible next instruction during software single
  instruction stepping.
- Add BTA register which contains branch target address - address of
  next instruction when processor is in the delay slot.
- ARC HS description also adds R30, R58 and R59 registers, specific to
  this architecture.

gdb/ChangeLog:
2020-03-26  Anton Kolesov  <anton.kolesov@synopsys.com>

	* arch/arc.h (arc_create_target_description): Support Linux targets.
	* arch/arc.c (arc_create_target_description): Likewise.
	* arc-tdep.c (arc_tdesc_init): Update invocation of
	  arc_read_description.
	* features/Makefile (FEATURE_XMLFILES): Add new files.
	* features/arc/aux-arcompact-linux.xml: New file.
	* features/arc/aux-v2-linux.xml: Likewise.
	* features/arc/core-arcompact-linux.xml: Likewise.
	* features/arc/core-v2-linux.xml: Likewise.
	* features/arc/aux-arcompact-linux.c: Generate.
	* features/arc/aux-v2-linux.c: Likewise.
	* features/arc/core-arcompact-linux.c: Likewise.
	* features/arc/core-v2-linux.c: Likewise.
---
 gdb/arc-tdep.c                            |  4 +-
 gdb/arch/arc.c                            | 40 ++++++++++++----
 gdb/arch/arc.h                            | 18 ++++---
 gdb/features/Makefile                     |  4 ++
 gdb/features/arc/aux-arcompact-linux.c    | 34 +++++++++++++
 gdb/features/arc/aux-arcompact-linux.xml  | 31 ++++++++++++
 gdb/features/arc/aux-v2-linux.c           | 38 +++++++++++++++
 gdb/features/arc/aux-v2-linux.xml         | 35 ++++++++++++++
 gdb/features/arc/core-arcompact-linux.c   | 45 ++++++++++++++++++
 gdb/features/arc/core-arcompact-linux.xml | 56 ++++++++++++++++++++++
 gdb/features/arc/core-v2-linux.c          | 48 +++++++++++++++++++
 gdb/features/arc/core-v2-linux.xml        | 58 +++++++++++++++++++++++
 12 files changed, 394 insertions(+), 17 deletions(-)
 create mode 100644 gdb/features/arc/aux-arcompact-linux.c
 create mode 100644 gdb/features/arc/aux-arcompact-linux.xml
 create mode 100644 gdb/features/arc/aux-v2-linux.c
 create mode 100644 gdb/features/arc/aux-v2-linux.xml
 create mode 100644 gdb/features/arc/core-arcompact-linux.c
 create mode 100644 gdb/features/arc/core-arcompact-linux.xml
 create mode 100644 gdb/features/arc/core-v2-linux.c
 create mode 100644 gdb/features/arc/core-v2-linux.xml

-- 
2.26.0

Comments

Tom Tromey April 24, 2020, 1:46 p.m. | #1
>>>>> ">" == Shahab Vahedi via Gdb-patches <gdb-patches@sourceware.org> writes:


>> From: Anton Kolesov <Anton.Kolesov@synopsys.com>

>> Add XML target features for Linux targets.  Compared to default

>> Linux features:


>> - Explicitly specify CPU machine.

>> - Remove baremetal only ILINK{,1,2} registers.

>> - Add LP_START and LP_END registers for hardware loops - required to

>>   properly evaluate possible next instruction during software single

>>   instruction stepping.

>> - Add BTA register which contains branch target address - address of

>>   next instruction when processor is in the delay slot.

>> - ARC HS description also adds R30, R58 and R59 registers, specific to

>>   this architecture.


>> gdb/ChangeLog:

>> 2020-03-26  Anton Kolesov  <anton.kolesov@synopsys.com>


>> 	* arch/arc.h (arc_create_target_description): Support Linux targets.

>> 	* arch/arc.c (arc_create_target_description): Likewise.

>> 	* arc-tdep.c (arc_tdesc_init): Update invocation of

>> 	  arc_read_description.

>> 	* features/Makefile (FEATURE_XMLFILES): Add new files.

>> 	* features/arc/aux-arcompact-linux.xml: New file.

>> 	* features/arc/aux-v2-linux.xml: Likewise.

>> 	* features/arc/core-arcompact-linux.xml: Likewise.

>> 	* features/arc/core-v2-linux.xml: Likewise.

>> 	* features/arc/aux-arcompact-linux.c: Generate.

>> 	* features/arc/aux-v2-linux.c: Likewise.

>> 	* features/arc/core-arcompact-linux.c: Likewise.

>> 	* features/arc/core-v2-linux.c: Likewise.


Thanks, and sorry about the delay.  This is ok.

Tom

Patch

diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index 3020099c335..a4f3f44b4fb 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -1756,9 +1756,9 @@  arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc,
   if (!tdesc_has_registers (tdesc_loc))
     {
       if (is_arcv2)
-	tdesc_loc = arc_read_description (ARC_SYS_TYPE_ARCV2);
+	tdesc_loc = arc_read_description (ARC_SYS_TYPE_ARCV2_BMT);
       else
-	tdesc_loc = arc_read_description (ARC_SYS_TYPE_ARCOMPACT);
+	tdesc_loc = arc_read_description (ARC_SYS_TYPE_ARCOMPACT_BMT);
     }
   else
     {
diff --git a/gdb/arch/arc.c b/gdb/arch/arc.c
index 9552b4aff97..0babbf8a36a 100644
--- a/gdb/arch/arc.c
+++ b/gdb/arch/arc.c
@@ -24,8 +24,12 @@ 
 /* Target description features.  */
 #include "features/arc/core-v2.c"
 #include "features/arc/aux-v2.c"
+#include "features/arc/core-v2-linux.c"
+#include "features/arc/aux-v2-linux.c"
 #include "features/arc/core-arcompact.c"
 #include "features/arc/aux-arcompact.c"
+#include "features/arc/core-arcompact-linux.c"
+#include "features/arc/aux-arcompact-linux.c"
 
 /* See arc.h.  */
 
@@ -37,21 +41,39 @@  arc_create_target_description (arc_sys_type sys_type)
   long regnum = 0;
 
 #ifndef IN_PROCESS_AGENT
-  if (sys_type == ARC_SYS_TYPE_ARCV2)
+  if (sys_type == ARC_SYS_TYPE_ARCV2_BMT)
     set_tdesc_architecture (tdesc, "arc:ARCv2");
+  else if (sys_type == ARC_SYS_TYPE_ARCV2_LNX)
+    /* If this is ARCv2 Linux, then it is ARC HS.  */
+    set_tdesc_architecture (tdesc, "arc:HS");
   else
     set_tdesc_architecture (tdesc, "arc:ARC700");
+
+  if (sys_type == ARC_SYS_TYPE_ARCOMPACT_LNX
+      || sys_type == ARC_SYS_TYPE_ARCV2_LNX)
+    set_tdesc_osabi (tdesc, "GNU/Linux");
 #endif
 
-  if (sys_type == ARC_SYS_TYPE_ARCV2)
-    {
-      regnum = create_feature_arc_core_v2 (tdesc, regnum);
-      regnum = create_feature_arc_aux_v2 (tdesc, regnum);
-    }
-  else
+  switch (sys_type)
     {
-      regnum = create_feature_arc_core_arcompact (tdesc, regnum);
-      regnum = create_feature_arc_aux_arcompact (tdesc, regnum);
+    case ARC_SYS_TYPE_ARCOMPACT_BMT:
+	  regnum = create_feature_arc_core_arcompact (tdesc, regnum);
+	  regnum = create_feature_arc_aux_arcompact (tdesc, regnum);
+	  break;
+    case ARC_SYS_TYPE_ARCOMPACT_LNX:
+	  regnum = create_feature_arc_core_arcompact_linux (tdesc, regnum);
+	  regnum = create_feature_arc_aux_arcompact_linux (tdesc, regnum);
+	  break;
+    case ARC_SYS_TYPE_ARCV2_BMT:
+	  regnum = create_feature_arc_core_v2 (tdesc, regnum);
+	  regnum = create_feature_arc_aux_v2 (tdesc, regnum);
+	  break;
+    case ARC_SYS_TYPE_ARCV2_LNX:
+	  regnum = create_feature_arc_core_v2_linux (tdesc, regnum);
+	  regnum = create_feature_arc_aux_v2_linux (tdesc, regnum);
+	  break;
+    default:
+	  gdb_assert(!"Invalid arc_sys_type.");
     }
 
   return tdesc;
diff --git a/gdb/arch/arc.h b/gdb/arch/arc.h
index fd806ae7d34..3c19118b946 100644
--- a/gdb/arch/arc.h
+++ b/gdb/arch/arc.h
@@ -23,8 +23,10 @@ 
 /* Supported ARC system hardware types.  */
 enum arc_sys_type
 {
-  ARC_SYS_TYPE_ARCOMPACT = 0,	  /* ARC600 or ARC700 */
-  ARC_SYS_TYPE_ARCV2,		  /* ARC EM or ARC HS */
+  ARC_SYS_TYPE_ARCOMPACT_BMT = 0, /* ARC600 or ARC700 (baremetal) */
+  ARC_SYS_TYPE_ARCOMPACT_LNX,	  /* ARC600 or ARC700 (linux) */
+  ARC_SYS_TYPE_ARCV2_BMT,	  /* ARC EM or ARC HS (baremetal) */
+  ARC_SYS_TYPE_ARCV2_LNX,	  /* ARC HS (linux) */
   ARC_SYS_TYPE_NUM
 };
 
@@ -33,10 +35,14 @@  arc_sys_type_to_str (const arc_sys_type type)
 {
   switch (type)
     {
-    case ARC_SYS_TYPE_ARCOMPACT:
-      return "ARC_SYS_TYPE_ARCOMPACT";
-    case ARC_SYS_TYPE_ARCV2:
-      return "ARC_SYS_TYPE_ARCV2";
+    case ARC_SYS_TYPE_ARCOMPACT_BMT:
+      return "ARC_SYS_TYPE_ARCOMPACT_BMT";
+    case ARC_SYS_TYPE_ARCOMPACT_LNX:
+      return "ARC_SYS_TYPE_ARCOMPACT_LNX";
+    case ARC_SYS_TYPE_ARCV2_BMT:
+      return "ARC_SYS_TYPE_ARCV2_BMT";
+    case ARC_SYS_TYPE_ARCV2_LNX:
+      return "ARC_SYS_TYPE_ARCV2_LNX";
     default:
       return "Invalid";
     }
diff --git a/gdb/features/Makefile b/gdb/features/Makefile
index cc65baa6eda..a95be667dc1 100644
--- a/gdb/features/Makefile
+++ b/gdb/features/Makefile
@@ -206,8 +206,12 @@  FEATURE_XMLFILES = aarch64-core.xml \
 	aarch64-pauth.xml \
 	arc/core-v2.xml \
 	arc/aux-v2.xml \
+	arc/core-v2-linux.xml \
+	arc/aux-v2-linux.xml \
 	arc/core-arcompact.xml \
 	arc/aux-arcompact.xml \
+	arc/core-arcompact-linux.xml \
+	arc/aux-arcompact-linux.xml \
 	arm/arm-core.xml \
 	arm/arm-fpa.xml \
 	arm/arm-m-profile.xml \
diff --git a/gdb/features/arc/aux-arcompact-linux.c b/gdb/features/arc/aux-arcompact-linux.c
new file mode 100644
index 00000000000..41f26c1e2ec
--- /dev/null
+++ b/gdb/features/arc/aux-arcompact-linux.c
@@ -0,0 +1,34 @@ 
+/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
+  Original: aux-arcompact-linux.xml */
+
+#include "gdbsupport/tdesc.h"
+
+static int
+create_feature_arc_aux_arcompact_linux (struct target_desc *result, long regnum)
+{
+  struct tdesc_feature *feature;
+
+  feature = tdesc_create_feature (result, "org.gnu.gdb.arc.aux-minimal");
+  tdesc_type_with_fields *type_with_fields;
+  type_with_fields = tdesc_create_flags (feature, "status32_type", 4);
+  tdesc_add_flag (type_with_fields, 0, "H");
+  tdesc_add_bitfield (type_with_fields, "E", 1, 2);
+  tdesc_add_bitfield (type_with_fields, "A", 3, 4);
+  tdesc_add_flag (type_with_fields, 5, "AE");
+  tdesc_add_flag (type_with_fields, 6, "DE");
+  tdesc_add_flag (type_with_fields, 7, "U");
+  tdesc_add_flag (type_with_fields, 8, "V");
+  tdesc_add_flag (type_with_fields, 9, "C");
+  tdesc_add_flag (type_with_fields, 10, "N");
+  tdesc_add_flag (type_with_fields, 11, "Z");
+  tdesc_add_flag (type_with_fields, 12, "L");
+  tdesc_add_flag (type_with_fields, 13, "R");
+  tdesc_add_flag (type_with_fields, 14, "SE");
+
+  tdesc_create_reg (feature, "pc", regnum++, 1, NULL, 32, "code_ptr");
+  tdesc_create_reg (feature, "status32", regnum++, 1, NULL, 32, "status32_type");
+  tdesc_create_reg (feature, "lp_start", regnum++, 1, NULL, 32, "code_ptr");
+  tdesc_create_reg (feature, "lp_end", regnum++, 1, NULL, 32, "code_ptr");
+  tdesc_create_reg (feature, "bta", regnum++, 1, NULL, 32, "code_ptr");
+  return regnum;
+}
diff --git a/gdb/features/arc/aux-arcompact-linux.xml b/gdb/features/arc/aux-arcompact-linux.xml
new file mode 100644
index 00000000000..0d72373eda3
--- /dev/null
+++ b/gdb/features/arc/aux-arcompact-linux.xml
@@ -0,0 +1,31 @@ 
+<?xml version="1.0"?>
+<!-- Copyright (C) 2020 Free Software Foundation, Inc.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+
+<!DOCTYPE target SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.arc.aux-minimal">
+  <flags id="status32_type" size="4">
+      <field name="H"   start="0" end="0"/>
+      <field name="E"   start="1" end="2"/>
+      <field name="A"   start="3" end="4"/>
+      <field name="AE"  start="5" end="5"/>
+      <field name="DE"  start="6" end="6"/>
+      <field name="U"   start="7" end="7"/>
+      <field name="V"   start="8" end="8"/>
+      <field name="C"   start="9" end="9"/>
+      <field name="N"   start="10" end="10"/>
+      <field name="Z"   start="11" end="11"/>
+      <field name="L"   start="12" end="12"/>
+      <field name="R"  start="13" end="13"/>
+      <field name="SE"  start="14" end="14"/>
+  </flags>
+
+  <reg name="pc"       bitsize="32" type="code_ptr"/>
+  <reg name="status32" bitsize="32" type="status32_type"/>
+  <reg name="lp_start" bitsize="32" type="code_ptr"/>
+  <reg name="lp_end"   bitsize="32" type="code_ptr"/>
+  <reg name="bta"      bitsize="32" type="code_ptr"/>
+</feature>
diff --git a/gdb/features/arc/aux-v2-linux.c b/gdb/features/arc/aux-v2-linux.c
new file mode 100644
index 00000000000..6e4d7c02efa
--- /dev/null
+++ b/gdb/features/arc/aux-v2-linux.c
@@ -0,0 +1,38 @@ 
+/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
+  Original: aux-v2-linux.xml */
+
+#include "gdbsupport/tdesc.h"
+
+static int
+create_feature_arc_aux_v2_linux (struct target_desc *result, long regnum)
+{
+  struct tdesc_feature *feature;
+
+  feature = tdesc_create_feature (result, "org.gnu.gdb.arc.aux-minimal");
+  tdesc_type_with_fields *type_with_fields;
+  type_with_fields = tdesc_create_flags (feature, "status32_type", 4);
+  tdesc_add_flag (type_with_fields, 0, "H");
+  tdesc_add_bitfield (type_with_fields, "E", 1, 4);
+  tdesc_add_flag (type_with_fields, 5, "AE");
+  tdesc_add_flag (type_with_fields, 6, "DE");
+  tdesc_add_flag (type_with_fields, 7, "U");
+  tdesc_add_flag (type_with_fields, 8, "V");
+  tdesc_add_flag (type_with_fields, 9, "C");
+  tdesc_add_flag (type_with_fields, 10, "N");
+  tdesc_add_flag (type_with_fields, 11, "Z");
+  tdesc_add_flag (type_with_fields, 12, "L");
+  tdesc_add_flag (type_with_fields, 13, "DZ");
+  tdesc_add_flag (type_with_fields, 14, "SC");
+  tdesc_add_flag (type_with_fields, 15, "ES");
+  tdesc_add_bitfield (type_with_fields, "RB", 16, 18);
+  tdesc_add_flag (type_with_fields, 19, "AD");
+  tdesc_add_flag (type_with_fields, 20, "US");
+  tdesc_add_flag (type_with_fields, 31, "IE");
+
+  tdesc_create_reg (feature, "pc", regnum++, 1, NULL, 32, "code_ptr");
+  tdesc_create_reg (feature, "status32", regnum++, 1, NULL, 32, "status32_type");
+  tdesc_create_reg (feature, "lp_start", regnum++, 1, NULL, 32, "code_ptr");
+  tdesc_create_reg (feature, "lp_end", regnum++, 1, NULL, 32, "code_ptr");
+  tdesc_create_reg (feature, "bta", regnum++, 1, NULL, 32, "code_ptr");
+  return regnum;
+}
diff --git a/gdb/features/arc/aux-v2-linux.xml b/gdb/features/arc/aux-v2-linux.xml
new file mode 100644
index 00000000000..165ebb1d6d6
--- /dev/null
+++ b/gdb/features/arc/aux-v2-linux.xml
@@ -0,0 +1,35 @@ 
+<?xml version="1.0"?>
+<!-- Copyright (C) 2020 Free Software Foundation, Inc.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+
+<!DOCTYPE target SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.arc.aux-minimal">
+  <flags id="status32_type" size="4">
+      <field name="H"   start="0" end="0"/>
+      <field name="E"   start="1" end="4"/>
+      <field name="AE"  start="5" end="5"/>
+      <field name="DE"  start="6" end="6"/>
+      <field name="U"   start="7" end="7"/>
+      <field name="V"   start="8" end="8"/>
+      <field name="C"   start="9" end="9"/>
+      <field name="N"   start="10" end="10"/>
+      <field name="Z"   start="11" end="11"/>
+      <field name="L"   start="12" end="12"/>
+      <field name="DZ"  start="13" end="13"/>
+      <field name="SC"  start="14" end="14"/>
+      <field name="ES"  start="15" end="15"/>
+      <field name="RB"  start="16" end="18"/>
+      <field name="AD"  start="19" end="19"/>
+      <field name="US"  start="20" end="20"/>
+      <field name="IE"  start="31" end="31"/>
+  </flags>
+
+  <reg name="pc"       bitsize="32" type="code_ptr"/>
+  <reg name="status32" bitsize="32" type="status32_type"/>
+  <reg name="lp_start" bitsize="32" type="code_ptr"/>
+  <reg name="lp_end"   bitsize="32" type="code_ptr"/>
+  <reg name="bta"      bitsize="32" type="code_ptr"/>
+</feature>
diff --git a/gdb/features/arc/core-arcompact-linux.c b/gdb/features/arc/core-arcompact-linux.c
new file mode 100644
index 00000000000..c870413e922
--- /dev/null
+++ b/gdb/features/arc/core-arcompact-linux.c
@@ -0,0 +1,45 @@ 
+/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
+  Original: core-arcompact-linux.xml */
+
+#include "gdbsupport/tdesc.h"
+
+static int
+create_feature_arc_core_arcompact_linux (struct target_desc *result, long regnum)
+{
+  struct tdesc_feature *feature;
+
+  feature = tdesc_create_feature (result, "org.gnu.gdb.arc.core.arcompact");
+  tdesc_create_reg (feature, "r0", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r1", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r2", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r3", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r4", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r5", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r6", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r7", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r8", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r9", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r10", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r11", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r12", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r13", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r14", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r15", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r16", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r17", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r18", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r19", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r20", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r21", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r22", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r23", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r24", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r25", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "gp", regnum++, 1, NULL, 32, "data_ptr");
+  tdesc_create_reg (feature, "fp", regnum++, 1, NULL, 32, "data_ptr");
+  tdesc_create_reg (feature, "sp", regnum++, 1, NULL, 32, "data_ptr");
+  tdesc_create_reg (feature, "blink", regnum++, 1, NULL, 32, "code_ptr");
+  tdesc_create_reg (feature, "lp_count", regnum++, 1, NULL, 32, "uint32");
+  tdesc_create_reg (feature, "pcl", regnum++, 1, NULL, 32, "code_ptr");
+  return regnum;
+}
diff --git a/gdb/features/arc/core-arcompact-linux.xml b/gdb/features/arc/core-arcompact-linux.xml
new file mode 100644
index 00000000000..9b2865d32be
--- /dev/null
+++ b/gdb/features/arc/core-arcompact-linux.xml
@@ -0,0 +1,56 @@ 
+<?xml version="1.0"?>
+<!-- Copyright (C) 2020 Free Software Foundation, Inc.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+
+<!DOCTYPE target SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.arc.core.arcompact">
+  <reg name="r0"  bitsize="32"/>
+  <reg name="r1"  bitsize="32"/>
+  <reg name="r2"  bitsize="32"/>
+  <reg name="r3"  bitsize="32"/>
+  <reg name="r4"  bitsize="32"/>
+  <reg name="r5"  bitsize="32"/>
+  <reg name="r6"  bitsize="32"/>
+  <reg name="r7"  bitsize="32"/>
+  <reg name="r8"  bitsize="32"/>
+  <reg name="r9"  bitsize="32"/>
+  <reg name="r10" bitsize="32"/>
+  <reg name="r11" bitsize="32"/>
+  <reg name="r12" bitsize="32"/>
+  <reg name="r13" bitsize="32"/>
+  <reg name="r14" bitsize="32"/>
+  <reg name="r15" bitsize="32"/>
+  <reg name="r16" bitsize="32"/>
+  <reg name="r17" bitsize="32"/>
+  <reg name="r18" bitsize="32"/>
+  <reg name="r19" bitsize="32"/>
+  <reg name="r20" bitsize="32"/>
+  <reg name="r21" bitsize="32"/>
+  <reg name="r22" bitsize="32"/>
+  <reg name="r23" bitsize="32"/>
+  <reg name="r24" bitsize="32"/>
+  <reg name="r25" bitsize="32"/>
+
+  <!-- ARC core data pointer registers.  -->
+  <reg name="gp"  bitsize="32" type="data_ptr"/>
+  <reg name="fp"  bitsize="32" type="data_ptr"/>
+  <reg name="sp"  bitsize="32" type="data_ptr"/>
+
+  <!-- Code pointers.  -->
+  <reg name="blink"  bitsize="32" type="code_ptr"/>
+
+  <!-- Here goes extension core registers: r32 - r59 -->
+
+  <!-- Loop counter.  -->
+  <reg name="lp_count" bitsize="32" type="uint32"/>
+
+  <!-- r61 is a reserved register address.  -->
+
+  <!-- r62 is a long immediate value, not a real register.  -->
+
+  <!-- 4-byte aligned read-only program counter.  -->
+  <reg name="pcl" bitsize="32" type="code_ptr" group=""/>
+</feature>
diff --git a/gdb/features/arc/core-v2-linux.c b/gdb/features/arc/core-v2-linux.c
new file mode 100644
index 00000000000..d3e563778ff
--- /dev/null
+++ b/gdb/features/arc/core-v2-linux.c
@@ -0,0 +1,48 @@ 
+/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
+  Original: core-v2-linux.xml */
+
+#include "gdbsupport/tdesc.h"
+
+static int
+create_feature_arc_core_v2_linux (struct target_desc *result, long regnum)
+{
+  struct tdesc_feature *feature;
+
+  feature = tdesc_create_feature (result, "org.gnu.gdb.arc.core.v2");
+  tdesc_create_reg (feature, "r0", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r1", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r2", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r3", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r4", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r5", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r6", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r7", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r8", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r9", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r10", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r11", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r12", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r13", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r14", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r15", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r16", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r17", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r18", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r19", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r20", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r21", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r22", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r23", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r24", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r25", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "gp", regnum++, 1, NULL, 32, "data_ptr");
+  tdesc_create_reg (feature, "fp", regnum++, 1, NULL, 32, "data_ptr");
+  tdesc_create_reg (feature, "sp", regnum++, 1, NULL, 32, "data_ptr");
+  tdesc_create_reg (feature, "r30", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "blink", regnum++, 1, NULL, 32, "code_ptr");
+  tdesc_create_reg (feature, "r58", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "r59", regnum++, 1, NULL, 32, "int");
+  tdesc_create_reg (feature, "lp_count", regnum++, 1, NULL, 32, "uint32");
+  tdesc_create_reg (feature, "pcl", regnum++, 1, NULL, 32, "code_ptr");
+  return regnum;
+}
diff --git a/gdb/features/arc/core-v2-linux.xml b/gdb/features/arc/core-v2-linux.xml
new file mode 100644
index 00000000000..3ac4a86da56
--- /dev/null
+++ b/gdb/features/arc/core-v2-linux.xml
@@ -0,0 +1,58 @@ 
+<?xml version="1.0"?>
+<!-- Copyright (C) 2020 Free Software Foundation, Inc.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+
+<!DOCTYPE target SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.arc.core.v2">
+  <reg name="r0"  bitsize="32"/>
+  <reg name="r1"  bitsize="32"/>
+  <reg name="r2"  bitsize="32"/>
+  <reg name="r3"  bitsize="32"/>
+  <reg name="r4"  bitsize="32"/>
+  <reg name="r5"  bitsize="32"/>
+  <reg name="r6"  bitsize="32"/>
+  <reg name="r7"  bitsize="32"/>
+  <reg name="r8"  bitsize="32"/>
+  <reg name="r9"  bitsize="32"/>
+  <reg name="r10" bitsize="32"/>
+  <reg name="r11" bitsize="32"/>
+  <reg name="r12" bitsize="32"/>
+  <reg name="r13" bitsize="32"/>
+  <reg name="r14" bitsize="32"/>
+  <reg name="r15" bitsize="32"/>
+  <reg name="r16" bitsize="32"/>
+  <reg name="r17" bitsize="32"/>
+  <reg name="r18" bitsize="32"/>
+  <reg name="r19" bitsize="32"/>
+  <reg name="r20" bitsize="32"/>
+  <reg name="r21" bitsize="32"/>
+  <reg name="r22" bitsize="32"/>
+  <reg name="r23" bitsize="32"/>
+  <reg name="r24" bitsize="32"/>
+  <reg name="r25" bitsize="32"/>
+
+  <!-- ARC core data pointer registers.  -->
+  <reg name="gp"  bitsize="32" type="data_ptr"/>
+  <reg name="fp"  bitsize="32" type="data_ptr"/>
+  <reg name="sp"  bitsize="32" type="data_ptr"/>
+
+  <reg name="r30"   bitsize="32" group=""/>
+  <reg name="blink" bitsize="32" type="code_ptr"/>
+
+  <!-- Here goes extension core registers: r32 - r57.  -->
+  <reg name="r58"   bitsize="32"/>
+  <reg name="r59"   bitsize="32"/>
+
+  <!-- Loop counter.  -->
+  <reg name="lp_count" bitsize="32" type="uint32"/>
+
+  <!-- r61 is a reserved register address.  -->
+
+  <!-- r62 is a long immediate value, not a real register.  -->
+
+  <!-- 4-byte aligned read-only program counter.  -->
+  <reg name="pcl" bitsize="32" type="code_ptr" group=""/>
+</feature>