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

Message ID 97948063-b3db-fd3a-f62e-b552935cb8dd@arm.com
State New, archived
Headers

Commit Message

Alan Hayward Jan. 31, 2018, 1:40 p.m. UTC
  Following on from review comments for:
[PATCH v2 5/8] Use tdesc types in gdbserver tdesc

This patch simply moves arch/tdesc.h to common/tdesc.h.
The arch/ directory is for port specific code.
tdesc.h is not port specific, and is common to both
gdb and gdbserver.

Updated all the references to the file, including those
generated from xml.

I am adding this because my xml patch series will add a
common-tdesc.c file.

This patch contains no functional changes.

Tested by building for x86, ppc and aarch64. Ran unittests
for x86. Checked that my later patch series can apply on top.


2018-01-31  Alan Hayward  <alan.hayward@arm.com>

gdb/
	* arch/aarch64.h: Use common-tdesc.h.
	* arch/amd64.h: Likewise.
	* arch/i386.c: Likewise.
	* arch/i386.h: Likewise.
	* arch/tic6x.c: Likewise.
	* arch/tdesc.h: Move file from here...
	* common/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.h: Use common-tdesc.h.
	* tdesc.h: Likewise.

---
 gdb/arch/aarch64.h                          |  2 +-
 gdb/arch/amd64.h                            |  2 +-
 gdb/arch/i386.c                             |  2 +-
 gdb/arch/i386.h                             |  2 +-
 gdb/arch/tic6x.c                            |  2 +-
 gdb/{arch/tdesc.h => common/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 +-
 31 files changed, 54 insertions(+), 54 deletions(-)
 rename gdb/{arch/tdesc.h => common/common-tdesc.h} (100%)
  

Comments

Philipp Rudo Feb. 1, 2018, 11:14 a.m. UTC | #1
Hi Alan,

the patch looks good to me.

If it were for me, I would drop the extra 'common-' and call the file
just common/tdesc.h ...

On Wed, 31 Jan 2018 13:40:04 +0000
Alan Hayward <alan.hayward@arm.com> wrote:

> Following on from review comments for:
> [PATCH v2 5/8] Use tdesc types in gdbserver tdesc
> 
> This patch simply moves arch/tdesc.h to common/tdesc.h.

... like stated here. But that's just my taste.  When looking at the git log in
common/ I don't see any clear pattern for the current best practice in naming
the files.

Thanks
Philipp

> The arch/ directory is for port specific code.
> tdesc.h is not port specific, and is common to both
> gdb and gdbserver.
> 
> Updated all the references to the file, including those
> generated from xml.
> 
> I am adding this because my xml patch series will add a
> common-tdesc.c file.
> 
> This patch contains no functional changes.
> 
> Tested by building for x86, ppc and aarch64. Ran unittests
> for x86. Checked that my later patch series can apply on top.
> 
> 
> 2018-01-31  Alan Hayward  <alan.hayward@arm.com>
> 
> gdb/
> 	* arch/aarch64.h: Use common-tdesc.h.
> 	* arch/amd64.h: Likewise.
> 	* arch/i386.c: Likewise.
> 	* arch/i386.h: Likewise.
> 	* arch/tic6x.c: Likewise.
> 	* arch/tdesc.h: Move file from here...
> 	* common/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.h: Use common-tdesc.h.
> 	* tdesc.h: Likewise.
> 
> ---
>  gdb/arch/aarch64.h                          |  2 +-
>  gdb/arch/amd64.h                            |  2 +-
>  gdb/arch/i386.c                             |  2 +-
>  gdb/arch/i386.h                             |  2 +-
>  gdb/arch/tic6x.c                            |  2 +-
>  gdb/{arch/tdesc.h => common/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 +-
>  31 files changed, 54 insertions(+), 54 deletions(-)
>  rename gdb/{arch/tdesc.h => common/common-tdesc.h} (100%)
> 
> diff --git a/gdb/arch/aarch64.h b/gdb/arch/aarch64.h
> index 1ca83114f6..418a46f628 100644
> --- a/gdb/arch/aarch64.h
> +++ b/gdb/arch/aarch64.h
> @@ -20,7 +20,7 @@
>  #ifndef ARCH_AARCH64_H
>  #define ARCH_AARCH64_H
> 
> -#include "tdesc.h"
> +#include "common-tdesc.h"
> 
>  target_desc *aarch64_create_target_description ();
> 
> diff --git a/gdb/arch/amd64.h b/gdb/arch/amd64.h
> index b50051f698..17c044f425 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.c b/gdb/arch/i386.c
> index d3e1eb90e0..d60196fc54 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/i386.h b/gdb/arch/i386.h
> index ffc34e3913..ba283c2bc2 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/tic6x.c b/gdb/arch/tic6x.c
> index 9fc36cd4ca..da3a656f78 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/arch/tdesc.h b/gdb/common/common-tdesc.h
> similarity index 100%
> rename from gdb/arch/tdesc.h
> rename to gdb/common/common-tdesc.h
> diff --git a/gdb/features/aarch64-core.c b/gdb/features/aarch64-core.c
> index 3707b7e055..b89f94b1ff 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 cac3981f7d..0d1449ce5b 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 8a0c35655d..37bfd922ad 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 39c7e9771a..d4c1983845 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 294e86d81e..7909340537 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 136e3d71b4..d3e18024e9 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 8f1be3a60f..4c16713c9a 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 4ad7649915..76d38b9a1c 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 cf48960353..e52baf8a5c 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 d8e391423b..0cc8a4e16e 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 e103e43464..e281144a6a 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 9e39ee42d9..e2f197fcce 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 570910b9cc..4304476779 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 725e76a0dd..602c21bddf 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 9d974c3772..444239f106 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 7a1fbf53f3..28c4307066 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 2859217f45..8b661ecfb6 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 c268e11bea..aca0317e26 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 5b0f566ee4..5d745844a4 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 823d4c1da1..9e5e3a021f 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 df0d0e37fc..86efffa561 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.c b/gdb/gdbserver/tdesc.c
> index c39b5e7d27..29e13d7216 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/gdbserver/tdesc.h b/gdb/gdbserver/tdesc.h
> index 783500598b..28ffdc597e 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/target-descriptions.c b/gdb/target-descriptions.c
> index 1b20a12d76..6302c15563 100644
> --- a/gdb/target-descriptions.c
> +++ b/gdb/target-descriptions.c
> @@ -991,7 +991,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)
> @@ -1442,7 +1442,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,
> @@ -1455,7 +1455,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,
> @@ -1467,7 +1467,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)
> @@ -1479,7 +1479,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)
> @@ -1489,7 +1489,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)
> @@ -1501,7 +1501,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,
> @@ -1529,7 +1529,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,
> @@ -1554,7 +1554,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,
> @@ -1572,7 +1572,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,
> @@ -1596,7 +1596,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,
> @@ -1662,7 +1662,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,
> @@ -1678,7 +1678,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)
> @@ -2043,7 +2043,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");
>    }
> 
> diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h
> index 759fd34a0f..ec8d39a819 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;
  
