diff mbox

Move arch/tdesc.h to common/common-tdesc.h

Message ID CF1310CF-73E4-43FD-A418-DACABCC9A246@arm.com
State New
Headers show

Commit Message

Alan Hayward Feb. 20, 2018, 11:56 a.m. UTC
> On 7 Feb 2018, at 10:31, Alan Hayward <Alan.Hayward@arm.com> wrote:

> 

> 

> 

>> On 7 Feb 2018, at 09:32, Yao Qi <qiyaoltc@gmail.com> wrote:

>> 

>> On Wed, Feb 7, 2018 at 9:02 AM, Philipp Rudo <prudo@linux.vnet.ibm.com> wrote:

>>> Hi Yao,

>>> 

>>> sorry, i misunderstood you.  You are right cleaning up gdbservers Makefile

>>> would be better.  I'm currently pretty occupied, but I can give it a try later

>>> on.  Let's see what I can do.

>>> 

>> 

>> Never mind, I do think I misread email everyday :)

>> 

>> FAOD, both GDB and GDBserver needs clean up.  Something had already

>> happened on this topic,

>> 

>> f38307f [RFC] Replicate src dir in build dir

>> 

>> we have arch/ directory in gdb and gdbserver build tree after this patch.  This

>> patch was written in a way that is easy to create other directories.  I didn't

>> follow up this patch to create nat/ target/ etc directories in gdb and gdbserver

>> build tree because of other assignments.  Later, Tom changed it

>> 

>> b22c88c A simpler way to make the "arch" build directory

>> 

>> I didn't follow that patch series, so I don't know how to extend existing

>> mechanism to create other directories.  Note that Tom's patch only changes

>> gdb, gdbserver still uses the approach added in f38307f.  I hope both gdb

>> and gdbserver have the same approach ultimately.

>> 

> 

> Agree with the discussion above. Having a common/ dir in the build directory

> Would be nice.

> Been taking a quick look at this today, and I think I’ve got something working.

> Will post as a new patch a bit later.

> 

> Alan.


Ok, after pushing the patch to add a common directory, I’ve updated this
patch. Now we have the common dir, we can simply move arch/tdesc.h to
common/tdesc.h

Tested by build for x86, ppc and aarch64, using both make 4.1 and make 3.81.
Ran unittests for x86. Checked that my later patch series can apply on top.

2018-02-20  Alan Hayward  <alan.hayward@arm.com>

gdb/
	* arch/amd64.h: Use common/tdesc.h.
	* arch/i386.c: Likewise.
	* arch/i386.h: Likewise.
	* arch/tic6x.c: Likewise.
	* arch/tdesc.h: Move file from here...
	* common/tdesc.h: ...to here.
	* features/aarch64-core.c: Regenerate.
	* features/aarch64-fpu.c: Regenerate.
	* features/i386/32bit-avx.c: Regenerate.
	* features/i386/32bit-avx512.c: Regenerate.
	* features/i386/32bit-core.c: Regenerate.
	* features/i386/32bit-linux.c: Regenerate.
	* features/i386/32bit-mpx.c: Regenerate.
	* features/i386/32bit-pkeys.c: Regenerate.
	* features/i386/32bit-sse.c: Regenerate.
	* features/i386/64bit-avx.c: Regenerate.
	* features/i386/64bit-avx512.c: Regenerate.
	* features/i386/64bit-core.c: Regenerate.
	* features/i386/64bit-linux.c: Regenerate.
	* features/i386/64bit-mpx.c: Regenerate.
	* features/i386/64bit-pkeys.c: Regenerate.
	* features/i386/64bit-segments.c: Regenerate.
	* features/i386/64bit-sse.c: Regenerate.
	* features/i386/x32-core.c: Regenerate.
	* features/tic6x-c6xp.c: Regenerate.
	* features/tic6x-core.c: Regenerate.
	* features/tic6x-gp.c: Regenerate.
	* target-descriptions.c: Use common/tdesc.h.
	* target-descriptions.h: Likewise.

gdbserver/
	* tdesc.c: Use common/tdesc.h.
	* tdesc.h: Likewise.

---
 gdb/arch/amd64.h                   |  2 +-
 gdb/arch/i386.c                    |  2 +-
 gdb/arch/i386.h                    |  2 +-
 gdb/arch/tic6x.c                   |  2 +-
 gdb/{arch => common}/tdesc.h       |  0
 gdb/features/aarch64-core.c        |  2 +-
 gdb/features/aarch64-fpu.c         |  2 +-
 gdb/features/i386/32bit-avx.c      |  2 +-
 gdb/features/i386/32bit-avx512.c   |  2 +-
 gdb/features/i386/32bit-core.c     |  2 +-
 gdb/features/i386/32bit-linux.c    |  2 +-
 gdb/features/i386/32bit-mpx.c      |  2 +-
 gdb/features/i386/32bit-pkeys.c    |  2 +-
 gdb/features/i386/32bit-sse.c      |  2 +-
 gdb/features/i386/64bit-avx.c      |  2 +-
 gdb/features/i386/64bit-avx512.c   |  2 +-
 gdb/features/i386/64bit-core.c     |  2 +-
 gdb/features/i386/64bit-linux.c    |  2 +-
 gdb/features/i386/64bit-mpx.c      |  2 +-
 gdb/features/i386/64bit-pkeys.c    |  2 +-
 gdb/features/i386/64bit-segments.c |  2 +-
 gdb/features/i386/64bit-sse.c      |  2 +-
 gdb/features/i386/x32-core.c       |  2 +-
 gdb/features/tic6x-c6xp.c          |  2 +-
 gdb/features/tic6x-core.c          |  2 +-
 gdb/features/tic6x-gp.c            |  2 +-
 gdb/gdbserver/tdesc.c              | 24 ++++++++++++------------
 gdb/gdbserver/tdesc.h              |  2 +-
 gdb/target-descriptions.c          | 28 ++++++++++++++--------------
 gdb/target-descriptions.h          |  2 +-
 30 files changed, 53 insertions(+), 53 deletions(-)
 rename gdb/{arch => common}/tdesc.h (100%)


 tdesc_create_reg (struct tdesc_feature *feature, const char *name,
@@ -1489,7 +1489,7 @@ tdesc_create_reg (struct tdesc_feature *feature, const char *name,
   feature->registers.emplace_back (reg);
 }

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 struct tdesc_type *
 tdesc_create_vector (struct tdesc_feature *feature, const char *name,
@@ -1501,7 +1501,7 @@ tdesc_create_vector (struct tdesc_feature *feature, const char *name,
   return type;
 }

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 tdesc_type_with_fields *
 tdesc_create_struct (struct tdesc_feature *feature, const char *name)
@@ -1513,7 +1513,7 @@ tdesc_create_struct (struct tdesc_feature *feature, const char *name)
   return type;
 }

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 void
 tdesc_set_struct_size (tdesc_type_with_fields *type, int size)
@@ -1523,7 +1523,7 @@ tdesc_set_struct_size (tdesc_type_with_fields *type, int size)
   type->size = size;
 }

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 tdesc_type_with_fields *
 tdesc_create_union (struct tdesc_feature *feature, const char *name)