Alan Hayward Feb. 1, 2018, 1:19 p.m. UTC | #2
> On 1 Feb 2018, at 11:14, Philipp Rudo <prudo@linux.vnet.ibm.com> wrote:

> 

> Hi Alan,

> 

> the patch looks good to me.

> 

> If it were for me, I would drop the extra 'common-' and call the file

> just common/tdesc.h …

> 

> On Wed, 31 Jan 2018 13:40:04 +0000

> Alan Hayward <alan.hayward@arm.com> wrote:

> 

>> Following on from review comments for:

>> [PATCH v2 5/8] Use tdesc types in gdbserver tdesc

>> 

>> This patch simply moves arch/tdesc.h to common/tdesc.h.

> 

> ... like stated here. But that's just my taste.  When looking at the git log in

> common/ I don't see any clear pattern for the current best practice in naming

> the files.

> 


That results in common/tdesc.h and gdbserver/tdesc.h
That’s not a problem by itself, because we can just prefix the dir
name as part of the include.

My next set of patches will then add common/tdesc.c.
This is slightly more tricky because we now build two tdesc.o files.
The gdbserver IPA rules will need tweaking, and I’m not sure the OBS
list will work as it is (given it doesn’t have any dir names).

Like you, I wasn’t sure if there was a naming convention for common/.
In the end I went with the easiest solution :)

Thanks for reviewing!


Alan.
  
Philipp Rudo Feb. 1, 2018, 1:36 p.m. UTC | #3
On Thu, 1 Feb 2018 13:19:47 +0000
Alan Hayward <Alan.Hayward@arm.com> wrote:

> > On 1 Feb 2018, at 11:14, Philipp Rudo <prudo@linux.vnet.ibm.com> wrote:
> > 
> > Hi Alan,
> > 
> > the patch looks good to me.
> > 
> > If it were for me, I would drop the extra 'common-' and call the file
> > just common/tdesc.h …
> > 
> > On Wed, 31 Jan 2018 13:40:04 +0000
> > Alan Hayward <alan.hayward@arm.com> wrote:
> >   
> >> Following on from review comments for:
> >> [PATCH v2 5/8] Use tdesc types in gdbserver tdesc
> >> 
> >> This patch simply moves arch/tdesc.h to common/tdesc.h.  
> > 
> > ... like stated here. But that's just my taste.  When looking at the git log in
> > common/ I don't see any clear pattern for the current best practice in naming
> > the files.
> >   
> 
> That results in common/tdesc.h and gdbserver/tdesc.h
> That’s not a problem by itself, because we can just prefix the dir
> name as part of the include.
> 
> My next set of patches will then add common/tdesc.c.
> This is slightly more tricky because we now build two tdesc.o files.
> The gdbserver IPA rules will need tweaking, and I’m not sure the OBS
> list will work as it is (given it doesn’t have any dir names).

Argh, i didn't thought about this.  You are right the OBS list looks like the
perfect source for trouble...

> Like you, I wasn’t sure if there was a naming convention for common/.
> In the end I went with the easiest solution :)

Well in this case the easiest solution also is the best :)

Thanks for working on this
Philipp
 
> Thanks for reviewing!
> 
> 
> Alan.
>
  
Yao Qi Feb. 6, 2018, 4:28 p.m. UTC | #4
Alan Hayward <Alan.Hayward@arm.com> writes:

> That results in common/tdesc.h and gdbserver/tdesc.h
> That’s not a problem by itself, because we can just prefix the dir
> name as part of the include.
>

I don't see how does the name of *.c file affect the name of *.h file.
We can still use common/tdesc.h no matter what the *.c name is.

> My next set of patches will then add common/tdesc.c.
> This is slightly more tricky because we now build two tdesc.o files.

I am inclined to create common/ directory in gdb and gdbserver build
tree, and put the object files in the right directory.

> The gdbserver IPA rules will need tweaking, and I’m not sure the OBS
> list will work as it is (given it doesn’t have any dir names).
>
> Like you, I wasn’t sure if there was a naming convention for common/.
> In the end I went with the easiest solution :)
  
Philipp Rudo Feb. 6, 2018, 5:56 p.m. UTC | #5
Hi Yao,

On Tue, 06 Feb 2018 16:28:15 +0000
Yao Qi <qiyaoltc@gmail.com> wrote:

> Alan Hayward <Alan.Hayward@arm.com> writes:
> 
> > That results in common/tdesc.h and gdbserver/tdesc.h
> > That’s not a problem by itself, because we can just prefix the dir
> > name as part of the include.
> >  
> 
> I don't see how does the name of *.c file affect the name of *.h file.
> We can still use common/tdesc.h no matter what the *.c name is.