@@ -1535,7 +1535,7 @@ tdesc_create_union (struct tdesc_feature *feature, const char *name)
   return type;
 }

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 tdesc_type_with_fields *
 tdesc_create_flags (struct tdesc_feature *feature, const char *name,
@@ -1563,7 +1563,7 @@ tdesc_create_enum (struct tdesc_feature *feature, const char *name,
   return type;
 }

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 void
 tdesc_add_field (tdesc_type_with_fields *type, const char *field_name,
@@ -1588,7 +1588,7 @@ tdesc_add_typed_bitfield (tdesc_type_with_fields *type, const char *field_name,
   type->fields.emplace_back (field_name, field_type, start, end);
 }

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 void
 tdesc_add_bitfield (tdesc_type_with_fields *type, const char *field_name,
@@ -1606,7 +1606,7 @@ tdesc_add_bitfield (tdesc_type_with_fields *type, const char *field_name,
   tdesc_add_typed_bitfield (type, field_name, start, end, field_type);
 }

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 void
 tdesc_add_flag (tdesc_type_with_fields *type, int start,
@@ -1630,7 +1630,7 @@ tdesc_add_enum_value (tdesc_type_with_fields *type, int value,
 			     value, -1);
 }

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 struct tdesc_feature *
 tdesc_create_feature (struct target_desc *tdesc, const char *name,
@@ -1696,7 +1696,7 @@ set_tdesc_property (struct target_desc *target_desc,
   target_desc->properties.emplace_back (key, value);
 }

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 void
 set_tdesc_architecture (struct target_desc *target_desc,
@@ -1712,7 +1712,7 @@ set_tdesc_architecture (struct target_desc *target_desc,
   target_desc->arch = arch;
 }

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 void
 set_tdesc_osabi (struct target_desc *target_desc, const char *name)
@@ -2077,7 +2077,7 @@ public:
     printf_unfiltered ("  Original: %s */\n\n",
 		       lbasename (m_filename_after_features.c_str ()));

-    printf_unfiltered ("#include \"arch/tdesc.h\"\n");
+    printf_unfiltered ("#include \"common/tdesc.h\"\n");
     printf_unfiltered ("\n");
   }

Comments

Philipp Rudo Feb. 21, 2018, 12:27 p.m. UTC | #1
Hi Alan,


On Tue, 20 Feb 2018 11:56:18 +0000
Alan Hayward <Alan.Hayward@arm.com> wrote:

[...]

> Ok, after pushing the patch to add a common directory, I’ve updated this
> patch. Now we have the common dir, we can simply move arch/tdesc.h to
> common/tdesc.h
> 
> Tested by build for x86, ppc and aarch64, using both make 4.1 and make 3.81.
> Ran unittests for x86. Checked that my later patch series can apply on top.

The patch looks good to me.  Build tested on s390 with --enable-targets=all
and make 4.0.

Thanks for doing this
Philipp

> 
> 2018-02-20  Alan Hayward  <alan.hayward@arm.com>
> 
> gdb/
> 	* arch/amd64.h: Use common/tdesc.h.
> 	* arch/i386.c: Likewise.
> 	* arch/i386.h: Likewise.
> 	* arch/tic6x.c: Likewise.
> 	* arch/tdesc.h: Move file from here...
> 	* common/tdesc.h: ...to here.
> 	* features/aarch64-core.c: Regenerate.
> 	* features/aarch64-fpu.c: Regenerate.
> 	* features/i386/32bit-avx.c: Regenerate.
> 	* features/i386/32bit-avx512.c: Regenerate.
> 	* features/i386/32bit-core.c: Regenerate.
> 	* features/i386/32bit-linux.c: Regenerate.
> 	* features/i386/32bit-mpx.c: Regenerate.
> 	* features/i386/32bit-pkeys.c: Regenerate.
> 	* features/i386/32bit-sse.c: Regenerate.
> 	* features/i386/64bit-avx.c: Regenerate.
> 	* features/i386/64bit-avx512.c: Regenerate.
> 	* features/i386/64bit-core.c: Regenerate.
> 	* features/i386/64bit-linux.c: Regenerate.
> 	* features/i386/64bit-mpx.c: Regenerate.
> 	* features/i386/64bit-pkeys.c: Regenerate.
> 	* features/i386/64bit-segments.c: Regenerate.
> 	* features/i386/64bit-sse.c: Regenerate.
> 	* features/i386/x32-core.c: Regenerate.
> 	* features/tic6x-c6xp.c: Regenerate.
> 	* features/tic6x-core.c: Regenerate.
> 	* features/tic6x-gp.c: Regenerate.
> 	* target-descriptions.c: Use common/tdesc.h.
> 	* target-descriptions.h: Likewise.
> 
> gdbserver/
> 	* tdesc.c: Use common/tdesc.h.
> 	* tdesc.h: Likewise.
> 
> ---
>  gdb/arch/amd64.h                   |  2 +-
>  gdb/arch/i386.c                    |  2 +-
>  gdb/arch/i386.h                    |  2 +-
>  gdb/arch/tic6x.c                   |  2 +-
>  gdb/{arch => common}/tdesc.h       |  0
>  gdb/features/aarch64-core.c        |  2 +-
>  gdb/features/aarch64-fpu.c         |  2 +-
>  gdb/features/i386/32bit-avx.c      |  2 +-
>  gdb/features/i386/32bit-avx512.c   |  2 +-
>  gdb/features/i386/32bit-core.c     |  2 +-
>  gdb/features/i386/32bit-linux.c    |  2 +-
>  gdb/features/i386/32bit-mpx.c      |  2 +-
>  gdb/features/i386/32bit-pkeys.c    |  2 +-
>  gdb/features/i386/32bit-sse.c      |  2 +-
>  gdb/features/i386/64bit-avx.c      |  2 +-
>  gdb/features/i386/64bit-avx512.c   |  2 +-
>  gdb/features/i386/64bit-core.c     |  2 +-
>  gdb/features/i386/64bit-linux.c    |  2 +-
>  gdb/features/i386/64bit-mpx.c      |  2 +-
>  gdb/features/i386/64bit-pkeys.c    |  2 +-
>  gdb/features/i386/64bit-segments.c |  2 +-
>  gdb/features/i386/64bit-sse.c      |  2 +-
>  gdb/features/i386/x32-core.c       |  2 +-
>  gdb/features/tic6x-c6xp.c          |  2 +-
>  gdb/features/tic6x-core.c          |  2 +-
>  gdb/features/tic6x-gp.c            |  2 +-
>  gdb/gdbserver/tdesc.c              | 24 ++++++++++++------------
>  gdb/gdbserver/tdesc.h              |  2 +-
>  gdb/target-descriptions.c          | 28 ++++++++++++++--------------
>  gdb/target-descriptions.h          |  2 +-
>  30 files changed, 53 insertions(+), 53 deletions(-)
>  rename gdb/{arch => common}/tdesc.h (100%)
> 
> 
> diff --git a/gdb/arch/amd64.h b/gdb/arch/amd64.h
> index b50051f698f91c72cec104b63654e59f02f9e62a..c0c4dc27efe62ca834d00e9f77066bd6338a49bd 100644
> --- a/gdb/arch/amd64.h
> +++ b/gdb/arch/amd64.h
> @@ -15,7 +15,7 @@
>     You should have received a copy of the GNU General Public License
>     along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
> 
> -#include "tdesc.h"
> +#include "common/tdesc.h"
>  #include <stdint.h>
> 
>  target_desc *amd64_create_target_description (uint64_t xcr0, bool is_x32,
> diff --git a/gdb/arch/i386.h b/gdb/arch/i386.h
> index ffc34e39138e8faab4b5911eb8dd328164916fe3..8f3fe3ba4200e3667187a0bd5a3956418eec1d8c 100644
> --- a/gdb/arch/i386.h
> +++ b/gdb/arch/i386.h
> @@ -15,7 +15,7 @@
>     You should have received a copy of the GNU General Public License
>     along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
> 
> -#include "tdesc.h"
> +#include "common/tdesc.h"
>  #include <stdint.h>
> 
>  target_desc *i386_create_target_description (uint64_t xcr0, bool is_linux);
> diff --git a/gdb/arch/i386.c b/gdb/arch/i386.c
> index d3e1eb90e0f578cd3978620b2f1eda37229f728b..2b7c178984fa608b7ba6f90060e1382f3c43e548 100644
> --- a/gdb/arch/i386.c
> +++ b/gdb/arch/i386.c
> @@ -16,7 +16,7 @@
>     along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
> 
>  #include "i386.h"
> -#include "tdesc.h"
> +#include "common/tdesc.h"
>  #include "x86-xstate.h"
>  #include <stdlib.h>
> 
> diff --git a/gdb/arch/tdesc.h b/gdb/common/tdesc.h
> similarity index 100%
> rename from gdb/arch/tdesc.h
> rename to gdb/common/tdesc.h
> diff --git a/gdb/arch/tic6x.c b/gdb/arch/tic6x.c
> index 9fc36cd4ca4cb89be1e7c909ee14a51ebb6d6b4a..6b57baa3241ae6cef2656f7727aa54115e9f9aa2 100644
> --- a/gdb/arch/tic6x.c
> +++ b/gdb/arch/tic6x.c
> @@ -15,7 +15,7 @@
>     You should have received a copy of the GNU General Public License
>     along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
> 
> -#include "tdesc.h"
> +#include "common/tdesc.h"
>  #include "tic6x.h"
>  #include "common/common-defs.h"
> 
> diff --git a/gdb/features/aarch64-core.c b/gdb/features/aarch64-core.c
> index 3707b7e05560507328077684215218ccbad63fee..db10c4aa068d9fa1fb089f15dfc0fc3827a3a286 100644
> --- a/gdb/features/aarch64-core.c
> +++ b/gdb/features/aarch64-core.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: aarch64-core.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_aarch64_core (struct target_desc *result, long regnum)
> diff --git a/gdb/features/aarch64-fpu.c b/gdb/features/aarch64-fpu.c
> index cac3981f7dd918e051826272eb69da8e7ac5269a..0c40c4cef22e42be5ee27bf205ee60f5dbbdbf0f 100644
> --- a/gdb/features/aarch64-fpu.c
> +++ b/gdb/features/aarch64-fpu.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: aarch64-fpu.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_aarch64_fpu (struct target_desc *result, long regnum)
> diff --git a/gdb/features/i386/32bit-avx.c b/gdb/features/i386/32bit-avx.c
> index 8a0c35655d9a9efa19ea04053b05b0e6ba0035e8..6e2cfdbdcbcc024fc81db522842e8377cb2d50c5 100644
> --- a/gdb/features/i386/32bit-avx.c
> +++ b/gdb/features/i386/32bit-avx.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: 32bit-avx.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_i386_32bit_avx (struct target_desc *result, long regnum)
> diff --git a/gdb/features/i386/32bit-avx512.c b/gdb/features/i386/32bit-avx512.c
> index 39c7e9771a94d06f05ebb72cb108ef1e569cbaa7..863c119ac40d25270729ae849b4bbb53977b4e15 100644
> --- a/gdb/features/i386/32bit-avx512.c
> +++ b/gdb/features/i386/32bit-avx512.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: 32bit-avx512.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_i386_32bit_avx512 (struct target_desc *result, long regnum)
> diff --git a/gdb/features/i386/32bit-core.c b/gdb/features/i386/32bit-core.c
> index 294e86d81eecbd488adb45e29644290ce5fd313e..f6de737074202f37e57861ca3f1609d1e9ecc86a 100644
> --- a/gdb/features/i386/32bit-core.c
> +++ b/gdb/features/i386/32bit-core.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: 32bit-core.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_i386_32bit_core (struct target_desc *result, long regnum)
> diff --git a/gdb/features/i386/32bit-linux.c b/gdb/features/i386/32bit-linux.c
> index 136e3d71b41a6e5af7f115fb94937a659a48185a..af476da194e2cb0c4a88030f6480917130323de0 100644
> --- a/gdb/features/i386/32bit-linux.c
> +++ b/gdb/features/i386/32bit-linux.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: 32bit-linux.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_i386_32bit_linux (struct target_desc *result, long regnum)
> diff --git a/gdb/features/i386/32bit-mpx.c b/gdb/features/i386/32bit-mpx.c
> index 8f1be3a60f03243bd5decde1fcb4ba3a94773159..84101746b50e3a55ea6e76a9c1b6549a75de402f 100644
> --- a/gdb/features/i386/32bit-mpx.c
> +++ b/gdb/features/i386/32bit-mpx.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: 32bit-mpx.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_i386_32bit_mpx (struct target_desc *result, long regnum)
> diff --git a/gdb/features/i386/32bit-pkeys.c b/gdb/features/i386/32bit-pkeys.c
> index 4ad7649915f21a0f62c9162a2fc425907c692ea4..272751f5781e81373e090d18e8bd133529d3570e 100644
> --- a/gdb/features/i386/32bit-pkeys.c
> +++ b/gdb/features/i386/32bit-pkeys.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: 32bit-pkeys.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_i386_32bit_pkeys (struct target_desc *result, long regnum)
> diff --git a/gdb/features/i386/32bit-sse.c b/gdb/features/i386/32bit-sse.c
> index cf48960353881519789986fd7f1c46b8802d9a11..78fc02b863c7d1107d8360c4a4707a8df2ea4642 100644
> --- a/gdb/features/i386/32bit-sse.c
> +++ b/gdb/features/i386/32bit-sse.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: 32bit-sse.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_i386_32bit_sse (struct target_desc *result, long regnum)
> diff --git a/gdb/features/i386/64bit-avx.c b/gdb/features/i386/64bit-avx.c
> index d8e391423bc2f52fe491972d20aabea4ea26f21a..5f11035af3f208b0a0bdfee36802e4cc7b29ccf9 100644
> --- a/gdb/features/i386/64bit-avx.c
> +++ b/gdb/features/i386/64bit-avx.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: 64bit-avx.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_i386_64bit_avx (struct target_desc *result, long regnum)
> diff --git a/gdb/features/i386/64bit-avx512.c b/gdb/features/i386/64bit-avx512.c
> index e103e43464c7337f6556fb6035d953a3881f3e98..733910025bab29345124e4c006136ffa19e98339 100644
> --- a/gdb/features/i386/64bit-avx512.c
> +++ b/gdb/features/i386/64bit-avx512.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: 64bit-avx512.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_i386_64bit_avx512 (struct target_desc *result, long regnum)
> diff --git a/gdb/features/i386/64bit-core.c b/gdb/features/i386/64bit-core.c
> index 9e39ee42d9a31d68efbf838c47ae43b12a797e3f..efc7016380851ab21686cd7920b57666313a1bab 100644
> --- a/gdb/features/i386/64bit-core.c
> +++ b/gdb/features/i386/64bit-core.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: 64bit-core.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_i386_64bit_core (struct target_desc *result, long regnum)
> diff --git a/gdb/features/i386/64bit-linux.c b/gdb/features/i386/64bit-linux.c
> index 570910b9cc0f6ebf88f83dd4e73e54a38cf11636..c9c56f193cf7bee14b3c1b2b4733cb037196c5c6 100644
> --- a/gdb/features/i386/64bit-linux.c
> +++ b/gdb/features/i386/64bit-linux.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: 64bit-linux.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_i386_64bit_linux (struct target_desc *result, long regnum)
> diff --git a/gdb/features/i386/64bit-mpx.c b/gdb/features/i386/64bit-mpx.c
> index 725e76a0dd99cc79e1ac10dd62cd4bcca3cf682d..d923813d699d331c8669e1f4493706bb0851b4ba 100644
> --- a/gdb/features/i386/64bit-mpx.c
> +++ b/gdb/features/i386/64bit-mpx.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: 64bit-mpx.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_i386_64bit_mpx (struct target_desc *result, long regnum)
> diff --git a/gdb/features/i386/64bit-pkeys.c b/gdb/features/i386/64bit-pkeys.c
> index 9d974c3772d93b44d5ae92ccc0752d6be9c21f4d..f1cbce0ce7fbf4af2a285dae9cbb1db2c569c3a5 100644
> --- a/gdb/features/i386/64bit-pkeys.c
> +++ b/gdb/features/i386/64bit-pkeys.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: 64bit-pkeys.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_i386_64bit_pkeys (struct target_desc *result, long regnum)
> diff --git a/gdb/features/i386/64bit-segments.c b/gdb/features/i386/64bit-segments.c
> index 7a1fbf53f35eb0106c2c3c4c32b1f7f0aa276b6a..900471fc48c9361d6c453c92c1bc67a93409941d 100644
> --- a/gdb/features/i386/64bit-segments.c
> +++ b/gdb/features/i386/64bit-segments.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: 64bit-segments.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_i386_64bit_segments (struct target_desc *result, long regnum)
> diff --git a/gdb/features/i386/64bit-sse.c b/gdb/features/i386/64bit-sse.c
> index 2859217f45860d52c76650fa5ad17eb9611ab8c8..294360197f588ddfc595e18d6386a53f108b60e6 100644
> --- a/gdb/features/i386/64bit-sse.c
> +++ b/gdb/features/i386/64bit-sse.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: 64bit-sse.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_i386_64bit_sse (struct target_desc *result, long regnum)
> diff --git a/gdb/features/i386/x32-core.c b/gdb/features/i386/x32-core.c
> index c268e11bea9e81563fe586299ccea4bde9c7497f..9b0bcc5a7ef0df5835a1a95dbd9a50688cf8cd79 100644
> --- a/gdb/features/i386/x32-core.c
> +++ b/gdb/features/i386/x32-core.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: x32-core.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_i386_x32_core (struct target_desc *result, long regnum)
> diff --git a/gdb/features/tic6x-c6xp.c b/gdb/features/tic6x-c6xp.c
> index 5b0f566ee4c5687c1a8de4e08ab2828ba5242505..261a562d903b7c1a203cd9a66f2f5fca8ac8bec7 100644
> --- a/gdb/features/tic6x-c6xp.c
> +++ b/gdb/features/tic6x-c6xp.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: tic6x-c6xp.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_tic6x_c6xp (struct target_desc *result, long regnum)
> diff --git a/gdb/features/tic6x-core.c b/gdb/features/tic6x-core.c
> index 823d4c1da107786b5a983afb04a2fa88b69d3684..65f73ec97df8fef36a265e0a0c2891dc6aedb2aa 100644
> --- a/gdb/features/tic6x-core.c
> +++ b/gdb/features/tic6x-core.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: tic6x-core.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_tic6x_core (struct target_desc *result, long regnum)
> diff --git a/gdb/features/tic6x-gp.c b/gdb/features/tic6x-gp.c
> index df0d0e37fc2c085e8bddedff2ab00cf26ddb2c73..b62458837947247405564d055925acd424c6be03 100644
> --- a/gdb/features/tic6x-gp.c
> +++ b/gdb/features/tic6x-gp.c
> @@ -1,7 +1,7 @@
>  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
>    Original: tic6x-gp.xml */
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  static int
>  create_feature_tic6x_gp (struct target_desc *result, long regnum)
> diff --git a/gdb/gdbserver/tdesc.h b/gdb/gdbserver/tdesc.h
> index 783500598b5599e51f8e768a876fdfe499cdf0ef..d21574ca73e5042d560adad0e3839e89ee2c67ab 100644
> --- a/gdb/gdbserver/tdesc.h
> +++ b/gdb/gdbserver/tdesc.h
> @@ -19,7 +19,7 @@
>  #ifndef TDESC_H
>  #define TDESC_H
> 
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  #include "regdef.h"
>  #include <vector>
> diff --git a/gdb/gdbserver/tdesc.c b/gdb/gdbserver/tdesc.c
> index c39b5e7d27e879c5d3fb49b6e04d1eb6128f8eef..00a5e8dc4d6fe3c0809194c04902f96056622c82 100644
> --- a/gdb/gdbserver/tdesc.c
> +++ b/gdb/gdbserver/tdesc.c
> @@ -66,7 +66,7 @@ current_target_desc (void)
>    return current_process ()->tdesc;
>  }
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  void
>  set_tdesc_architecture (struct target_desc *target_desc,
> @@ -75,7 +75,7 @@ set_tdesc_architecture (struct target_desc *target_desc,
>    target_desc->arch = xstrdup (name);
>  }
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  void
>  set_tdesc_osabi (struct target_desc *target_desc, const char *name)
> @@ -132,7 +132,7 @@ tdesc_get_features_xml (target_desc *tdesc)
>  struct tdesc_type
>  {};
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  struct tdesc_feature *
>  tdesc_create_feature (struct target_desc *tdesc, const char *name,
> @@ -144,7 +144,7 @@ tdesc_create_feature (struct target_desc *tdesc, const char *name,
>    return tdesc;
>  }
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  tdesc_type_with_fields *
>  tdesc_create_flags (struct tdesc_feature *feature, const char *name,
> @@ -153,14 +153,14 @@ tdesc_create_flags (struct tdesc_feature *feature, const char *name,
>    return NULL;
>  }
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  void
>  tdesc_add_flag (tdesc_type_with_fields *type, int start,
>  		const char *flag_name)
>  {}
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  struct tdesc_type *
>  tdesc_named_type (const struct tdesc_feature *feature, const char *id)
> @@ -168,7 +168,7 @@ tdesc_named_type (const struct tdesc_feature *feature, const char *id)
>    return NULL;
>  }
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  tdesc_type_with_fields *
>  tdesc_create_union (struct tdesc_feature *feature, const char *id)
> @@ -176,7 +176,7 @@ tdesc_create_union (struct tdesc_feature *feature, const char *id)
>    return NULL;
>  }
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  tdesc_type_with_fields *
>  tdesc_create_struct (struct tdesc_feature *feature, const char *id)
> @@ -184,7 +184,7 @@ tdesc_create_struct (struct tdesc_feature *feature, const char *id)
>    return NULL;
>  }
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  void
>  tdesc_create_reg (struct tdesc_feature *feature, const char *name,
> @@ -212,7 +212,7 @@ tdesc_create_reg (struct tdesc_feature *feature, const char *name,
>    tdesc->reg_defs.push_back (reg);
>  }
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  struct tdesc_type *
>  tdesc_create_vector (struct tdesc_feature *feature, const char *name,
> @@ -226,14 +226,14 @@ tdesc_add_bitfield (tdesc_type_with_fields *type, const char *field_name,
>  		    int start, int end)
>  {}
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  void
>  tdesc_add_field (tdesc_type_with_fields *type, const char *field_name,
>  		 struct tdesc_type *field_type)
>  {}
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  void
>  tdesc_set_struct_size (tdesc_type_with_fields *type, int size)
> diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h
> index 759fd34a0fe31f84a8531c799e5a3556e768c604..fa554fddf62fc6fb9e658c4a318f2fce213615c1 100644
> --- a/gdb/target-descriptions.h
> +++ b/gdb/target-descriptions.h
> @@ -21,7 +21,7 @@
> 
>  #ifndef TARGET_DESCRIPTIONS_H
>  #define TARGET_DESCRIPTIONS_H 1
> -#include "arch/tdesc.h"
> +#include "common/tdesc.h"
> 
>  struct tdesc_arch_data;
>  struct target_ops;
> diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
> index ce4cf76899cccb1c009bc556aeb6a74f0913edbe..5d34e29a867f8d39cd0451eb48cbf39614c9acba 100644
> --- a/gdb/target-descriptions.c
> +++ b/gdb/target-descriptions.c
> @@ -1025,7 +1025,7 @@ tdesc_predefined_type (enum tdesc_type_kind kind)
>    gdb_assert_not_reached ("bad predefined tdesc type");
>  }
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  struct tdesc_type *
>  tdesc_named_type (const struct tdesc_feature *feature, const char *id)
> @@ -1476,7 +1476,7 @@ tdesc_use_registers (struct gdbarch *gdbarch,
>  }
> 
> 
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  void
>  tdesc_create_reg (struct tdesc_feature *feature, const char *name,
> @@ -1489,7 +1489,7 @@ tdesc_create_reg (struct tdesc_feature *feature, const char *name,
>    feature->registers.emplace_back (reg);
>  }
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  struct tdesc_type *
>  tdesc_create_vector (struct tdesc_feature *feature, const char *name,
> @@ -1501,7 +1501,7 @@ tdesc_create_vector (struct tdesc_feature *feature, const char *name,
>    return type;
>  }
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  tdesc_type_with_fields *
>  tdesc_create_struct (struct tdesc_feature *feature, const char *name)
> @@ -1513,7 +1513,7 @@ tdesc_create_struct (struct tdesc_feature *feature, const char *name)
>    return type;
>  }
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  void
>  tdesc_set_struct_size (tdesc_type_with_fields *type, int size)
> @@ -1523,7 +1523,7 @@ tdesc_set_struct_size (tdesc_type_with_fields *type, int size)
>    type->size = size;
>  }
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  tdesc_type_with_fields *
>  tdesc_create_union (struct tdesc_feature *feature, const char *name)
> @@ -1535,7 +1535,7 @@ tdesc_create_union (struct tdesc_feature *feature, const char *name)
>    return type;
>  }
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  tdesc_type_with_fields *
>  tdesc_create_flags (struct tdesc_feature *feature, const char *name,
> @@ -1563,7 +1563,7 @@ tdesc_create_enum (struct tdesc_feature *feature, const char *name,
>    return type;
>  }
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  void
>  tdesc_add_field (tdesc_type_with_fields *type, const char *field_name,
> @@ -1588,7 +1588,7 @@ tdesc_add_typed_bitfield (tdesc_type_with_fields *type, const char *field_name,
>    type->fields.emplace_back (field_name, field_type, start, end);
>  }
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  void
>  tdesc_add_bitfield (tdesc_type_with_fields *type, const char *field_name,
> @@ -1606,7 +1606,7 @@ tdesc_add_bitfield (tdesc_type_with_fields *type, const char *field_name,
>    tdesc_add_typed_bitfield (type, field_name, start, end, field_type);
>  }
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  void
>  tdesc_add_flag (tdesc_type_with_fields *type, int start,
> @@ -1630,7 +1630,7 @@ tdesc_add_enum_value (tdesc_type_with_fields *type, int value,
>  			     value, -1);
>  }
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  struct tdesc_feature *
>  tdesc_create_feature (struct target_desc *tdesc, const char *name,
> @@ -1696,7 +1696,7 @@ set_tdesc_property (struct target_desc *target_desc,
>    target_desc->properties.emplace_back (key, value);
>  }
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  void
>  set_tdesc_architecture (struct target_desc *target_desc,
> @@ -1712,7 +1712,7 @@ set_tdesc_architecture (struct target_desc *target_desc,
>    target_desc->arch = arch;
>  }
> 
> -/* See arch/tdesc.h.  */
> +/* See common/tdesc.h.  */
> 
>  void
>  set_tdesc_osabi (struct target_desc *target_desc, const char *name)
> @@ -2077,7 +2077,7 @@ public:
>      printf_unfiltered ("  Original: %s */\n\n",
>  		       lbasename (m_filename_after_features.c_str ()));
> 
> -    printf_unfiltered ("#include \"arch/tdesc.h\"\n");
> +    printf_unfiltered ("#include \"common/tdesc.h\"\n");
>      printf_unfiltered ("\n");
>    }
>
Yao Qi Feb. 22, 2018, 2:17 p.m. UTC | #2
Alan Hayward <Alan.Hayward@arm.com> writes:

Hi Alan,
Patch is good to me.

> Tested by build for x86, ppc and aarch64, using both make 4.1 and make 3.81.
> Ran unittests for x86. Checked that my later patch series can apply on top.
>
> 2018-02-20  Alan Hayward  <alan.hayward@arm.com>
>
> gdb/
> 	* arch/amd64.h: Use common/tdesc.h.
> 	* arch/i386.c: Likewise.
> 	* arch/i386.h: Likewise.
> 	* arch/tic6x.c: Likewise.
> 	* arch/tdesc.h: Move file from here...
> 	* common/tdesc.h: ...to here.
> 	* features/aarch64-core.c: Regenerate.
> 	* features/aarch64-fpu.c: Regenerate.
> 	* features/i386/32bit-avx.c: Regenerate.
> 	* features/i386/32bit-avx512.c: Regenerate.
> 	* features/i386/32bit-core.c: Regenerate.
> 	* features/i386/32bit-linux.c: Regenerate.
> 	* features/i386/32bit-mpx.c: Regenerate.
> 	* features/i386/32bit-pkeys.c: Regenerate.
> 	* features/i386/32bit-sse.c: Regenerate.
> 	* features/i386/64bit-avx.c: Regenerate.
> 	* features/i386/64bit-avx512.c: Regenerate.
> 	* features/i386/64bit-core.c: Regenerate.
> 	* features/i386/64bit-linux.c: Regenerate.
> 	* features/i386/64bit-mpx.c: Regenerate.
> 	* features/i386/64bit-pkeys.c: Regenerate.
> 	* features/i386/64bit-segments.c: Regenerate.
> 	* features/i386/64bit-sse.c: Regenerate.
> 	* features/i386/x32-core.c: Regenerate.
> 	* features/tic6x-c6xp.c: Regenerate.
> 	* features/tic6x-core.c: Regenerate.
> 	* features/tic6x-gp.c: Regenerate.
> 	* target-descriptions.c: Use common/tdesc.h.
> 	* target-descriptions.h: Likewise.
>
> gdbserver/
> 	* tdesc.c: Use common/tdesc.h.
> 	* tdesc.h: Likewise.
Yao Qi Feb. 27, 2018, 12:13 p.m. UTC | #3
Alan Hayward <Alan.Hayward@arm.com> writes:

> Tested by build for x86, ppc and aarch64, using both make 4.1 and make 3.81.
> Ran unittests for x86. Checked that my later patch series can apply on top.

Looks this patch breaks the GDBserver build on aarch64-linux,

g++ -x c++ -std=gnu++11 -g -O2    -I. -I../../../binutils-gdb/gdb/gdbserver -I../../../binutils-gdb/gdb/gdbserver/../common -I../../../binutils-gdb/gdb/gdbserver/../regformats -I../../../binutils-gdb/gdb/gdbserver/.. -I../../../binutils-gdb/gdb/gdbserver/../../include -I../../../binutils-gdb/gdb/gdbserver/../gnulib/import -Ibuild-gnulib-gdbserver/import  -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized -Wformat-nonliteral -Werror -DGDBSERVER -c -o arch/aarch64.o -MT arch/aarch64.o -MMD -MP -MF arch/.deps/aarch64.Tpo ../../../binutils-gdb/gdb/gdbserver/../arch/aarch64.c
In file included from ../../../binutils-gdb/gdb/gdbserver/../arch/aarch64.h:23:0,
                 from ../../../binutils-gdb/gdb/gdbserver/../arch/aarch64.c:19:
../../../binutils-gdb/gdb/gdbserver/tdesc.h:57:8: error: ‘char_ptr’ has not been declared
   VEC (char_ptr) *features = NULL;
        ^
../../../binutils-gdb/gdb/gdbserver/tdesc.h:57:16: error: ISO C++ forbids declaration of ‘VEC’ with no type [-fpermissive]
   VEC (char_ptr) *features = NULL;
                ^
../../../binutils-gdb/gdb/gdbserver/tdesc.h:57:16: error: expected ‘;’ at end of member declaration
../../../binutils-gdb/gdb/gdbserver/tdesc.h: In destructor ‘target_desc::~target_desc()’:
../../../binutils-gdb/gdb/gdbserver/tdesc.h:82:30: error: ‘char_ptr’ was not declared in this scope
     for (i = 0; VEC_iterate (char_ptr, features, i, f); i++)
                              ^
../../../binutils-gdb/gdb/gdbserver/tdesc.h:82:54: error: ‘VEC_iterate’ was not declared in this scope
     for (i = 0; VEC_iterate (char_ptr, features, i, f); i++)
                                                      ^
../../../binutils-gdb/gdb/gdbserver/tdesc.h:84:15: error: ‘char_ptr’ was not declared in this scope
     VEC_free (char_ptr, features);
               ^
../../../binutils-gdb/gdb/gdbserver/tdesc.h:84:33: error: ‘VEC_free’ was not declared in this scope
     VEC_free (char_ptr, features);
                                 ^
make[4]: *** [arch/aarch64.o] Error 1
diff mbox

Patch

diff --git a/gdb/arch/amd64.h b/gdb/arch/amd64.h
index b50051f698f91c72cec104b63654e59f02f9e62a..c0c4dc27efe62ca834d00e9f77066bd6338a49bd 100644
--- a/gdb/arch/amd64.h
+++ b/gdb/arch/amd64.h
@@ -15,7 +15,7 @@ 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

-#include "tdesc.h"
+#include "common/tdesc.h"
 #include <stdint.h>

 target_desc *amd64_create_target_description (uint64_t xcr0, bool is_x32,
diff --git a/gdb/arch/i386.h b/gdb/arch/i386.h
index ffc34e39138e8faab4b5911eb8dd328164916fe3..8f3fe3ba4200e3667187a0bd5a3956418eec1d8c 100644
--- a/gdb/arch/i386.h
+++ b/gdb/arch/i386.h
@@ -15,7 +15,7 @@ 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

-#include "tdesc.h"
+#include "common/tdesc.h"
 #include <stdint.h>

 target_desc *i386_create_target_description (uint64_t xcr0, bool is_linux);
diff --git a/gdb/arch/i386.c b/gdb/arch/i386.c
index d3e1eb90e0f578cd3978620b2f1eda37229f728b..2b7c178984fa608b7ba6f90060e1382f3c43e548 100644
--- a/gdb/arch/i386.c
+++ b/gdb/arch/i386.c
@@ -16,7 +16,7 @@ 
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

 #include "i386.h"
-#include "tdesc.h"
+#include "common/tdesc.h"
 #include "x86-xstate.h"
 #include <stdlib.h>

diff --git a/gdb/arch/tdesc.h b/gdb/common/tdesc.h
similarity index 100%
rename from gdb/arch/tdesc.h
rename to gdb/common/tdesc.h
diff --git a/gdb/arch/tic6x.c b/gdb/arch/tic6x.c
index 9fc36cd4ca4cb89be1e7c909ee14a51ebb6d6b4a..6b57baa3241ae6cef2656f7727aa54115e9f9aa2 100644
--- a/gdb/arch/tic6x.c
+++ b/gdb/arch/tic6x.c
@@ -15,7 +15,7 @@ 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

-#include "tdesc.h"
+#include "common/tdesc.h"
 #include "tic6x.h"
 #include "common/common-defs.h"

diff --git a/gdb/features/aarch64-core.c b/gdb/features/aarch64-core.c
index 3707b7e05560507328077684215218ccbad63fee..db10c4aa068d9fa1fb089f15dfc0fc3827a3a286 100644
--- a/gdb/features/aarch64-core.c
+++ b/gdb/features/aarch64-core.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: aarch64-core.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_aarch64_core (struct target_desc *result, long regnum)
diff --git a/gdb/features/aarch64-fpu.c b/gdb/features/aarch64-fpu.c
index cac3981f7dd918e051826272eb69da8e7ac5269a..0c40c4cef22e42be5ee27bf205ee60f5dbbdbf0f 100644
--- a/gdb/features/aarch64-fpu.c
+++ b/gdb/features/aarch64-fpu.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: aarch64-fpu.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_aarch64_fpu (struct target_desc *result, long regnum)
diff --git a/gdb/features/i386/32bit-avx.c b/gdb/features/i386/32bit-avx.c
index 8a0c35655d9a9efa19ea04053b05b0e6ba0035e8..6e2cfdbdcbcc024fc81db522842e8377cb2d50c5 100644
--- a/gdb/features/i386/32bit-avx.c
+++ b/gdb/features/i386/32bit-avx.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: 32bit-avx.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_i386_32bit_avx (struct target_desc *result, long regnum)
diff --git a/gdb/features/i386/32bit-avx512.c b/gdb/features/i386/32bit-avx512.c
index 39c7e9771a94d06f05ebb72cb108ef1e569cbaa7..863c119ac40d25270729ae849b4bbb53977b4e15 100644
--- a/gdb/features/i386/32bit-avx512.c
+++ b/gdb/features/i386/32bit-avx512.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: 32bit-avx512.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_i386_32bit_avx512 (struct target_desc *result, long regnum)
diff --git a/gdb/features/i386/32bit-core.c b/gdb/features/i386/32bit-core.c
index 294e86d81eecbd488adb45e29644290ce5fd313e..f6de737074202f37e57861ca3f1609d1e9ecc86a 100644
--- a/gdb/features/i386/32bit-core.c
+++ b/gdb/features/i386/32bit-core.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: 32bit-core.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_i386_32bit_core (struct target_desc *result, long regnum)
diff --git a/gdb/features/i386/32bit-linux.c b/gdb/features/i386/32bit-linux.c
index 136e3d71b41a6e5af7f115fb94937a659a48185a..af476da194e2cb0c4a88030f6480917130323de0 100644
--- a/gdb/features/i386/32bit-linux.c
+++ b/gdb/features/i386/32bit-linux.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: 32bit-linux.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_i386_32bit_linux (struct target_desc *result, long regnum)
diff --git a/gdb/features/i386/32bit-mpx.c b/gdb/features/i386/32bit-mpx.c
index 8f1be3a60f03243bd5decde1fcb4ba3a94773159..84101746b50e3a55ea6e76a9c1b6549a75de402f 100644
--- a/gdb/features/i386/32bit-mpx.c
+++ b/gdb/features/i386/32bit-mpx.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: 32bit-mpx.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_i386_32bit_mpx (struct target_desc *result, long regnum)
diff --git a/gdb/features/i386/32bit-pkeys.c b/gdb/features/i386/32bit-pkeys.c
index 4ad7649915f21a0f62c9162a2fc425907c692ea4..272751f5781e81373e090d18e8bd133529d3570e 100644
--- a/gdb/features/i386/32bit-pkeys.c
+++ b/gdb/features/i386/32bit-pkeys.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: 32bit-pkeys.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_i386_32bit_pkeys (struct target_desc *result, long regnum)
diff --git a/gdb/features/i386/32bit-sse.c b/gdb/features/i386/32bit-sse.c
index cf48960353881519789986fd7f1c46b8802d9a11..78fc02b863c7d1107d8360c4a4707a8df2ea4642 100644
--- a/gdb/features/i386/32bit-sse.c
+++ b/gdb/features/i386/32bit-sse.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: 32bit-sse.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_i386_32bit_sse (struct target_desc *result, long regnum)
diff --git a/gdb/features/i386/64bit-avx.c b/gdb/features/i386/64bit-avx.c
index d8e391423bc2f52fe491972d20aabea4ea26f21a..5f11035af3f208b0a0bdfee36802e4cc7b29ccf9 100644
--- a/gdb/features/i386/64bit-avx.c
+++ b/gdb/features/i386/64bit-avx.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: 64bit-avx.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_i386_64bit_avx (struct target_desc *result, long regnum)
diff --git a/gdb/features/i386/64bit-avx512.c b/gdb/features/i386/64bit-avx512.c
index e103e43464c7337f6556fb6035d953a3881f3e98..733910025bab29345124e4c006136ffa19e98339 100644
--- a/gdb/features/i386/64bit-avx512.c
+++ b/gdb/features/i386/64bit-avx512.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: 64bit-avx512.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_i386_64bit_avx512 (struct target_desc *result, long regnum)
diff --git a/gdb/features/i386/64bit-core.c b/gdb/features/i386/64bit-core.c
index 9e39ee42d9a31d68efbf838c47ae43b12a797e3f..efc7016380851ab21686cd7920b57666313a1bab 100644
--- a/gdb/features/i386/64bit-core.c
+++ b/gdb/features/i386/64bit-core.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: 64bit-core.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_i386_64bit_core (struct target_desc *result, long regnum)
diff --git a/gdb/features/i386/64bit-linux.c b/gdb/features/i386/64bit-linux.c
index 570910b9cc0f6ebf88f83dd4e73e54a38cf11636..c9c56f193cf7bee14b3c1b2b4733cb037196c5c6 100644
--- a/gdb/features/i386/64bit-linux.c
+++ b/gdb/features/i386/64bit-linux.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: 64bit-linux.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_i386_64bit_linux (struct target_desc *result, long regnum)
diff --git a/gdb/features/i386/64bit-mpx.c b/gdb/features/i386/64bit-mpx.c
index 725e76a0dd99cc79e1ac10dd62cd4bcca3cf682d..d923813d699d331c8669e1f4493706bb0851b4ba 100644
--- a/gdb/features/i386/64bit-mpx.c
+++ b/gdb/features/i386/64bit-mpx.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: 64bit-mpx.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_i386_64bit_mpx (struct target_desc *result, long regnum)
diff --git a/gdb/features/i386/64bit-pkeys.c b/gdb/features/i386/64bit-pkeys.c
index 9d974c3772d93b44d5ae92ccc0752d6be9c21f4d..f1cbce0ce7fbf4af2a285dae9cbb1db2c569c3a5 100644
--- a/gdb/features/i386/64bit-pkeys.c
+++ b/gdb/features/i386/64bit-pkeys.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: 64bit-pkeys.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_i386_64bit_pkeys (struct target_desc *result, long regnum)
diff --git a/gdb/features/i386/64bit-segments.c b/gdb/features/i386/64bit-segments.c
index 7a1fbf53f35eb0106c2c3c4c32b1f7f0aa276b6a..900471fc48c9361d6c453c92c1bc67a93409941d 100644
--- a/gdb/features/i386/64bit-segments.c
+++ b/gdb/features/i386/64bit-segments.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: 64bit-segments.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_i386_64bit_segments (struct target_desc *result, long regnum)
diff --git a/gdb/features/i386/64bit-sse.c b/gdb/features/i386/64bit-sse.c
index 2859217f45860d52c76650fa5ad17eb9611ab8c8..294360197f588ddfc595e18d6386a53f108b60e6 100644
--- a/gdb/features/i386/64bit-sse.c
+++ b/gdb/features/i386/64bit-sse.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: 64bit-sse.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_i386_64bit_sse (struct target_desc *result, long regnum)
diff --git a/gdb/features/i386/x32-core.c b/gdb/features/i386/x32-core.c
index c268e11bea9e81563fe586299ccea4bde9c7497f..9b0bcc5a7ef0df5835a1a95dbd9a50688cf8cd79 100644
--- a/gdb/features/i386/x32-core.c
+++ b/gdb/features/i386/x32-core.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: x32-core.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_i386_x32_core (struct target_desc *result, long regnum)
diff --git a/gdb/features/tic6x-c6xp.c b/gdb/features/tic6x-c6xp.c
index 5b0f566ee4c5687c1a8de4e08ab2828ba5242505..261a562d903b7c1a203cd9a66f2f5fca8ac8bec7 100644
--- a/gdb/features/tic6x-c6xp.c
+++ b/gdb/features/tic6x-c6xp.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: tic6x-c6xp.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_tic6x_c6xp (struct target_desc *result, long regnum)
diff --git a/gdb/features/tic6x-core.c b/gdb/features/tic6x-core.c
index 823d4c1da107786b5a983afb04a2fa88b69d3684..65f73ec97df8fef36a265e0a0c2891dc6aedb2aa 100644
--- a/gdb/features/tic6x-core.c
+++ b/gdb/features/tic6x-core.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: tic6x-core.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_tic6x_core (struct target_desc *result, long regnum)
diff --git a/gdb/features/tic6x-gp.c b/gdb/features/tic6x-gp.c
index df0d0e37fc2c085e8bddedff2ab00cf26ddb2c73..b62458837947247405564d055925acd424c6be03 100644
--- a/gdb/features/tic6x-gp.c
+++ b/gdb/features/tic6x-gp.c
@@ -1,7 +1,7 @@ 
 /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
   Original: tic6x-gp.xml */

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 static int
 create_feature_tic6x_gp (struct target_desc *result, long regnum)
diff --git a/gdb/gdbserver/tdesc.h b/gdb/gdbserver/tdesc.h
index 783500598b5599e51f8e768a876fdfe499cdf0ef..d21574ca73e5042d560adad0e3839e89ee2c67ab 100644
--- a/gdb/gdbserver/tdesc.h
+++ b/gdb/gdbserver/tdesc.h
@@ -19,7 +19,7 @@ 
 #ifndef TDESC_H
 #define TDESC_H

-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 #include "regdef.h"
 #include <vector>
diff --git a/gdb/gdbserver/tdesc.c b/gdb/gdbserver/tdesc.c
index c39b5e7d27e879c5d3fb49b6e04d1eb6128f8eef..00a5e8dc4d6fe3c0809194c04902f96056622c82 100644
--- a/gdb/gdbserver/tdesc.c
+++ b/gdb/gdbserver/tdesc.c
@@ -66,7 +66,7 @@  current_target_desc (void)
   return current_process ()->tdesc;
 }

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 void
 set_tdesc_architecture (struct target_desc *target_desc,
@@ -75,7 +75,7 @@  set_tdesc_architecture (struct target_desc *target_desc,
   target_desc->arch = xstrdup (name);
 }

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 void
 set_tdesc_osabi (struct target_desc *target_desc, const char *name)
@@ -132,7 +132,7 @@  tdesc_get_features_xml (target_desc *tdesc)
 struct tdesc_type
 {};

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 struct tdesc_feature *
 tdesc_create_feature (struct target_desc *tdesc, const char *name,
@@ -144,7 +144,7 @@  tdesc_create_feature (struct target_desc *tdesc, const char *name,
   return tdesc;
 }

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 tdesc_type_with_fields *
 tdesc_create_flags (struct tdesc_feature *feature, const char *name,
@@ -153,14 +153,14 @@  tdesc_create_flags (struct tdesc_feature *feature, const char *name,
   return NULL;
 }

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 void
 tdesc_add_flag (tdesc_type_with_fields *type, int start,
 		const char *flag_name)
 {}

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 struct tdesc_type *
 tdesc_named_type (const struct tdesc_feature *feature, const char *id)
@@ -168,7 +168,7 @@  tdesc_named_type (const struct tdesc_feature *feature, const char *id)
   return NULL;
 }

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 tdesc_type_with_fields *
 tdesc_create_union (struct tdesc_feature *feature, const char *id)
@@ -176,7 +176,7 @@  tdesc_create_union (struct tdesc_feature *feature, const char *id)
   return NULL;
 }

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 tdesc_type_with_fields *
 tdesc_create_struct (struct tdesc_feature *feature, const char *id)
@@ -184,7 +184,7 @@  tdesc_create_struct (struct tdesc_feature *feature, const char *id)
   return NULL;
 }

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 void
 tdesc_create_reg (struct tdesc_feature *feature, const char *name,
@@ -212,7 +212,7 @@  tdesc_create_reg (struct tdesc_feature *feature, const char *name,
   tdesc->reg_defs.push_back (reg);
 }

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 struct tdesc_type *
 tdesc_create_vector (struct tdesc_feature *feature, const char *name,
@@ -226,14 +226,14 @@  tdesc_add_bitfield (tdesc_type_with_fields *type, const char *field_name,
 		    int start, int end)
 {}

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 void
 tdesc_add_field (tdesc_type_with_fields *type, const char *field_name,
 		 struct tdesc_type *field_type)
 {}

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 void
 tdesc_set_struct_size (tdesc_type_with_fields *type, int size)
diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h
index 759fd34a0fe31f84a8531c799e5a3556e768c604..fa554fddf62fc6fb9e658c4a318f2fce213615c1 100644
--- a/gdb/target-descriptions.h
+++ b/gdb/target-descriptions.h
@@ -21,7 +21,7 @@ 

 #ifndef TARGET_DESCRIPTIONS_H
 #define TARGET_DESCRIPTIONS_H 1
-#include "arch/tdesc.h"
+#include "common/tdesc.h"

 struct tdesc_arch_data;
 struct target_ops;
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index ce4cf76899cccb1c009bc556aeb6a74f0913edbe..5d34e29a867f8d39cd0451eb48cbf39614c9acba 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -1025,7 +1025,7 @@  tdesc_predefined_type (enum tdesc_type_kind kind)
   gdb_assert_not_reached ("bad predefined tdesc type");
 }

-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 struct tdesc_type *
 tdesc_named_type (const struct tdesc_feature *feature, const char *id)
@@ -1476,7 +1476,7 @@  tdesc_use_registers (struct gdbarch *gdbarch,
 }



-/* See arch/tdesc.h.  */
+/* See common/tdesc.h.  */

 void