Of course you could name the *.h file anything you want.  But from my point of
view the *.c and *.h files belonging together should have the same name.
Having this in mind you cannot call it common/tdesc.h because in
gdbserver/Makefile:OBS the directory is ignored and both (common/tdesc.c and
gdbserver/tdec.c) would be compiled to tdesc.o, (most likely) leading to
unintended behavior.
 
> > My next set of patches will then add common/tdesc.c.
> > This is slightly more tricky because we now build two tdesc.o files.  
> 
> I am inclined to create common/ directory in gdb and gdbserver build
> tree, and put the object files in the right directory.

Yao, what do you mean with this?  There already is a common/ directory with
code shared by gdb and gdbserver.  The thing is that tdesc.h was in arch/ not
in common/. Alan, Omair (if I recall right) and I agreed that it would be
better to move it to common/ because arch/ should only contain architecture
specific code.  Or am I understanding you wrong?

Philipp

> > The gdbserver IPA rules will need tweaking, and I’m not sure the OBS
> > list will work as it is (given it doesn’t have any dir names).
> >
> > Like you, I wasn’t sure if there was a naming convention for common/.
> > In the end I went with the easiest solution :)  
>
  
Yao Qi Feb. 6, 2018, 9:24 p.m. UTC | #6
On Tue, Feb 6, 2018 at 5:56 PM, Philipp Rudo <prudo@linux.vnet.ibm.com> wrote:
> Of course you could name the *.h file anything you want.  But from my point of
> view the *.c and *.h files belonging together should have the same name.
> Having this in mind you cannot call it common/tdesc.h because in
> gdbserver/Makefile:OBS the directory is ignored and both (common/tdesc.c and
> gdbserver/tdec.c) would be compiled to tdesc.o, (most likely) leading to
> unintended behavior.

What I want is to compile gdbserver/tdesc.c to tdesc.o, common/tdesc.c to
common/tdesc.o in gdbserver build directory.

>
>> > My next set of patches will then add common/tdesc.c.
>> > This is slightly more tricky because we now build two tdesc.o files.
>>
>> I am inclined to create common/ directory in gdb and gdbserver build
>> tree, and put the object files in the right directory.
>
> Yao, what do you mean with this?  There already is a common/ directory with
> code shared by gdb and gdbserver.  The thing is that tdesc.h was in arch/ not
> in common/. Alan, Omair (if I recall right) and I agreed that it would be
> better to move it to common/ because arch/ should only contain architecture
> specific code.  Or am I understanding you wrong?
>

It is build tree, instead of source tree.  What I want is to have common/ in gdb
and gdbserver build directory respectively.  I am not against moving
arch/tdesc.h
to common/tdesc.h.
  
Philipp Rudo Feb. 7, 2018, 9:02 a.m. UTC | #7
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.

Philipp

On Tue, 6 Feb 2018 21:24:35 +0000
Yao Qi <qiyaoltc@gmail.com> wrote:

> On Tue, Feb 6, 2018 at 5:56 PM, Philipp Rudo <prudo@linux.vnet.ibm.com> wrote:
> > Of course you could name the *.h file anything you want.  But from my point of
> > view the *.c and *.h files belonging together should have the same name.
> > Having this in mind you cannot call it common/tdesc.h because in
> > gdbserver/Makefile:OBS the directory is ignored and both (common/tdesc.c and
> > gdbserver/tdec.c) would be compiled to tdesc.o, (most likely) leading to
> > unintended behavior.  
> 
> What I want is to compile gdbserver/tdesc.c to tdesc.o, common/tdesc.c to
> common/tdesc.o in gdbserver build directory.
> 
> >  
> >> > My next set of patches will then add common/tdesc.c.
> >> > This is slightly more tricky because we now build two tdesc.o files.  
> >>
> >> I am inclined to create common/ directory in gdb and gdbserver build
> >> tree, and put the object files in the right directory.  
> >
> > Yao, what do you mean with this?  There already is a common/ directory with
> > code shared by gdb and gdbserver.  The thing is that tdesc.h was in arch/ not
> > in common/. Alan, Omair (if I recall right) and I agreed that it would be
> > better to move it to common/ because arch/ should only contain architecture
> > specific code.  Or am I understanding you wrong?
> >  
> 
> It is build tree, instead of source tree.  What I want is to have common/ in gdb
> and gdbserver build directory respectively.  I am not against moving
> arch/tdesc.h
> to common/tdesc.h.
>
  
Yao Qi Feb. 7, 2018, 9:32 a.m. UTC | #8
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.
  
Alan Hayward Feb. 7, 2018, 10:31 a.m. UTC | #9
> 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.
  

Patch

diff --git a/gdb/arch/aarch64.h b/gdb/arch/aarch64.h
index 1ca83114f6..418a46f628 100644
--- a/gdb/arch/aarch64.h
+++ b/gdb/arch/aarch64.h
@@ -20,7 +20,7 @@ 
 #ifndef ARCH_AARCH64_H
 #define ARCH_AARCH64_H
 
-#include "tdesc.h"
+#include "common-tdesc.h"
 
 target_desc *aarch64_create_target_description ();
 
diff --git a/gdb/arch/amd64.h b/gdb/arch/amd64.h
index b50051f698..17c044f425 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.c b/gdb/arch/i386.c
index d3e1eb90e0..d60196fc54 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/i386.h b/gdb/arch/i386.h
index ffc34e3913..ba283c2bc2 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/tic6x.c b/gdb/arch/tic6x.c
index 9fc36cd4ca..da3a656f78 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/arch/tdesc.h b/gdb/common/common-tdesc.h
similarity index 100%
rename from gdb/arch/tdesc.h
rename to gdb/common/common-tdesc.h
diff --git a/gdb/features/aarch64-core.c b/gdb/features/aarch64-core.c
index 3707b7e055..b89f94b1ff 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 cac3981f7d..0d1449ce5b 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 8a0c35655d..37bfd922ad 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 39c7e9771a..d4c1983845 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 294e86d81e..7909340537 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 136e3d71b4..d3e18024e9 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 8f1be3a60f..4c16713c9a 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 4ad7649915..76d38b9a1c 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 cf48960353..e52baf8a5c 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 d8e391423b..0cc8a4e16e 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 e103e43464..e281144a6a 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 9e39ee42d9..e2f197fcce 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 570910b9cc..4304476779 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 725e76a0dd..602c21bddf 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 9d974c3772..444239f106 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 7a1fbf53f3..28c4307066 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 2859217f45..8b661ecfb6 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 c268e11bea..aca0317e26 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 5b0f566ee4..5d745844a4 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 823d4c1da1..9e5e3a021f 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 df0d0e37fc..86efffa561 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.c b/gdb/gdbserver/tdesc.c
index c39b5e7d27..29e13d7216 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/gdbserver/tdesc.h b/gdb/gdbserver/tdesc.h
index 783500598b..28ffdc597e 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/target-descriptions.c b/gdb/target-descriptions.c
index 1b20a12d76..6302c15563 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -991,7 +991,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)
@@ -1442,7 +1442,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,
@@ -1455,7 +1455,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,
@@ -1467,7 +1467,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)
@@ -1479,7 +1479,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)
@@ -1489,7 +1489,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)
@@ -1501,7 +1501,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,
@@ -1529,7 +1529,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,
@@ -1554,7 +1554,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,
@@ -1572,7 +1572,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,
@@ -1596,7 +1596,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,
@@ -1662,7 +1662,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,
@@ -1678,7 +1678,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)
@@ -2043,7 +2043,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");
   }
 
diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h
index 759fd34a0f..ec8d39a819 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;