[v2,0/6] Move gdbsupport to top level

Message ID 878smeexqf.fsf@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey Jan. 11, 2020, 4:58 p.m. UTC
  >>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:

Tom> Here is an update of the series to move gdbsupport to the top level.
Tom> This is one step in the bigger projecct to move gdbserver to top
Tom> level.

I see that patches #2 and #3 did not come through.
I think they ran into the size limit.

Here is patch 2.  I'll send patch 3 separately.
Using "git show" makes patch 2 smaller, but I'm also going to edit out
the generated files from both patches.

Tom

commit f68357acdbb40bdd712dc09c3d87b2de2e18aedf
Author: Tom Tromey <tom@tromey.com>
Date:   Tue Jul 9 08:06:39 2019 -0600

    Move gdbsupport to the top level
    
    This patch moves the gdbsupport directory to the top level.  This is
    the next step in the ongoing project to move gdbserver to the top
    level.
    
    The bulk of this patch was created by "git mv gdb/gdbsupport gdbsupport".
    
    This patch then adds a build system to gdbsupport and wires it into
    the top level.  Then it changes gdb to use the top-level build.
    
    gdbserver, on the other hand, is not yet changed.  It still does its
    own build of gdbsupport.
    
    ChangeLog
    2020-01-08  Tom Tromey  <tom@tromey.com>
    
            * src-release.sh (GDB_SUPPORT_DIRS): Add gdbsupport.
            * MAINTAINERS: Add gdbsupport.
            * configure: Rebuild.
            * configure.ac (configdirs): Add gdbsupport.
            * gdbsupport: New directory, move from gdb/gdbsupport.
            * Makefile.def (host_modules, dependencies): Add gnulib.
            * Makefile.in: Rebuild.
    
    gdb/ChangeLog
    2020-01-08  Tom Tromey  <tom@tromey.com>
    
            * nat/x86-linux-dregs.c: Include configh.h.
            * nat/linux-ptrace.c: Include configh.h.
            * nat/linux-btrace.c: Include configh.h.
            * defs.h: Include config.h, bfd.h.
            * configure.ac: Don't source common.host.
            (CONFIG_OBS, CONFIG_SRCS): Remove gdbsupport files.
            * configure: Rebuild.
            * acinclude.m4: Update path.
            * Makefile.in (SUPPORT, LIBSUPPORT, INCSUPPORT): New variables.
            (CONFIG_SRC_SUBDIR): Remove gdbsupport.
            (INTERNAL_CFLAGS_BASE): Add INCSUPPORT.
            (CLIBS): Add LIBSUPPORT.
            (CDEPS): Likewise.
            (COMMON_SFILES): Remove gdbsupport files.
            (HFILES_NO_SRCDIR): Likewise.
            (stamp-version): Update path to create-version.sh.
            (ALLDEPFILES): Remove gdbsupport files.
    
    gdb/gdbserver/ChangeLog
    2020-01-08  Tom Tromey  <tom@tromey.com>
    
            * server.h: Include config.h.
            * gdbreplay.c: Include config.h.
            * configure: Rebuild.
            * configure.ac: Don't source common.host.
            * acinclude.m4: Update path.
            * Makefile.in (INCSUPPORT): New variable.
            (INCLUDE_CFLAGS): Add INCSUPPORT.
            (SFILES): Update paths.
            (version-generated.c): Update path to create-version.sh.
            (gdbsupport/%-ipa.o, gdbsupport/%.o): Update paths.
    
    gdbsupport/ChangeLog
    2020-01-08  Tom Tromey  <tom@tromey.com>
    
            * common-defs.h: Add GDBSERVER case.  Update includes.
            * acinclude.m4, aclocal.m4, config.in, configure, configure.ac,
            Makefile.am, Makefile.in, README: New files.
            * Moved from ../gdb/gdbsupport/
    
    Change-Id: I07632e7798635c1bab389bf885971e584fb4bb78
  

Comments

Simon Marchi Jan. 12, 2020, 2:19 a.m. UTC | #1
On 2020-01-11 11:58 a.m., Tom Tromey wrote:
>>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:
> 
> Tom> Here is an update of the series to move gdbsupport to the top level.
> Tom> This is one step in the bigger projecct to move gdbserver to top
> Tom> level.
> 
> I see that patches #2 and #3 did not come through.
> I think they ran into the size limit.
> 
> Here is patch 2.  I'll send patch 3 separately.
> Using "git show" makes patch 2 smaller, but I'm also going to edit out
> the generated files from both patches.

The indentation in common.m4 looks off, starting with:

  AC_CACHE_CHECK([for sigsetjmp], gdb_cv_func_sigsetjmp

Starting from this line until the end, I think it should be indented by
two columns.  It's already wrong today, but what you added also has wrong
indentation, making it hard to understand that it's all under `GDB_AC_COMMON`.
Could you fix that?  I don't really mind if it's a patch before or after this
series.

I see that GDB_AC_PTRACE is called in all three configure.ac files.  Should it
be put in GDB_AC_COMMON?

Other than that, the series LGTM.

Simon
  
Tom Tromey Jan. 14, 2020, 11:16 p.m. UTC | #2
>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

Simon> The indentation in common.m4 looks off, starting with:
Simon>   AC_CACHE_CHECK([for sigsetjmp], gdb_cv_func_sigsetjmp

Simon> Starting from this line until the end, I think it should be indented by
Simon> two columns.  It's already wrong today, but what you added also has wrong
Simon> indentation, making it hard to understand that it's all under `GDB_AC_COMMON`.
Simon> Could you fix that?  I don't really mind if it's a patch before or after this
Simon> series.

I will send and check in a patch for that shortly.

Simon> I see that GDB_AC_PTRACE is called in all three configure.ac files.  Should it
Simon> be put in GDB_AC_COMMON?

We don't have a good way to include ptrace.m4 from common.m4.  Maybe the
call could be moved there but the user still has to know to include
ptrace.m4 somewhere.

Tom
  
Tom Tromey Jan. 14, 2020, 11:24 p.m. UTC | #3
>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

Simon> Other than that, the series LGTM.

I've rebased it and I am going to check it in soon.

You will probably need to do a clean rebuild.

I'll clean up the next patch in the larger move-gdbserver series soon.

Tom
  
Terekhov, Mikhail via Gdb-patches Jan. 15, 2020, 9:08 p.m. UTC | #4
On Sat, Jan 11, 2020 at 11:58 AM Tom Tromey <tom@tromey.com> wrote:
>
> >>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:
>
> Tom> Here is an update of the series to move gdbsupport to the top level.
> Tom> This is one step in the bigger projecct to move gdbserver to top
> Tom> level.
>
> I see that patches #2 and #3 did not come through.
> I think they ran into the size limit.
>
> Here is patch 2.  I'll send patch 3 separately.
> Using "git show" makes patch 2 smaller, but I'm also going to edit out
> the generated files from both patches.

Since these files were moved anyway, this might be a good opportunity
to rename .c -> .cpp in gdbsupport? (Similar for when gdbserver will
be moved)

Christian

>
> Tom
>
> commit f68357acdbb40bdd712dc09c3d87b2de2e18aedf
> Author: Tom Tromey <tom@tromey.com>
> Date:   Tue Jul 9 08:06:39 2019 -0600
>
>     Move gdbsupport to the top level
>
>     This patch moves the gdbsupport directory to the top level.  This is
>     the next step in the ongoing project to move gdbserver to the top
>     level.
>
>     The bulk of this patch was created by "git mv gdb/gdbsupport gdbsupport".
>
>     This patch then adds a build system to gdbsupport and wires it into
>     the top level.  Then it changes gdb to use the top-level build.
>
>     gdbserver, on the other hand, is not yet changed.  It still does its
>     own build of gdbsupport.
>
>     ChangeLog
>     2020-01-08  Tom Tromey  <tom@tromey.com>
>
>             * src-release.sh (GDB_SUPPORT_DIRS): Add gdbsupport.
>             * MAINTAINERS: Add gdbsupport.
>             * configure: Rebuild.
>             * configure.ac (configdirs): Add gdbsupport.
>             * gdbsupport: New directory, move from gdb/gdbsupport.
>             * Makefile.def (host_modules, dependencies): Add gnulib.
>             * Makefile.in: Rebuild.
>
>     gdb/ChangeLog
>     2020-01-08  Tom Tromey  <tom@tromey.com>
>
>             * nat/x86-linux-dregs.c: Include configh.h.
>             * nat/linux-ptrace.c: Include configh.h.
>             * nat/linux-btrace.c: Include configh.h.
>             * defs.h: Include config.h, bfd.h.
>             * configure.ac: Don't source common.host.
>             (CONFIG_OBS, CONFIG_SRCS): Remove gdbsupport files.
>             * configure: Rebuild.
>             * acinclude.m4: Update path.
>             * Makefile.in (SUPPORT, LIBSUPPORT, INCSUPPORT): New variables.
>             (CONFIG_SRC_SUBDIR): Remove gdbsupport.
>             (INTERNAL_CFLAGS_BASE): Add INCSUPPORT.
>             (CLIBS): Add LIBSUPPORT.
>             (CDEPS): Likewise.
>             (COMMON_SFILES): Remove gdbsupport files.
>             (HFILES_NO_SRCDIR): Likewise.
>             (stamp-version): Update path to create-version.sh.
>             (ALLDEPFILES): Remove gdbsupport files.
>
>     gdb/gdbserver/ChangeLog
>     2020-01-08  Tom Tromey  <tom@tromey.com>
>
>             * server.h: Include config.h.
>             * gdbreplay.c: Include config.h.
>             * configure: Rebuild.
>             * configure.ac: Don't source common.host.
>             * acinclude.m4: Update path.
>             * Makefile.in (INCSUPPORT): New variable.
>             (INCLUDE_CFLAGS): Add INCSUPPORT.
>             (SFILES): Update paths.
>             (version-generated.c): Update path to create-version.sh.
>             (gdbsupport/%-ipa.o, gdbsupport/%.o): Update paths.
>
>     gdbsupport/ChangeLog
>     2020-01-08  Tom Tromey  <tom@tromey.com>
>
>             * common-defs.h: Add GDBSERVER case.  Update includes.
>             * acinclude.m4, aclocal.m4, config.in, configure, configure.ac,
>             Makefile.am, Makefile.in, README: New files.
>             * Moved from ../gdb/gdbsupport/
>
>     Change-Id: I07632e7798635c1bab389bf885971e584fb4bb78
>
> diff --git a/ChangeLog b/ChangeLog
> index 00a224473b5..9e3006cf5bf 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,13 @@
> +2020-01-08  Tom Tromey  <tom@tromey.com>
> +
> +       * src-release.sh (GDB_SUPPORT_DIRS): Add gdbsupport.
> +       * MAINTAINERS: Add gdbsupport.
> +       * configure: Rebuild.
> +       * configure.ac (configdirs): Add gdbsupport.
> +       * gdbsupport: New directory, move from gdb/gdbsupport.
> +       * Makefile.def (host_modules, dependencies): Add gnulib.
> +       * Makefile.in: Rebuild.
> +
>  2020-01-09  Aaron Merey  <amerey@redhat.com>
>
>          * config/debuginfod.m4: New file. Add macro AC_DEBUGINFOD. Adds
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 4e04918dad8..805f2e3ac43 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -41,7 +41,7 @@ config.guess; config.sub; readline/support/config.{sub,guess}
>  depcomp; mkinstalldirs
>          Send bug reports and patches to bug-automake@gnu.org.
>
> -gdb/; gnulib/; readline/; sim/; GDB's part of include/
> +gdb/; gdbsupport/; gnulib/; readline/; sim/; GDB's part of include/
>         GDB: http://www.gnu.org/software/gdb/
>         Patches to gdb-patches@sourceware.org.
>         See also gdb/MAINTAINERS and sim/MAINTAINERS.
> diff --git a/Makefile.def b/Makefile.def
> index 311feb9de3b..079fd3e4f16 100644
> --- a/Makefile.def
> +++ b/Makefile.def
> @@ -113,6 +113,7 @@ host_modules= { module= zlib; no_install=true; no_check=true;
>                 bootstrap=true;
>                 extra_configure_flags='@extra_host_zlib_configure_flags@';};
>  host_modules= { module= gnulib; };
> +host_modules= { module= gdbsupport; };
>  host_modules= { module= gdb; };
>  host_modules= { module= expect; };
>  host_modules= { module= guile; };
> @@ -392,12 +393,14 @@ dependencies = { module=configure-gdb; on=all-intl; };
>  dependencies = { module=configure-gdb; on=configure-sim; };
>  dependencies = { module=configure-gdb; on=all-bfd; };
>  dependencies = { module=configure-gdb; on=all-gnulib; };
> +dependencies = { module=configure-gdb; on=all-gdbsupport; };
>  // Depend on all-libiconv so that configure checks for iconv
>  // functions will work.
>  dependencies = { module=configure-gdb; on=all-libiconv; };
>  dependencies = { module=all-gdb; on=all-libiberty; };
>  dependencies = { module=all-gdb; on=all-libiconv; };
>  dependencies = { module=all-gdb; on=all-gnulib; };
> +dependencies = { module=all-gdb; on=all-gdbsupport; };
>  dependencies = { module=all-gdb; on=all-opcodes; };
>  dependencies = { module=all-gdb; on=all-readline; };
>  dependencies = { module=all-gdb; on=all-build-bison; };
> @@ -412,6 +415,10 @@ dependencies = { module=all-libgui; on=all-tcl; };
>  dependencies = { module=all-libgui; on=all-tk; };
>  dependencies = { module=all-libgui; on=all-itcl; };
>
> +dependencies = { module=configure-gdbsupport; on=configure-bfd; };
> +dependencies = { module=configure-gdbsupport; on=configure-gnulib; };
> +dependencies = { module=all-gdbsupport; on=all-gnulib; };
> +
>  // Host modules specific to binutils.
>  dependencies = { module=configure-bfd; on=configure-libiberty; hard=true; };
>  dependencies = { module=configure-bfd; on=configure-intl; };
> diff --git a/configure.ac b/configure.ac
> index 544fab3d209..4bd869a63a9 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -2730,12 +2730,12 @@ esac
>  CONFIGURE_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-configure-/g`
>  INSTALL_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-install-/g`
>
> -# gdb depends on gnulib, but as nothing else does, only include it if
> -# gdb is built.
> +# gdb depends on gnulib and gdbsupport, but as nothing else does, only
> +# include them if gdb is built.
>  if echo " ${configdirs} " | grep " gdb " > /dev/null 2>&1 ; then
> -  # The Makefile provides the ordering, so it's enough here to add
> -  # gnulib to the list.
> -  configdirs="${configdirs} gnulib"
> +  # The Makefile provides the ordering, so it's enough here to add to
> +  # the list.
> +  configdirs="${configdirs} gnulib gdbsupport"
>  fi
>
>  # Strip out unwanted targets.
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index 28f5c21242b..71d41d9f67f 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,3 +1,23 @@
> +2020-01-08  Tom Tromey  <tom@tromey.com>
> +
> +       * nat/x86-linux-dregs.c: Include configh.h.
> +       * nat/linux-ptrace.c: Include configh.h.
> +       * nat/linux-btrace.c: Include configh.h.
> +       * defs.h: Include config.h, bfd.h.
> +       * configure.ac: Don't source common.host.
> +       (CONFIG_OBS, CONFIG_SRCS): Remove gdbsupport files.
> +       * configure: Rebuild.
> +       * acinclude.m4: Update path.
> +       * Makefile.in (SUPPORT, LIBSUPPORT, INCSUPPORT): New variables.
> +       (CONFIG_SRC_SUBDIR): Remove gdbsupport.
> +       (INTERNAL_CFLAGS_BASE): Add INCSUPPORT.
> +       (CLIBS): Add LIBSUPPORT.
> +       (CDEPS): Likewise.
> +       (COMMON_SFILES): Remove gdbsupport files.
> +       (HFILES_NO_SRCDIR): Likewise.
> +       (stamp-version): Update path to create-version.sh.
> +       (ALLDEPFILES): Remove gdbsupport files.
> +
>  2020-01-08  Tom Tromey  <tom@tromey.com>
>
>         * gdbsupport/common.m4 (GDB_AC_COMMON): Define WIN32APILIBS and
> diff --git a/gdb/Makefile.in b/gdb/Makefile.in
> index 6df0f46b5ed..5f63c617d4f 100644
> --- a/gdb/Makefile.in
> +++ b/gdb/Makefile.in
> @@ -238,6 +238,10 @@ GNULIB_BUILDDIR = ../gnulib
>  LIBGNU = $(GNULIB_BUILDDIR)/import/libgnu.a
>  INCGNU = -I$(srcdir)/../gnulib/import -I$(GNULIB_BUILDDIR)/import
>
> +SUPPORT = ../gdbsupport
> +LIBSUPPORT = $(SUPPORT)/libgdbsupport.a
> +INCSUPPORT = -I$(srcdir)/.. -I..
> +
>  #
>  # CLI sub directory definitons
>  #
> @@ -547,7 +551,7 @@ CONFIG_INSTALL = @CONFIG_INSTALL@
>  CONFIG_UNINSTALL = @CONFIG_UNINSTALL@
>  HAVE_NATIVE_GCORE_TARGET = @HAVE_NATIVE_GCORE_TARGET@
>
> -CONFIG_SRC_SUBDIR = arch cli mi gdbsupport compile tui unittests guile python \
> +CONFIG_SRC_SUBDIR = arch cli mi compile tui unittests guile python \
>         target nat
>  CONFIG_DEP_SUBDIR = $(addsuffix /$(DEPDIR),$(CONFIG_SRC_SUBDIR))
>
> @@ -586,8 +590,8 @@ INTERNAL_CFLAGS_BASE = \
>         $(CXXFLAGS) $(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) \
>         $(GDB_CFLAGS) $(OPCODES_CFLAGS) $(READLINE_CFLAGS) $(ZLIBINC) \
>         $(BFD_CFLAGS) $(INCLUDE_CFLAGS) $(LIBDECNUMBER_CFLAGS) \
> -       $(INTL_CFLAGS) $(INCGNU) $(ENABLE_CFLAGS) $(INTERNAL_CPPFLAGS) \
> -       $(SRCHIGH_CFLAGS) $(TOP_CFLAGS) $(PTHREAD_CFLAGS)
> +       $(INTL_CFLAGS) $(INCGNU) $(INCSUPPORT) $(ENABLE_CFLAGS) \
> +       $(INTERNAL_CPPFLAGS) $(SRCHIGH_CFLAGS) $(TOP_CFLAGS) $(PTHREAD_CFLAGS)
>  INTERNAL_WARN_CFLAGS = $(INTERNAL_CFLAGS_BASE) $(GDB_WARN_CFLAGS)
>  INTERNAL_CFLAGS = $(INTERNAL_WARN_CFLAGS) $(GDB_WERROR_CFLAGS)
>
> @@ -607,14 +611,15 @@ INTERNAL_LDFLAGS = \
>  # XM_CLIBS, defined in *config files, have host-dependent libs.
>  # LIBIBERTY appears twice on purpose.
>  CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(LIBCTF) $(ZLIB) \
> -        $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \
> +        $(LIBSUPPORT) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \
>         $(XM_CLIBS) $(GDBTKLIBS) \
>         @LIBS@ @GUILE_LIBS@ @PYTHON_LIBS@ \
>         $(LIBEXPAT) $(LIBLZMA) $(LIBBABELTRACE) $(LIBIPT) \
> -       $(LIBIBERTY) $(WIN32LIBS) $(LIBGNU) $(LIBICONV) $(LIBMPFR) \
> -       $(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS)
> +       $(LIBIBERTY) $(WIN32LIBS) $(LIBGNU) $(LIBICONV) \
> +       $(LIBMPFR) $(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS)
>  CDEPS = $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) $(LIBCTF) \
> -       $(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU)
> +       $(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU) \
> +       $(LIBSUPPORT)
>
>  DIST = gdb
>
> @@ -968,39 +973,6 @@ COMMON_SFILES = \
>         cli-out.c \
>         coff-pe-read.c \
>         coffread.c \
> -       gdbsupport/agent.c \
> -       gdbsupport/btrace-common.c \
> -       gdbsupport/buffer.c \
> -       gdbsupport/cleanups.c \
> -       gdbsupport/common-debug.c \
> -       gdbsupport/common-exceptions.c \
> -       gdbsupport/common-inferior.c \
> -       gdbsupport/common-regcache.c \
> -       gdbsupport/common-utils.c \
> -       gdbsupport/errors.c \
> -       gdbsupport/environ.c \
> -       gdbsupport/fileio.c \
> -       gdbsupport/filestuff.c \
> -       gdbsupport/format.c \
> -       gdbsupport/job-control.c \
> -       gdbsupport/gdb-dlfcn.c \
> -       gdbsupport/gdb_tilde_expand.c \
> -       gdbsupport/gdb_vecs.c \
> -       gdbsupport/gdb_wait.c \
> -       gdbsupport/netstuff.c \
> -       gdbsupport/new-op.c \
> -       gdbsupport/pathstuff.c \
> -       gdbsupport/print-utils.c \
> -       gdbsupport/ptid.c \
> -       gdbsupport/rsp-low.c \
> -       gdbsupport/run-time-clock.c \
> -       gdbsupport/safe-strerror.c \
> -       gdbsupport/scoped_mmap.c \
> -       gdbsupport/signals.c \
> -       gdbsupport/signals-state-save-restore.c \
> -       gdbsupport/tdesc.c \
> -       gdbsupport/thread-pool.c \
> -       gdbsupport/xml-utils.c \
>         complaints.c \
>         completer.c \
>         continuations.c \
> @@ -1468,49 +1440,6 @@ HFILES_NO_SRCDIR = \
>         cli/cli-setshow.h \
>         cli/cli-style.h \
>         cli/cli-utils.h \
> -       gdbsupport/buffer.h \
> -       gdbsupport/cleanups.h \
> -       gdbsupport/common-debug.h \
> -       gdbsupport/common-defs.h \
> -       gdbsupport/common-exceptions.h \
> -       gdbsupport/common-gdbthread.h \
> -       gdbsupport/common-regcache.h \
> -       gdbsupport/common-types.h \
> -       gdbsupport/common-utils.h \
> -       gdbsupport/job-control.h \
> -       gdbsupport/errors.h \
> -       gdbsupport/environ.h \
> -       gdbsupport/fileio.h \
> -       gdbsupport/format.h \
> -       gdbsupport/gdb-dlfcn.h \
> -       gdbsupport/gdb-sigmask.h \
> -       gdbsupport/gdb_assert.h \
> -       gdbsupport/gdb_binary_search.h \
> -       gdbsupport/gdb_tilde_expand.h \
> -       gdbsupport/gdb_locale.h \
> -       gdbsupport/gdb_proc_service.h \
> -       gdbsupport/gdb_setjmp.h \
> -       gdbsupport/gdb_signals.h \
> -       gdbsupport/gdb_sys_time.h \
> -       gdbsupport/gdb_vecs.h \
> -       gdbsupport/gdb_wait.h \
> -       gdbsupport/common-inferior.h \
> -       gdbsupport/netstuff.h \
> -       gdbsupport/host-defs.h \
> -       gdbsupport/parallel-for.h \
> -       gdbsupport/pathstuff.h \
> -       gdbsupport/print-utils.h \
> -       gdbsupport/ptid.h \
> -       gdbsupport/queue.h \
> -       gdbsupport/rsp-low.h \
> -       gdbsupport/run-time-clock.h \
> -       gdbsupport/signals-state-save-restore.h \
> -       gdbsupport/symbol.h \
> -       gdbsupport/tdesc.h \
> -       gdbsupport/thread-pool.h \
> -       gdbsupport/version.h \
> -       gdbsupport/x86-xstate.h \
> -       gdbsupport/xml-utils.h \
>         compile/compile.h \
>         compile/compile-c.h \
>         compile/compile-cplus.h \
> @@ -2131,8 +2060,8 @@ $(srcdir)/copying.c: @MAINTAINER_MODE_TRUE@ $(srcdir)/../COPYING3 $(srcdir)/copy
>  version.c: stamp-version; @true
>  # Note that the obvious names for the temp file are taken by
>  # create-version.sh.
> -stamp-version: Makefile version.in $(srcdir)/../bfd/version.h $(srcdir)/gdbsupport/create-version.sh
> -       $(ECHO_GEN) $(SHELL) $(srcdir)/gdbsupport/create-version.sh $(srcdir) \
> +stamp-version: Makefile version.in $(srcdir)/../bfd/version.h $(srcdir)/../gdbsupport/create-version.sh
> +       $(ECHO_GEN) $(SHELL) $(srcdir)/../gdbsupport/create-version.sh $(srcdir) \
>             $(host_alias) $(target_alias) version-t.t
>         @$(SHELL) $(srcdir)/../move-if-change version-t.t version.c
>         @echo stamp > stamp-version
> diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
> index 11cc0bc2417..d60b2fe19c1 100644
> --- a/gdb/acinclude.m4
> +++ b/gdb/acinclude.m4
> @@ -63,7 +63,7 @@ m4_include([../config/iconv.m4])
>
>  m4_include([../config/zlib.m4])
>
> -m4_include([gdbsupport/common.m4])
> +m4_include([../gdbsupport/common.m4])
>
>  dnl For libiberty_INIT.
>  m4_include(libiberty.m4)
> diff --git a/gdb/configure.ac b/gdb/configure.ac
> index a7b744bf241..ddb9530afd0 100644
> --- a/gdb/configure.ac
> +++ b/gdb/configure.ac
> @@ -2215,8 +2215,8 @@ AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "UTF-8",
>            [Define to be a string naming the default host character set.])
>
>  GDB_AC_SELFTEST([
> -  CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_UNITTESTS_OBS) gdbsupport/selftest.o selftest-arch.o"
> -  CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_UNITTESTS_SRCS) gdbsupport/selftest.c selftest-arch.c"
> +  CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_UNITTESTS_OBS) selftest-arch.o"
> +  CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_UNITTESTS_SRCS) selftest-arch.c"
>  ])
>
>  GDB_AC_TRANSFORM([gdb], [GDB_TRANSFORM_NAME])
> diff --git a/gdb/defs.h b/gdb/defs.h
> index 567f214b81d..1ad52feb1f8 100644
> --- a/gdb/defs.h
> +++ b/gdb/defs.h
> @@ -27,6 +27,15 @@
>
>  #include "gdbsupport/common-defs.h"
>
> +#undef PACKAGE
> +#undef PACKAGE_NAME
> +#undef PACKAGE_VERSION
> +#undef PACKAGE_STRING
> +#undef PACKAGE_TARNAME
> +
> +#include <config.h>
> +#include "bfd.h"
> +
>  #include <sys/types.h>
>  #include <limits.h>
>
> diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
> index c3b547528d0..22d10bec484 100644
> --- a/gdb/gdbserver/ChangeLog
> +++ b/gdb/gdbserver/ChangeLog
> @@ -1,3 +1,16 @@
> +2020-01-08  Tom Tromey  <tom@tromey.com>
> +
> +       * server.h: Include config.h.
> +       * gdbreplay.c: Include config.h.
> +       * configure: Rebuild.
> +       * configure.ac: Don't source common.host.
> +       * acinclude.m4: Update path.
> +       * Makefile.in (INCSUPPORT): New variable.
> +       (INCLUDE_CFLAGS): Add INCSUPPORT.
> +       (SFILES): Update paths.
> +       (version-generated.c): Update path to create-version.sh.
> +       (gdbsupport/%-ipa.o, gdbsupport/%.o): Update paths.
> +
>  2020-01-08  Tom Tromey  <tom@tromey.com>
>
>         * configure.ac (LIBS): Use WIN32APILIBS.
> diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
> index 1125426778b..9640a2a4447 100644
> --- a/gdb/gdbserver/Makefile.in
> +++ b/gdb/gdbserver/Makefile.in
> @@ -109,6 +109,8 @@ INCGNU = -I$(srcdir)/../../gnulib/import -I$(GNULIB_BUILDDIR)/import
>  # so that they are generated before other files are compiled.
>  GNULIB_H = $(GNULIB_BUILDDIR)/import/string.h @GNULIB_STDINT_H@
>
> +INCSUPPORT = -I$(srcdir)/../.. -I../..
> +
>  # All the includes used for CFLAGS and for lint.
>  # -I. for config files.
>  # -I${srcdir} for our headers.
> @@ -120,7 +122,7 @@ GNULIB_H = $(GNULIB_BUILDDIR)/import/string.h @GNULIB_STDINT_H@
>  #
>  INCLUDE_CFLAGS = -I. -I${srcdir} \
>         -I$(srcdir)/../regformats -I$(srcdir)/.. -I$(INCLUDE_DIR) \
> -       $(INCGNU)
> +       $(INCGNU) $(INCSUPPORT)
>
>  # M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS
>  # from the config/ directory.
> @@ -201,32 +203,32 @@ SFILES = \
>         $(srcdir)/arch/arm-linux.c \
>         $(srcdir)/arch/ppc-linux-common.c \
>         $(srcdir)/../alloc.c \
> -       $(srcdir)/gdbsupport/btrace-common.c \
> -       $(srcdir)/gdbsupport/buffer.c \
> -       $(srcdir)/gdbsupport/cleanups.c \
> -       $(srcdir)/gdbsupport/common-debug.c \
> -       $(srcdir)/gdbsupport/common-exceptions.c \
> -       $(srcdir)/gdbsupport/common-inferior.c \
> -       $(srcdir)/gdbsupport/common-regcache.c \
> -       $(srcdir)/gdbsupport/common-utils.c \
> -       $(srcdir)/gdbsupport/errors.c \
> -       $(srcdir)/gdbsupport/environ.c \
> -       $(srcdir)/gdbsupport/fileio.c \
> -       $(srcdir)/gdbsupport/filestuff.c \
> -       $(srcdir)/gdbsupport/job-control.c \
> -       $(srcdir)/gdbsupport/gdb-dlfcn.c \
> -       $(srcdir)/gdbsupport/gdb_tilde_expand.c \
> -       $(srcdir)/gdbsupport/gdb_vecs.c \
> -       $(srcdir)/gdbsupport/gdb_wait.c \
> -       $(srcdir)/gdbsupport/netstuff.c \
> -       $(srcdir)/gdbsupport/new-op.c \
> -       $(srcdir)/gdbsupport/pathstuff.c \
> -       $(srcdir)/gdbsupport/print-utils.c \
> -       $(srcdir)/gdbsupport/ptid.c \
> -       $(srcdir)/gdbsupport/rsp-low.c \
> -       $(srcdir)/gdbsupport/safe-strerror.c \
> -       $(srcdir)/gdbsupport/tdesc.c \
> -       $(srcdir)/gdbsupport/xml-utils.c \
> +       $(srcdir)/../../gdbsupport/btrace-common.c \
> +       $(srcdir)/../../gdbsupport/buffer.c \
> +       $(srcdir)/../../gdbsupport/cleanups.c \
> +       $(srcdir)/../../gdbsupport/common-debug.c \
> +       $(srcdir)/../../gdbsupport/common-exceptions.c \
> +       $(srcdir)/../../gdbsupport/common-inferior.c \
> +       $(srcdir)/../../gdbsupport/common-regcache.c \
> +       $(srcdir)/../../gdbsupport/common-utils.c \
> +       $(srcdir)/../../gdbsupport/errors.c \
> +       $(srcdir)/../../gdbsupport/environ.c \
> +       $(srcdir)/../../gdbsupport/fileio.c \
> +       $(srcdir)/../../gdbsupport/filestuff.c \
> +       $(srcdir)/../../gdbsupport/job-control.c \
> +       $(srcdir)/../../gdbsupport/gdb-dlfcn.c \
> +       $(srcdir)/../../gdbsupport/gdb_tilde_expand.c \
> +       $(srcdir)/../../gdbsupport/gdb_vecs.c \
> +       $(srcdir)/../../gdbsupport/gdb_wait.c \
> +       $(srcdir)/../../gdbsupport/netstuff.c \
> +       $(srcdir)/../../gdbsupport/new-op.c \
> +       $(srcdir)/../../gdbsupport/pathstuff.c \
> +       $(srcdir)/../../gdbsupport/print-utils.c \
> +       $(srcdir)/../../gdbsupport/ptid.c \
> +       $(srcdir)/../../gdbsupport/rsp-low.c \
> +       $(srcdir)/../../gdbsupport/safe-strerror.c \
> +       $(srcdir)/../../gdbsupport/tdesc.c \
> +       $(srcdir)/../../gdbsupport/xml-utils.c \
>         $(srcdir)/nat/aarch64-sve-linux-ptrace.c \
>         $(srcdir)/nat/linux-btrace.c \
>         $(srcdir)/nat/linux-namespaces.c \
> @@ -529,8 +531,8 @@ am--refresh:
>
>  force:
>
> -version-generated.c: Makefile $(srcdir)/../version.in $(srcdir)/../../bfd/version.h $(srcdir)/../gdbsupport/create-version.sh
> -       $(ECHO_GEN) $(SHELL) $(srcdir)/../gdbsupport/create-version.sh $(srcdir)/.. \
> +version-generated.c: Makefile $(srcdir)/../version.in $(srcdir)/../../bfd/version.h $(srcdir)/../../gdbsupport/create-version.sh
> +       $(ECHO_GEN) $(SHELL) $(srcdir)/../../gdbsupport/create-version.sh $(srcdir)/.. \
>                 $(host_alias) $(target_alias) $@
>
>  xml-builtin-generated.c: stamp-xml; @true
> @@ -588,7 +590,7 @@ arch/%-ipa.o: ../arch/%.c
>         $(IPAGENT_COMPILE) $<
>         $(POSTCOMPILE)
>
> -gdbsupport/%-ipa.o: ../gdbsupport/%.c
> +gdbsupport/%-ipa.o: ../../gdbsupport/%.c
>         $(IPAGENT_COMPILE) $<
>         $(POSTCOMPILE)
>
> @@ -621,7 +623,7 @@ arch/%.o: ../arch/%.c
>         $(COMPILE) $<
>         $(POSTCOMPILE)
>
> -gdbsupport/%.o: ../gdbsupport/%.c
> +gdbsupport/%.o: ../../gdbsupport/%.c
>         $(COMPILE) $<
>         $(POSTCOMPILE)
>
> diff --git a/gdb/gdbserver/acinclude.m4 b/gdb/gdbserver/acinclude.m4
> index 4c18e9b01db..a42f2d5e74a 100644
> --- a/gdb/gdbserver/acinclude.m4
> +++ b/gdb/gdbserver/acinclude.m4
> @@ -18,7 +18,7 @@ m4_include(../../config/lead-dot.m4)
>  dnl codeset.m4 is needed for common.m4, but not for
>  dnl anything else in gdbserver.
>  m4_include(../../config/codeset.m4)
> -m4_include(../gdbsupport/common.m4)
> +m4_include(../../gdbsupport/common.m4)
>
>  dnl For libiberty_INIT.
>  m4_include(../libiberty.m4)
> diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c
> index 3ed18f1f372..263fb0efeac 100644
> --- a/gdb/gdbserver/gdbreplay.c
> +++ b/gdb/gdbserver/gdbreplay.c
> @@ -18,6 +18,14 @@
>     along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>
>  #include "gdbsupport/common-defs.h"
> +
> +#undef PACKAGE
> +#undef PACKAGE_NAME
> +#undef PACKAGE_VERSION
> +#undef PACKAGE_STRING
> +#undef PACKAGE_TARNAME
> +
> +#include <config.h>
>  #include "gdbsupport/version.h"
>
>  #if HAVE_SYS_FILE_H
> diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
> index 0c74f99a161..3c286862349 100644
> --- a/gdb/gdbserver/server.h
> +++ b/gdb/gdbserver/server.h
> @@ -21,6 +21,14 @@
>
>  #include "gdbsupport/common-defs.h"
>
> +#undef PACKAGE
> +#undef PACKAGE_NAME
> +#undef PACKAGE_VERSION
> +#undef PACKAGE_STRING
> +#undef PACKAGE_TARNAME
> +
> +#include <config.h>
> +
>  gdb_static_assert (sizeof (CORE_ADDR) >= sizeof (void *));
>
>  #ifdef __MINGW32CE__
> diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c
> index 03fc85e2ece..3a3cd8d235d 100644
> --- a/gdb/nat/linux-btrace.c
> +++ b/gdb/nat/linux-btrace.c
> @@ -20,6 +20,14 @@
>     along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>
>  #include "gdbsupport/common-defs.h"
> +
> +#undef PACKAGE
> +#undef PACKAGE_NAME
> +#undef PACKAGE_VERSION
> +#undef PACKAGE_STRING
> +#undef PACKAGE_TARNAME
> +
> +#include <config.h>
>  #include "linux-btrace.h"
>  #include "gdbsupport/common-regcache.h"
>  #include "gdbsupport/gdb_wait.h"
> diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c
> index 5335d690922..859feb7ca87 100644
> --- a/gdb/nat/linux-ptrace.c
> +++ b/gdb/nat/linux-ptrace.c
> @@ -17,6 +17,14 @@
>     along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>
>  #include "gdbsupport/common-defs.h"
> +
> +#undef PACKAGE
> +#undef PACKAGE_NAME
> +#undef PACKAGE_VERSION
> +#undef PACKAGE_STRING
> +#undef PACKAGE_TARNAME
> +
> +#include <config.h>
>  #include "linux-ptrace.h"
>  #include "linux-procfs.h"
>  #include "linux-waitpid.h"
> diff --git a/gdb/nat/x86-linux-dregs.c b/gdb/nat/x86-linux-dregs.c
> index b5dd71e3c7c..31683aab17c 100644
> --- a/gdb/nat/x86-linux-dregs.c
> +++ b/gdb/nat/x86-linux-dregs.c
> @@ -18,6 +18,14 @@
>     along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>
>  #include "gdbsupport/common-defs.h"
> +
> +#undef PACKAGE
> +#undef PACKAGE_NAME
> +#undef PACKAGE_VERSION
> +#undef PACKAGE_STRING
> +#undef PACKAGE_TARNAME
> +
> +#include <config.h>
>  #include "nat/gdb_ptrace.h"
>  #include <sys/user.h>
>  #include "target/waitstatus.h"
> diff --git a/gdbsupport/ChangeLog b/gdbsupport/ChangeLog
> new file mode 100644
> index 00000000000..727b919bb08
> --- /dev/null
> +++ b/gdbsupport/ChangeLog
> @@ -0,0 +1,7 @@
> +2020-01-08  Tom Tromey  <tom@tromey.com>
> +
> +       * common-defs.h: Add GDBSERVER case.  Update includes.
> +       * acinclude.m4, aclocal.m4, config.in, configure, configure.ac,
> +       Makefile.am, Makefile.in, README: New files.
> +       * Moved from ../gdb/gdbsupport/
> +
> diff --git a/gdbsupport/Makefile.am b/gdbsupport/Makefile.am
> new file mode 100644
> index 00000000000..48e6079fb9f
> --- /dev/null
> +++ b/gdbsupport/Makefile.am
> @@ -0,0 +1,70 @@
> +## Process this file with automake to generate Makefile.in
> +#
> +#   Copyright (C) 2020 Free Software Foundation, Inc.
> +#
> +# This file is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 3 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; see the file COPYING3.  If not see
> +# <http://www.gnu.org/licenses/>.
> +#
> +
> +AUTOMAKE_OPTIONS = no-dist foreign
> +ACLOCAL_AMFLAGS = -I . -I ../config
> +
> +AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir)/../gdb \
> +    -I../gnulib/import -I$(srcdir)/../gnulib/import \
> +    -I.. -I$(srcdir)/.. $(INCINTL) -I../bfd -I$(srcdir)/../bfd
> +
> +override CC := $(CXX)
> +override CFLAGS := $(CXXFLAGS)
> +
> +noinst_LIBRARIES = libgdbsupport.a
> +
> +if SELFTEST
> +selftest = selftest.c
> +endif
> +
> +libgdbsupport_a_SOURCES = \
> +    agent.c \
> +    btrace-common.c \
> +    buffer.c \
> +    cleanups.c \
> +    common-debug.c \
> +    common-exceptions.c        \
> +    common-inferior.c \
> +    common-regcache.c \
> +    common-utils.c \
> +    environ.c \
> +    errors.c \
> +    fileio.c \
> +    filestuff.c        \
> +    format.c \
> +    gdb-dlfcn.c        \
> +    gdb_tilde_expand.c \
> +    gdb_wait.c \
> +    gdb_vecs.c \
> +    job-control.c \
> +    netstuff.c \
> +    new-op.c \
> +    pathstuff.c        \
> +    print-utils.c \
> +    ptid.c \
> +    rsp-low.c \
> +    run-time-clock.c \
> +    safe-strerror.c \
> +    scoped_mmap.c \
> +    signals.c \
> +    signals-state-save-restore.c \
> +    tdesc.c \
> +    thread-pool.c \
> +    xml-utils.c        \
> +    $(selftest)
> diff --git a/gdbsupport/README b/gdbsupport/README
> new file mode 100644
> index 00000000000..257dcea5af9
> --- /dev/null
> +++ b/gdbsupport/README
> @@ -0,0 +1,4 @@
> +This is a helper library that is used by gdb and gdbserver.
> +
> +To send patches, follow the gdb patch submission instructions in
> +../gdb/CONTRIBUTE.  For maintainers, see ../gdb/MAINTAINERS.
> diff --git a/gdbsupport/acinclude.m4 b/gdbsupport/acinclude.m4
> new file mode 100644
> index 00000000000..6e20e9cdb0a
> --- /dev/null
> +++ b/gdbsupport/acinclude.m4
> @@ -0,0 +1,5 @@
> +m4_include([common.m4])
> +m4_include([../config/ax_pthread.m4])
> +m4_include([../gdb/ax_cxx_compile_stdcxx.m4])
> +m4_include([../gdb/libiberty.m4])
> +m4_include([../gdb/selftest.m4])
> diff --git a/gdb/gdbsupport/agent.c b/gdbsupport/agent.c
> similarity index 100%
> rename from gdb/gdbsupport/agent.c
> rename to gdbsupport/agent.c
> diff --git a/gdb/gdbsupport/agent.h b/gdbsupport/agent.h
> similarity index 100%
> rename from gdb/gdbsupport/agent.h
> rename to gdbsupport/agent.h
> diff --git a/gdb/gdbsupport/alt-stack.h b/gdbsupport/alt-stack.h
> similarity index 100%
> rename from gdb/gdbsupport/alt-stack.h
> rename to gdbsupport/alt-stack.h
> diff --git a/gdb/gdbsupport/array-view.h b/gdbsupport/array-view.h
> similarity index 100%
> rename from gdb/gdbsupport/array-view.h
> rename to gdbsupport/array-view.h
> diff --git a/gdb/gdbsupport/ax.def b/gdbsupport/ax.def
> similarity index 100%
> rename from gdb/gdbsupport/ax.def
> rename to gdbsupport/ax.def
> diff --git a/gdb/gdbsupport/block-signals.h b/gdbsupport/block-signals.h
> similarity index 100%
> rename from gdb/gdbsupport/block-signals.h
> rename to gdbsupport/block-signals.h
> diff --git a/gdb/gdbsupport/break-common.h b/gdbsupport/break-common.h
> similarity index 100%
> rename from gdb/gdbsupport/break-common.h
> rename to gdbsupport/break-common.h
> diff --git a/gdb/gdbsupport/btrace-common.c b/gdbsupport/btrace-common.c
> similarity index 100%
> rename from gdb/gdbsupport/btrace-common.c
> rename to gdbsupport/btrace-common.c
> diff --git a/gdb/gdbsupport/btrace-common.h b/gdbsupport/btrace-common.h
> similarity index 100%
> rename from gdb/gdbsupport/btrace-common.h
> rename to gdbsupport/btrace-common.h
> diff --git a/gdb/gdbsupport/buffer.c b/gdbsupport/buffer.c
> similarity index 100%
> rename from gdb/gdbsupport/buffer.c
> rename to gdbsupport/buffer.c
> diff --git a/gdb/gdbsupport/buffer.h b/gdbsupport/buffer.h
> similarity index 100%
> rename from gdb/gdbsupport/buffer.h
> rename to gdbsupport/buffer.h
> diff --git a/gdb/gdbsupport/byte-vector.h b/gdbsupport/byte-vector.h
> similarity index 100%
> rename from gdb/gdbsupport/byte-vector.h
> rename to gdbsupport/byte-vector.h
> diff --git a/gdb/gdbsupport/cleanups.c b/gdbsupport/cleanups.c
> similarity index 100%
> rename from gdb/gdbsupport/cleanups.c
> rename to gdbsupport/cleanups.c
> diff --git a/gdb/gdbsupport/cleanups.h b/gdbsupport/cleanups.h
> similarity index 100%
> rename from gdb/gdbsupport/cleanups.h
> rename to gdbsupport/cleanups.h
> diff --git a/gdb/gdbsupport/common-debug.c b/gdbsupport/common-debug.c
> similarity index 100%
> rename from gdb/gdbsupport/common-debug.c
> rename to gdbsupport/common-debug.c
> diff --git a/gdb/gdbsupport/common-debug.h b/gdbsupport/common-debug.h
> similarity index 100%
> rename from gdb/gdbsupport/common-debug.h
> rename to gdbsupport/common-debug.h
> diff --git a/gdb/gdbsupport/common-defs.h b/gdbsupport/common-defs.h
> similarity index 95%
> rename from gdb/gdbsupport/common-defs.h
> rename to gdbsupport/common-defs.h
> index 214bca1ee17..d823c41607c 100644
> --- a/gdb/gdbsupport/common-defs.h
> +++ b/gdbsupport/common-defs.h
> @@ -20,24 +20,32 @@
>  #ifndef COMMON_COMMON_DEFS_H
>  #define COMMON_COMMON_DEFS_H
>
> -#include "config.h"
> +#ifdef GDBSERVER
> +
> +#include <build-gnulib-gdbserver/config.h>
>
>  #undef PACKAGE_NAME
> +#undef PACKAGE
>  #undef PACKAGE_VERSION
>  #undef PACKAGE_STRING
>  #undef PACKAGE_TARNAME
>
> -#ifdef GDBSERVER
> -#include "build-gnulib-gdbserver/config.h"
> -#else
> -#include "../../gnulib/config.h"
> -#endif
> +#include <config.h>
> +
> +#else  /* GDBSERVER */
> +
> +#include <gdbsupport/support-config.h>
>
>  #undef PACKAGE_NAME
> +#undef PACKAGE
>  #undef PACKAGE_VERSION
>  #undef PACKAGE_STRING
>  #undef PACKAGE_TARNAME
>
> +#include "gnulib/config.h"
> +
> +#endif /* GDBSERVER */
> +
>  /* From:
>      https://www.gnu.org/software/gnulib/manual/html_node/stdint_002eh.html
>
> diff --git a/gdb/gdbsupport/common-exceptions.c b/gdbsupport/common-exceptions.c
> similarity index 100%
> rename from gdb/gdbsupport/common-exceptions.c
> rename to gdbsupport/common-exceptions.c
> diff --git a/gdb/gdbsupport/common-exceptions.h b/gdbsupport/common-exceptions.h
> similarity index 100%
> rename from gdb/gdbsupport/common-exceptions.h
> rename to gdbsupport/common-exceptions.h
> diff --git a/gdb/gdbsupport/common-gdbthread.h b/gdbsupport/common-gdbthread.h
> similarity index 100%
> rename from gdb/gdbsupport/common-gdbthread.h
> rename to gdbsupport/common-gdbthread.h
> diff --git a/gdb/gdbsupport/common-inferior.c b/gdbsupport/common-inferior.c
> similarity index 100%
> rename from gdb/gdbsupport/common-inferior.c
> rename to gdbsupport/common-inferior.c
> diff --git a/gdb/gdbsupport/common-inferior.h b/gdbsupport/common-inferior.h
> similarity index 100%
> rename from gdb/gdbsupport/common-inferior.h
> rename to gdbsupport/common-inferior.h
> diff --git a/gdb/gdbsupport/common-regcache.c b/gdbsupport/common-regcache.c
> similarity index 100%
> rename from gdb/gdbsupport/common-regcache.c
> rename to gdbsupport/common-regcache.c
> diff --git a/gdb/gdbsupport/common-regcache.h b/gdbsupport/common-regcache.h
> similarity index 100%
> rename from gdb/gdbsupport/common-regcache.h
> rename to gdbsupport/common-regcache.h
> diff --git a/gdb/gdbsupport/common-types.h b/gdbsupport/common-types.h
> similarity index 100%
> rename from gdb/gdbsupport/common-types.h
> rename to gdbsupport/common-types.h
> diff --git a/gdb/gdbsupport/common-utils.c b/gdbsupport/common-utils.c
> similarity index 100%
> rename from gdb/gdbsupport/common-utils.c
> rename to gdbsupport/common-utils.c
> diff --git a/gdb/gdbsupport/common-utils.h b/gdbsupport/common-utils.h
> similarity index 100%
> rename from gdb/gdbsupport/common-utils.h
> rename to gdbsupport/common-utils.h
> diff --git a/gdb/gdbsupport/common.m4 b/gdbsupport/common.m4
> similarity index 100%
> rename from gdb/gdbsupport/common.m4
> rename to gdbsupport/common.m4
> diff --git a/gdbsupport/configure.ac b/gdbsupport/configure.ac
> new file mode 100644
> index 00000000000..1dfed3cdc51
> --- /dev/null
> +++ b/gdbsupport/configure.ac
> @@ -0,0 +1,63 @@
> +dnl Autoconf configure script for GDB support library
> +dnl Copyright (C) 2020 Free Software Foundation, Inc.
> +dnl
> +dnl This program is free software; you can redistribute it and/or modify
> +dnl it under the terms of the GNU General Public License as published by
> +dnl the Free Software Foundation; either version 3 of the License, or
> +dnl (at your option) any later version.
> +dnl
> +dnl This program is distributed in the hope that it will be useful,
> +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
> +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +dnl GNU General Public License for more details.
> +dnl
> +dnl You should have received a copy of the GNU General Public License
> +dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +
> +dnl Process this file with autoconf to produce a configure script.
> +
> +AC_INIT([gdbsupport], 1.0)
> +AC_CONFIG_SRCDIR(common-defs.h)
> +AC_CONFIG_HEADER(support-config.h:config.in)
> +AC_CANONICAL_SYSTEM
> +AM_MAINTAINER_MODE
> +AC_CONFIG_AUX_DIR(..)
> +AM_INIT_AUTOMAKE
> +AM_SILENT_RULES([yes])
> +
> +AC_PROG_CC
> +AC_PROG_CXX
> +AC_PROG_RANLIB
> +
> +AC_USE_SYSTEM_EXTENSIONS
> +ACX_LARGEFILE
> +AM_PROG_CC_STDC
> +
> +# We require a C++11 compiler.  Check if one is available, and if
> +# necessary, set CXX_DIALECT to some -std=xxx switch.
> +AX_CXX_COMPILE_STDCXX(11, , mandatory)
> +
> +dnl Set up for gettext.
> +ZW_GNU_GETTEXT_SISTER_DIR
> +
> +libiberty_INIT
> +GDB_AC_COMMON
> +GDB_AC_SELFTEST
> +AM_CONDITIONAL(SELFTEST, $enable_unittests)
> +
> +TARGET_WORD_SIZE=`sed -n 's,#define BFD_ARCH_SIZE \(.*\)$,\1,p' ../bfd/bfd-in3.h`
> +AC_DEFINE_UNQUOTED(TARGET_WORD_SIZE, $TARGET_WORD_SIZE,
> +   [Define to the word size for the target.])
> +
> +case ${host} in
> +  *mingw32*)
> +    AC_DEFINE(USE_WIN32API, 1,
> +              [Define if we should use the Windows API, instead of the
> +              POSIX API.  On Windows, we use the Windows API when
> +              building for MinGW, but the POSIX API when building
> +              for Cygwin.])
> +    ;;
> +esac
> +
> +AC_CONFIG_FILES([Makefile])
> +AC_OUTPUT
> diff --git a/gdb/gdbsupport/create-version.sh b/gdbsupport/create-version.sh
> similarity index 100%
> rename from gdb/gdbsupport/create-version.sh
> rename to gdbsupport/create-version.sh
> diff --git a/gdb/gdbsupport/def-vector.h b/gdbsupport/def-vector.h
> similarity index 100%
> rename from gdb/gdbsupport/def-vector.h
> rename to gdbsupport/def-vector.h
> diff --git a/gdb/gdbsupport/default-init-alloc.h b/gdbsupport/default-init-alloc.h
> similarity index 100%
> rename from gdb/gdbsupport/default-init-alloc.h
> rename to gdbsupport/default-init-alloc.h
> diff --git a/gdb/gdbsupport/enum-flags.h b/gdbsupport/enum-flags.h
> similarity index 100%
> rename from gdb/gdbsupport/enum-flags.h
> rename to gdbsupport/enum-flags.h
> diff --git a/gdb/gdbsupport/environ.c b/gdbsupport/environ.c
> similarity index 100%
> rename from gdb/gdbsupport/environ.c
> rename to gdbsupport/environ.c
> diff --git a/gdb/gdbsupport/environ.h b/gdbsupport/environ.h
> similarity index 100%
> rename from gdb/gdbsupport/environ.h
> rename to gdbsupport/environ.h
> diff --git a/gdb/gdbsupport/errors.c b/gdbsupport/errors.c
> similarity index 100%
> rename from gdb/gdbsupport/errors.c
> rename to gdbsupport/errors.c
> diff --git a/gdb/gdbsupport/errors.h b/gdbsupport/errors.h
> similarity index 100%
> rename from gdb/gdbsupport/errors.h
> rename to gdbsupport/errors.h
> diff --git a/gdb/gdbsupport/fileio.c b/gdbsupport/fileio.c
> similarity index 100%
> rename from gdb/gdbsupport/fileio.c
> rename to gdbsupport/fileio.c
> diff --git a/gdb/gdbsupport/fileio.h b/gdbsupport/fileio.h
> similarity index 100%
> rename from gdb/gdbsupport/fileio.h
> rename to gdbsupport/fileio.h
> diff --git a/gdb/gdbsupport/filestuff.c b/gdbsupport/filestuff.c
> similarity index 100%
> rename from gdb/gdbsupport/filestuff.c
> rename to gdbsupport/filestuff.c
> diff --git a/gdb/gdbsupport/filestuff.h b/gdbsupport/filestuff.h
> similarity index 100%
> rename from gdb/gdbsupport/filestuff.h
> rename to gdbsupport/filestuff.h
> diff --git a/gdb/gdbsupport/filtered-iterator.h b/gdbsupport/filtered-iterator.h
> similarity index 100%
> rename from gdb/gdbsupport/filtered-iterator.h
> rename to gdbsupport/filtered-iterator.h
> diff --git a/gdb/gdbsupport/format.c b/gdbsupport/format.c
> similarity index 100%
> rename from gdb/gdbsupport/format.c
> rename to gdbsupport/format.c
> diff --git a/gdb/gdbsupport/format.h b/gdbsupport/format.h
> similarity index 100%
> rename from gdb/gdbsupport/format.h
> rename to gdbsupport/format.h
> diff --git a/gdb/gdbsupport/forward-scope-exit.h b/gdbsupport/forward-scope-exit.h
> similarity index 100%
> rename from gdb/gdbsupport/forward-scope-exit.h
> rename to gdbsupport/forward-scope-exit.h
> diff --git a/gdb/gdbsupport/function-view.h b/gdbsupport/function-view.h
> similarity index 100%
> rename from gdb/gdbsupport/function-view.h
> rename to gdbsupport/function-view.h
> diff --git a/gdb/gdbsupport/gdb-dlfcn.c b/gdbsupport/gdb-dlfcn.c
> similarity index 100%
> rename from gdb/gdbsupport/gdb-dlfcn.c
> rename to gdbsupport/gdb-dlfcn.c
> diff --git a/gdb/gdbsupport/gdb-dlfcn.h b/gdbsupport/gdb-dlfcn.h
> similarity index 100%
> rename from gdb/gdbsupport/gdb-dlfcn.h
> rename to gdbsupport/gdb-dlfcn.h
> diff --git a/gdb/gdbsupport/gdb-sigmask.h b/gdbsupport/gdb-sigmask.h
> similarity index 100%
> rename from gdb/gdbsupport/gdb-sigmask.h
> rename to gdbsupport/gdb-sigmask.h
> diff --git a/gdb/gdbsupport/gdb_assert.h b/gdbsupport/gdb_assert.h
> similarity index 100%
> rename from gdb/gdbsupport/gdb_assert.h
> rename to gdbsupport/gdb_assert.h
> diff --git a/gdb/gdbsupport/gdb_binary_search.h b/gdbsupport/gdb_binary_search.h
> similarity index 100%
> rename from gdb/gdbsupport/gdb_binary_search.h
> rename to gdbsupport/gdb_binary_search.h
> diff --git a/gdb/gdbsupport/gdb_locale.h b/gdbsupport/gdb_locale.h
> similarity index 100%
> rename from gdb/gdbsupport/gdb_locale.h
> rename to gdbsupport/gdb_locale.h
> diff --git a/gdb/gdbsupport/gdb_optional.h b/gdbsupport/gdb_optional.h
> similarity index 100%
> rename from gdb/gdbsupport/gdb_optional.h
> rename to gdbsupport/gdb_optional.h
> diff --git a/gdb/gdbsupport/gdb_proc_service.h b/gdbsupport/gdb_proc_service.h
> similarity index 100%
> rename from gdb/gdbsupport/gdb_proc_service.h
> rename to gdbsupport/gdb_proc_service.h
> diff --git a/gdb/gdbsupport/gdb_ref_ptr.h b/gdbsupport/gdb_ref_ptr.h
> similarity index 100%
> rename from gdb/gdbsupport/gdb_ref_ptr.h
> rename to gdbsupport/gdb_ref_ptr.h
> diff --git a/gdb/gdbsupport/gdb_setjmp.h b/gdbsupport/gdb_setjmp.h
> similarity index 100%
> rename from gdb/gdbsupport/gdb_setjmp.h
> rename to gdbsupport/gdb_setjmp.h
> diff --git a/gdb/gdbsupport/gdb_signals.h b/gdbsupport/gdb_signals.h
> similarity index 100%
> rename from gdb/gdbsupport/gdb_signals.h
> rename to gdbsupport/gdb_signals.h
> diff --git a/gdb/gdbsupport/gdb_splay_tree.h b/gdbsupport/gdb_splay_tree.h
> similarity index 100%
> rename from gdb/gdbsupport/gdb_splay_tree.h
> rename to gdbsupport/gdb_splay_tree.h
> diff --git a/gdb/gdbsupport/gdb_string_view.h b/gdbsupport/gdb_string_view.h
> similarity index 100%
> rename from gdb/gdbsupport/gdb_string_view.h
> rename to gdbsupport/gdb_string_view.h
> diff --git a/gdb/gdbsupport/gdb_string_view.tcc b/gdbsupport/gdb_string_view.tcc
> similarity index 100%
> rename from gdb/gdbsupport/gdb_string_view.tcc
> rename to gdbsupport/gdb_string_view.tcc
> diff --git a/gdb/gdbsupport/gdb_sys_time.h b/gdbsupport/gdb_sys_time.h
> similarity index 100%
> rename from gdb/gdbsupport/gdb_sys_time.h
> rename to gdbsupport/gdb_sys_time.h
> diff --git a/gdb/gdbsupport/gdb_tilde_expand.c b/gdbsupport/gdb_tilde_expand.c
> similarity index 100%
> rename from gdb/gdbsupport/gdb_tilde_expand.c
> rename to gdbsupport/gdb_tilde_expand.c
> diff --git a/gdb/gdbsupport/gdb_tilde_expand.h b/gdbsupport/gdb_tilde_expand.h
> similarity index 100%
> rename from gdb/gdbsupport/gdb_tilde_expand.h
> rename to gdbsupport/gdb_tilde_expand.h
> diff --git a/gdb/gdbsupport/gdb_unique_ptr.h b/gdbsupport/gdb_unique_ptr.h
> similarity index 100%
> rename from gdb/gdbsupport/gdb_unique_ptr.h
> rename to gdbsupport/gdb_unique_ptr.h
> diff --git a/gdb/gdbsupport/gdb_unlinker.h b/gdbsupport/gdb_unlinker.h
> similarity index 100%
> rename from gdb/gdbsupport/gdb_unlinker.h
> rename to gdbsupport/gdb_unlinker.h
> diff --git a/gdb/gdbsupport/gdb_vecs.c b/gdbsupport/gdb_vecs.c
> similarity index 100%
> rename from gdb/gdbsupport/gdb_vecs.c
> rename to gdbsupport/gdb_vecs.c
> diff --git a/gdb/gdbsupport/gdb_vecs.h b/gdbsupport/gdb_vecs.h
> similarity index 100%
> rename from gdb/gdbsupport/gdb_vecs.h
> rename to gdbsupport/gdb_vecs.h
> diff --git a/gdb/gdbsupport/gdb_wait.c b/gdbsupport/gdb_wait.c
> similarity index 100%
> rename from gdb/gdbsupport/gdb_wait.c
> rename to gdbsupport/gdb_wait.c
> diff --git a/gdb/gdbsupport/gdb_wait.h b/gdbsupport/gdb_wait.h
> similarity index 100%
> rename from gdb/gdbsupport/gdb_wait.h
> rename to gdbsupport/gdb_wait.h
> diff --git a/gdb/gdbsupport/hash_enum.h b/gdbsupport/hash_enum.h
> similarity index 100%
> rename from gdb/gdbsupport/hash_enum.h
> rename to gdbsupport/hash_enum.h
> diff --git a/gdb/gdbsupport/host-defs.h b/gdbsupport/host-defs.h
> similarity index 100%
> rename from gdb/gdbsupport/host-defs.h
> rename to gdbsupport/host-defs.h
> diff --git a/gdb/gdbsupport/job-control.c b/gdbsupport/job-control.c
> similarity index 100%
> rename from gdb/gdbsupport/job-control.c
> rename to gdbsupport/job-control.c
> diff --git a/gdb/gdbsupport/job-control.h b/gdbsupport/job-control.h
> similarity index 100%
> rename from gdb/gdbsupport/job-control.h
> rename to gdbsupport/job-control.h
> diff --git a/gdb/gdbsupport/netstuff.c b/gdbsupport/netstuff.c
> similarity index 100%
> rename from gdb/gdbsupport/netstuff.c
> rename to gdbsupport/netstuff.c
> diff --git a/gdb/gdbsupport/netstuff.h b/gdbsupport/netstuff.h
> similarity index 100%
> rename from gdb/gdbsupport/netstuff.h
> rename to gdbsupport/netstuff.h
> diff --git a/gdb/gdbsupport/new-op.c b/gdbsupport/new-op.c
> similarity index 100%
> rename from gdb/gdbsupport/new-op.c
> rename to gdbsupport/new-op.c
> diff --git a/gdb/gdbsupport/next-iterator.h b/gdbsupport/next-iterator.h
> similarity index 100%
> rename from gdb/gdbsupport/next-iterator.h
> rename to gdbsupport/next-iterator.h
> diff --git a/gdb/gdbsupport/observable.h b/gdbsupport/observable.h
> similarity index 100%
> rename from gdb/gdbsupport/observable.h
> rename to gdbsupport/observable.h
> diff --git a/gdb/gdbsupport/offset-type.h b/gdbsupport/offset-type.h
> similarity index 100%
> rename from gdb/gdbsupport/offset-type.h
> rename to gdbsupport/offset-type.h
> diff --git a/gdb/gdbsupport/parallel-for.h b/gdbsupport/parallel-for.h
> similarity index 100%
> rename from gdb/gdbsupport/parallel-for.h
> rename to gdbsupport/parallel-for.h
> diff --git a/gdb/gdbsupport/pathstuff.c b/gdbsupport/pathstuff.c
> similarity index 100%
> rename from gdb/gdbsupport/pathstuff.c
> rename to gdbsupport/pathstuff.c
> diff --git a/gdb/gdbsupport/pathstuff.h b/gdbsupport/pathstuff.h
> similarity index 100%
> rename from gdb/gdbsupport/pathstuff.h
> rename to gdbsupport/pathstuff.h
> diff --git a/gdb/gdbsupport/poison.h b/gdbsupport/poison.h
> similarity index 100%
> rename from gdb/gdbsupport/poison.h
> rename to gdbsupport/poison.h
> diff --git a/gdb/gdbsupport/preprocessor.h b/gdbsupport/preprocessor.h
> similarity index 100%
> rename from gdb/gdbsupport/preprocessor.h
> rename to gdbsupport/preprocessor.h
> diff --git a/gdb/gdbsupport/print-utils.c b/gdbsupport/print-utils.c
> similarity index 100%
> rename from gdb/gdbsupport/print-utils.c
> rename to gdbsupport/print-utils.c
> diff --git a/gdb/gdbsupport/print-utils.h b/gdbsupport/print-utils.h
> similarity index 100%
> rename from gdb/gdbsupport/print-utils.h
> rename to gdbsupport/print-utils.h
> diff --git a/gdb/gdbsupport/ptid.c b/gdbsupport/ptid.c
> similarity index 100%
> rename from gdb/gdbsupport/ptid.c
> rename to gdbsupport/ptid.c
> diff --git a/gdb/gdbsupport/ptid.h b/gdbsupport/ptid.h
> similarity index 100%
> rename from gdb/gdbsupport/ptid.h
> rename to gdbsupport/ptid.h
> diff --git a/gdb/gdbsupport/refcounted-object.h b/gdbsupport/refcounted-object.h
> similarity index 100%
> rename from gdb/gdbsupport/refcounted-object.h
> rename to gdbsupport/refcounted-object.h
> diff --git a/gdb/gdbsupport/rsp-low.c b/gdbsupport/rsp-low.c
> similarity index 100%
> rename from gdb/gdbsupport/rsp-low.c
> rename to gdbsupport/rsp-low.c
> diff --git a/gdb/gdbsupport/rsp-low.h b/gdbsupport/rsp-low.h
> similarity index 100%
> rename from gdb/gdbsupport/rsp-low.h
> rename to gdbsupport/rsp-low.h
> diff --git a/gdb/gdbsupport/run-time-clock.c b/gdbsupport/run-time-clock.c
> similarity index 100%
> rename from gdb/gdbsupport/run-time-clock.c
> rename to gdbsupport/run-time-clock.c
> diff --git a/gdb/gdbsupport/run-time-clock.h b/gdbsupport/run-time-clock.h
> similarity index 100%
> rename from gdb/gdbsupport/run-time-clock.h
> rename to gdbsupport/run-time-clock.h
> diff --git a/gdb/gdbsupport/safe-iterator.h b/gdbsupport/safe-iterator.h
> similarity index 100%
> rename from gdb/gdbsupport/safe-iterator.h
> rename to gdbsupport/safe-iterator.h
> diff --git a/gdb/gdbsupport/safe-strerror.c b/gdbsupport/safe-strerror.c
> similarity index 100%
> rename from gdb/gdbsupport/safe-strerror.c
> rename to gdbsupport/safe-strerror.c
> diff --git a/gdb/gdbsupport/scope-exit.h b/gdbsupport/scope-exit.h
> similarity index 100%
> rename from gdb/gdbsupport/scope-exit.h
> rename to gdbsupport/scope-exit.h
> diff --git a/gdb/gdbsupport/scoped_fd.h b/gdbsupport/scoped_fd.h
> similarity index 100%
> rename from gdb/gdbsupport/scoped_fd.h
> rename to gdbsupport/scoped_fd.h
> diff --git a/gdb/gdbsupport/scoped_mmap.c b/gdbsupport/scoped_mmap.c
> similarity index 100%
> rename from gdb/gdbsupport/scoped_mmap.c
> rename to gdbsupport/scoped_mmap.c
> diff --git a/gdb/gdbsupport/scoped_mmap.h b/gdbsupport/scoped_mmap.h
> similarity index 100%
> rename from gdb/gdbsupport/scoped_mmap.h
> rename to gdbsupport/scoped_mmap.h
> diff --git a/gdb/gdbsupport/scoped_restore.h b/gdbsupport/scoped_restore.h
> similarity index 100%
> rename from gdb/gdbsupport/scoped_restore.h
> rename to gdbsupport/scoped_restore.h
> diff --git a/gdb/gdbsupport/selftest.c b/gdbsupport/selftest.c
> similarity index 100%
> rename from gdb/gdbsupport/selftest.c
> rename to gdbsupport/selftest.c
> diff --git a/gdb/gdbsupport/selftest.h b/gdbsupport/selftest.h
> similarity index 100%
> rename from gdb/gdbsupport/selftest.h
> rename to gdbsupport/selftest.h
> diff --git a/gdb/gdbsupport/signals-state-save-restore.c b/gdbsupport/signals-state-save-restore.c
> similarity index 100%
> rename from gdb/gdbsupport/signals-state-save-restore.c
> rename to gdbsupport/signals-state-save-restore.c
> diff --git a/gdb/gdbsupport/signals-state-save-restore.h b/gdbsupport/signals-state-save-restore.h
> similarity index 100%
> rename from gdb/gdbsupport/signals-state-save-restore.h
> rename to gdbsupport/signals-state-save-restore.h
> diff --git a/gdb/gdbsupport/signals.c b/gdbsupport/signals.c
> similarity index 100%
> rename from gdb/gdbsupport/signals.c
> rename to gdbsupport/signals.c
> diff --git a/gdb/gdbsupport/symbol.h b/gdbsupport/symbol.h
> similarity index 100%
> rename from gdb/gdbsupport/symbol.h
> rename to gdbsupport/symbol.h
> diff --git a/gdb/gdbsupport/tdesc.c b/gdbsupport/tdesc.c
> similarity index 100%
> rename from gdb/gdbsupport/tdesc.c
> rename to gdbsupport/tdesc.c
> diff --git a/gdb/gdbsupport/tdesc.h b/gdbsupport/tdesc.h
> similarity index 100%
> rename from gdb/gdbsupport/tdesc.h
> rename to gdbsupport/tdesc.h
> diff --git a/gdb/gdbsupport/thread-pool.c b/gdbsupport/thread-pool.c
> similarity index 100%
> rename from gdb/gdbsupport/thread-pool.c
> rename to gdbsupport/thread-pool.c
> diff --git a/gdb/gdbsupport/thread-pool.h b/gdbsupport/thread-pool.h
> similarity index 100%
> rename from gdb/gdbsupport/thread-pool.h
> rename to gdbsupport/thread-pool.h
> diff --git a/gdb/gdbsupport/traits.h b/gdbsupport/traits.h
> similarity index 100%
> rename from gdb/gdbsupport/traits.h
> rename to gdbsupport/traits.h
> diff --git a/gdb/gdbsupport/underlying.h b/gdbsupport/underlying.h
> similarity index 100%
> rename from gdb/gdbsupport/underlying.h
> rename to gdbsupport/underlying.h
> diff --git a/gdb/gdbsupport/valid-expr.h b/gdbsupport/valid-expr.h
> similarity index 100%
> rename from gdb/gdbsupport/valid-expr.h
> rename to gdbsupport/valid-expr.h
> diff --git a/gdb/gdbsupport/version.h b/gdbsupport/version.h
> similarity index 100%
> rename from gdb/gdbsupport/version.h
> rename to gdbsupport/version.h
> diff --git a/gdb/gdbsupport/x86-xstate.h b/gdbsupport/x86-xstate.h
> similarity index 100%
> rename from gdb/gdbsupport/x86-xstate.h
> rename to gdbsupport/x86-xstate.h
> diff --git a/gdb/gdbsupport/xml-utils.c b/gdbsupport/xml-utils.c
> similarity index 100%
> rename from gdb/gdbsupport/xml-utils.c
> rename to gdbsupport/xml-utils.c
> diff --git a/gdb/gdbsupport/xml-utils.h b/gdbsupport/xml-utils.h
> similarity index 100%
> rename from gdb/gdbsupport/xml-utils.h
> rename to gdbsupport/xml-utils.h
> diff --git a/src-release.sh b/src-release.sh
> index 275f0f24b5d..92e92ac5d77 100755
> --- a/src-release.sh
> +++ b/src-release.sh
> @@ -1,5 +1,5 @@
>  #!/usr/bin/env bash
> -#   Copyright (C) 1990-2018 Free Software Foundation
> +#   Copyright (C) 1990-2019 Free Software Foundation
>  #
>  # This file is free software; you can redistribute it and/or modify
>  # it under the terms of the GNU General Public License as published by
> @@ -315,7 +315,7 @@ gas_release()
>      tar_compress $package $tool "$GAS_SUPPORT_DIRS" "$compressors"
>  }
>
> -GDB_SUPPORT_DIRS="bfd include libiberty libctf opcodes readline sim intl libdecnumber cpu zlib contrib gnulib"
> +GDB_SUPPORT_DIRS="bfd include libiberty libctf opcodes readline sim intl libdecnumber cpu zlib contrib gnulib gdbsupport"
>  gdb_release()
>  {
>      compressors=$1
  
Tom Tromey Jan. 17, 2020, 6:01 p.m. UTC | #5
>>>>> "Christian" == Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> writes:

Christian> Since these files were moved anyway, this might be a good opportunity
Christian> to rename .c -> .cpp in gdbsupport? (Similar for when gdbserver will
Christian> be moved)

I wouldn't mind, though I tend to prefer .cc myself.

Anyone object to it?

Tom
  

Patch

diff --git a/ChangeLog b/ChangeLog
index 00a224473b5..9e3006cf5bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@ 
+2020-01-08  Tom Tromey  <tom@tromey.com>
+
+	* src-release.sh (GDB_SUPPORT_DIRS): Add gdbsupport.
+	* MAINTAINERS: Add gdbsupport.
+	* configure: Rebuild.
+	* configure.ac (configdirs): Add gdbsupport.
+	* gdbsupport: New directory, move from gdb/gdbsupport.
+	* Makefile.def (host_modules, dependencies): Add gnulib.
+	* Makefile.in: Rebuild.
+
 2020-01-09  Aaron Merey  <amerey@redhat.com>
 
         * config/debuginfod.m4: New file. Add macro AC_DEBUGINFOD. Adds
diff --git a/MAINTAINERS b/MAINTAINERS
index 4e04918dad8..805f2e3ac43 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -41,7 +41,7 @@  config.guess; config.sub; readline/support/config.{sub,guess}
 depcomp; mkinstalldirs
         Send bug reports and patches to bug-automake@gnu.org.
 
-gdb/; gnulib/; readline/; sim/; GDB's part of include/
+gdb/; gdbsupport/; gnulib/; readline/; sim/; GDB's part of include/
 	GDB: http://www.gnu.org/software/gdb/
 	Patches to gdb-patches@sourceware.org.
 	See also gdb/MAINTAINERS and sim/MAINTAINERS.
diff --git a/Makefile.def b/Makefile.def
index 311feb9de3b..079fd3e4f16 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -113,6 +113,7 @@  host_modules= { module= zlib; no_install=true; no_check=true;
 		bootstrap=true;
 	        extra_configure_flags='@extra_host_zlib_configure_flags@';};
 host_modules= { module= gnulib; };
+host_modules= { module= gdbsupport; };
 host_modules= { module= gdb; };
 host_modules= { module= expect; };
 host_modules= { module= guile; };
@@ -392,12 +393,14 @@  dependencies = { module=configure-gdb; on=all-intl; };
 dependencies = { module=configure-gdb; on=configure-sim; };
 dependencies = { module=configure-gdb; on=all-bfd; };
 dependencies = { module=configure-gdb; on=all-gnulib; };
+dependencies = { module=configure-gdb; on=all-gdbsupport; };
 // Depend on all-libiconv so that configure checks for iconv
 // functions will work.
 dependencies = { module=configure-gdb; on=all-libiconv; };
 dependencies = { module=all-gdb; on=all-libiberty; };
 dependencies = { module=all-gdb; on=all-libiconv; };
 dependencies = { module=all-gdb; on=all-gnulib; };
+dependencies = { module=all-gdb; on=all-gdbsupport; };
 dependencies = { module=all-gdb; on=all-opcodes; };
 dependencies = { module=all-gdb; on=all-readline; };
 dependencies = { module=all-gdb; on=all-build-bison; };
@@ -412,6 +415,10 @@  dependencies = { module=all-libgui; on=all-tcl; };
 dependencies = { module=all-libgui; on=all-tk; };
 dependencies = { module=all-libgui; on=all-itcl; };
 
+dependencies = { module=configure-gdbsupport; on=configure-bfd; };
+dependencies = { module=configure-gdbsupport; on=configure-gnulib; };
+dependencies = { module=all-gdbsupport; on=all-gnulib; };
+
 // Host modules specific to binutils.
 dependencies = { module=configure-bfd; on=configure-libiberty; hard=true; };
 dependencies = { module=configure-bfd; on=configure-intl; };
diff --git a/configure.ac b/configure.ac
index 544fab3d209..4bd869a63a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2730,12 +2730,12 @@  esac
 CONFIGURE_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-configure-/g`
 INSTALL_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-install-/g`
 
-# gdb depends on gnulib, but as nothing else does, only include it if
-# gdb is built.
+# gdb depends on gnulib and gdbsupport, but as nothing else does, only
+# include them if gdb is built.
 if echo " ${configdirs} " | grep " gdb " > /dev/null 2>&1 ; then
-  # The Makefile provides the ordering, so it's enough here to add
-  # gnulib to the list.
-  configdirs="${configdirs} gnulib"
+  # The Makefile provides the ordering, so it's enough here to add to
+  # the list.
+  configdirs="${configdirs} gnulib gdbsupport"
 fi
 
 # Strip out unwanted targets.
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 28f5c21242b..71d41d9f67f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,23 @@ 
+2020-01-08  Tom Tromey  <tom@tromey.com>
+
+	* nat/x86-linux-dregs.c: Include configh.h.
+	* nat/linux-ptrace.c: Include configh.h.
+	* nat/linux-btrace.c: Include configh.h.
+	* defs.h: Include config.h, bfd.h.
+	* configure.ac: Don't source common.host.
+	(CONFIG_OBS, CONFIG_SRCS): Remove gdbsupport files.
+	* configure: Rebuild.
+	* acinclude.m4: Update path.
+	* Makefile.in (SUPPORT, LIBSUPPORT, INCSUPPORT): New variables.
+	(CONFIG_SRC_SUBDIR): Remove gdbsupport.
+	(INTERNAL_CFLAGS_BASE): Add INCSUPPORT.
+	(CLIBS): Add LIBSUPPORT.
+	(CDEPS): Likewise.
+	(COMMON_SFILES): Remove gdbsupport files.
+	(HFILES_NO_SRCDIR): Likewise.
+	(stamp-version): Update path to create-version.sh.
+	(ALLDEPFILES): Remove gdbsupport files.
+
 2020-01-08  Tom Tromey  <tom@tromey.com>
 
 	* gdbsupport/common.m4 (GDB_AC_COMMON): Define WIN32APILIBS and
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 6df0f46b5ed..5f63c617d4f 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -238,6 +238,10 @@  GNULIB_BUILDDIR = ../gnulib
 LIBGNU = $(GNULIB_BUILDDIR)/import/libgnu.a
 INCGNU = -I$(srcdir)/../gnulib/import -I$(GNULIB_BUILDDIR)/import
 
+SUPPORT = ../gdbsupport
+LIBSUPPORT = $(SUPPORT)/libgdbsupport.a
+INCSUPPORT = -I$(srcdir)/.. -I..
+
 #
 # CLI sub directory definitons
 #
@@ -547,7 +551,7 @@  CONFIG_INSTALL = @CONFIG_INSTALL@
 CONFIG_UNINSTALL = @CONFIG_UNINSTALL@
 HAVE_NATIVE_GCORE_TARGET = @HAVE_NATIVE_GCORE_TARGET@
 
-CONFIG_SRC_SUBDIR = arch cli mi gdbsupport compile tui unittests guile python \
+CONFIG_SRC_SUBDIR = arch cli mi compile tui unittests guile python \
 	target nat
 CONFIG_DEP_SUBDIR = $(addsuffix /$(DEPDIR),$(CONFIG_SRC_SUBDIR))
 
@@ -586,8 +590,8 @@  INTERNAL_CFLAGS_BASE = \
 	$(CXXFLAGS) $(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) \
 	$(GDB_CFLAGS) $(OPCODES_CFLAGS) $(READLINE_CFLAGS) $(ZLIBINC) \
 	$(BFD_CFLAGS) $(INCLUDE_CFLAGS) $(LIBDECNUMBER_CFLAGS) \
-	$(INTL_CFLAGS) $(INCGNU) $(ENABLE_CFLAGS) $(INTERNAL_CPPFLAGS) \
-	$(SRCHIGH_CFLAGS) $(TOP_CFLAGS) $(PTHREAD_CFLAGS)
+	$(INTL_CFLAGS) $(INCGNU) $(INCSUPPORT) $(ENABLE_CFLAGS) \
+	$(INTERNAL_CPPFLAGS) $(SRCHIGH_CFLAGS) $(TOP_CFLAGS) $(PTHREAD_CFLAGS)
 INTERNAL_WARN_CFLAGS = $(INTERNAL_CFLAGS_BASE) $(GDB_WARN_CFLAGS)
 INTERNAL_CFLAGS = $(INTERNAL_WARN_CFLAGS) $(GDB_WERROR_CFLAGS)
 
@@ -607,14 +611,15 @@  INTERNAL_LDFLAGS = \
 # XM_CLIBS, defined in *config files, have host-dependent libs.
 # LIBIBERTY appears twice on purpose.
 CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(LIBCTF) $(ZLIB) \
-        $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \
+        $(LIBSUPPORT) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \
 	$(XM_CLIBS) $(GDBTKLIBS) \
 	@LIBS@ @GUILE_LIBS@ @PYTHON_LIBS@ \
 	$(LIBEXPAT) $(LIBLZMA) $(LIBBABELTRACE) $(LIBIPT) \
-	$(LIBIBERTY) $(WIN32LIBS) $(LIBGNU) $(LIBICONV) $(LIBMPFR) \
-	$(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS)
+	$(LIBIBERTY) $(WIN32LIBS) $(LIBGNU) $(LIBICONV) \
+	$(LIBMPFR) $(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS)
 CDEPS = $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) $(LIBCTF) \
-	$(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU)
+	$(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU) \
+	$(LIBSUPPORT)
 
 DIST = gdb
 
@@ -968,39 +973,6 @@  COMMON_SFILES = \
 	cli-out.c \
 	coff-pe-read.c \
 	coffread.c \
-	gdbsupport/agent.c \
-	gdbsupport/btrace-common.c \
-	gdbsupport/buffer.c \
-	gdbsupport/cleanups.c \
-	gdbsupport/common-debug.c \
-	gdbsupport/common-exceptions.c \
-	gdbsupport/common-inferior.c \
-	gdbsupport/common-regcache.c \
-	gdbsupport/common-utils.c \
-	gdbsupport/errors.c \
-	gdbsupport/environ.c \
-	gdbsupport/fileio.c \
-	gdbsupport/filestuff.c \
-	gdbsupport/format.c \
-	gdbsupport/job-control.c \
-	gdbsupport/gdb-dlfcn.c \
-	gdbsupport/gdb_tilde_expand.c \
-	gdbsupport/gdb_vecs.c \
-	gdbsupport/gdb_wait.c \
-	gdbsupport/netstuff.c \
-	gdbsupport/new-op.c \
-	gdbsupport/pathstuff.c \
-	gdbsupport/print-utils.c \
-	gdbsupport/ptid.c \
-	gdbsupport/rsp-low.c \
-	gdbsupport/run-time-clock.c \
-	gdbsupport/safe-strerror.c \
-	gdbsupport/scoped_mmap.c \
-	gdbsupport/signals.c \
-	gdbsupport/signals-state-save-restore.c \
-	gdbsupport/tdesc.c \
-	gdbsupport/thread-pool.c \
-	gdbsupport/xml-utils.c \
 	complaints.c \
 	completer.c \
 	continuations.c \
@@ -1468,49 +1440,6 @@  HFILES_NO_SRCDIR = \
 	cli/cli-setshow.h \
 	cli/cli-style.h \
 	cli/cli-utils.h \
-	gdbsupport/buffer.h \
-	gdbsupport/cleanups.h \
-	gdbsupport/common-debug.h \
-	gdbsupport/common-defs.h \
-	gdbsupport/common-exceptions.h \
-	gdbsupport/common-gdbthread.h \
-	gdbsupport/common-regcache.h \
-	gdbsupport/common-types.h \
-	gdbsupport/common-utils.h \
-	gdbsupport/job-control.h \
-	gdbsupport/errors.h \
-	gdbsupport/environ.h \
-	gdbsupport/fileio.h \
-	gdbsupport/format.h \
-	gdbsupport/gdb-dlfcn.h \
-	gdbsupport/gdb-sigmask.h \
-	gdbsupport/gdb_assert.h \
-	gdbsupport/gdb_binary_search.h \
-	gdbsupport/gdb_tilde_expand.h \
-	gdbsupport/gdb_locale.h \
-	gdbsupport/gdb_proc_service.h \
-	gdbsupport/gdb_setjmp.h \
-	gdbsupport/gdb_signals.h \
-	gdbsupport/gdb_sys_time.h \
-	gdbsupport/gdb_vecs.h \
-	gdbsupport/gdb_wait.h \
-	gdbsupport/common-inferior.h \
-	gdbsupport/netstuff.h \
-	gdbsupport/host-defs.h \
-	gdbsupport/parallel-for.h \
-	gdbsupport/pathstuff.h \
-	gdbsupport/print-utils.h \
-	gdbsupport/ptid.h \
-	gdbsupport/queue.h \
-	gdbsupport/rsp-low.h \
-	gdbsupport/run-time-clock.h \
-	gdbsupport/signals-state-save-restore.h \
-	gdbsupport/symbol.h \
-	gdbsupport/tdesc.h \
-	gdbsupport/thread-pool.h \
-	gdbsupport/version.h \
-	gdbsupport/x86-xstate.h \
-	gdbsupport/xml-utils.h \
 	compile/compile.h \
 	compile/compile-c.h \
 	compile/compile-cplus.h \
@@ -2131,8 +2060,8 @@  $(srcdir)/copying.c: @MAINTAINER_MODE_TRUE@ $(srcdir)/../COPYING3 $(srcdir)/copy
 version.c: stamp-version; @true
 # Note that the obvious names for the temp file are taken by
 # create-version.sh.
-stamp-version: Makefile version.in $(srcdir)/../bfd/version.h $(srcdir)/gdbsupport/create-version.sh
-	$(ECHO_GEN) $(SHELL) $(srcdir)/gdbsupport/create-version.sh $(srcdir) \
+stamp-version: Makefile version.in $(srcdir)/../bfd/version.h $(srcdir)/../gdbsupport/create-version.sh
+	$(ECHO_GEN) $(SHELL) $(srcdir)/../gdbsupport/create-version.sh $(srcdir) \
 	    $(host_alias) $(target_alias) version-t.t
 	@$(SHELL) $(srcdir)/../move-if-change version-t.t version.c
 	@echo stamp > stamp-version
diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index 11cc0bc2417..d60b2fe19c1 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -63,7 +63,7 @@  m4_include([../config/iconv.m4])
 
 m4_include([../config/zlib.m4])
 
-m4_include([gdbsupport/common.m4])
+m4_include([../gdbsupport/common.m4])
 
 dnl For libiberty_INIT.
 m4_include(libiberty.m4)
diff --git a/gdb/configure.ac b/gdb/configure.ac
index a7b744bf241..ddb9530afd0 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -2215,8 +2215,8 @@  AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "UTF-8",
           [Define to be a string naming the default host character set.])
 
 GDB_AC_SELFTEST([
-  CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_UNITTESTS_OBS) gdbsupport/selftest.o selftest-arch.o"
-  CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_UNITTESTS_SRCS) gdbsupport/selftest.c selftest-arch.c"
+  CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_UNITTESTS_OBS) selftest-arch.o"
+  CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_UNITTESTS_SRCS) selftest-arch.c"
 ])
 
 GDB_AC_TRANSFORM([gdb], [GDB_TRANSFORM_NAME])
diff --git a/gdb/defs.h b/gdb/defs.h
index 567f214b81d..1ad52feb1f8 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -27,6 +27,15 @@ 
 
 #include "gdbsupport/common-defs.h"
 
+#undef PACKAGE
+#undef PACKAGE_NAME
+#undef PACKAGE_VERSION
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+
+#include <config.h>
+#include "bfd.h"
+
 #include <sys/types.h>
 #include <limits.h>
 
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index c3b547528d0..22d10bec484 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,16 @@ 
+2020-01-08  Tom Tromey  <tom@tromey.com>
+
+	* server.h: Include config.h.
+	* gdbreplay.c: Include config.h.
+	* configure: Rebuild.
+	* configure.ac: Don't source common.host.
+	* acinclude.m4: Update path.
+	* Makefile.in (INCSUPPORT): New variable.
+	(INCLUDE_CFLAGS): Add INCSUPPORT.
+	(SFILES): Update paths.
+	(version-generated.c): Update path to create-version.sh.
+	(gdbsupport/%-ipa.o, gdbsupport/%.o): Update paths.
+
 2020-01-08  Tom Tromey  <tom@tromey.com>
 
 	* configure.ac (LIBS): Use WIN32APILIBS.
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 1125426778b..9640a2a4447 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -109,6 +109,8 @@  INCGNU = -I$(srcdir)/../../gnulib/import -I$(GNULIB_BUILDDIR)/import
 # so that they are generated before other files are compiled.
 GNULIB_H = $(GNULIB_BUILDDIR)/import/string.h @GNULIB_STDINT_H@
 
+INCSUPPORT = -I$(srcdir)/../.. -I../..
+
 # All the includes used for CFLAGS and for lint.
 # -I. for config files.
 # -I${srcdir} for our headers.
@@ -120,7 +122,7 @@  GNULIB_H = $(GNULIB_BUILDDIR)/import/string.h @GNULIB_STDINT_H@
 #
 INCLUDE_CFLAGS = -I. -I${srcdir} \
 	-I$(srcdir)/../regformats -I$(srcdir)/.. -I$(INCLUDE_DIR) \
-	$(INCGNU)
+	$(INCGNU) $(INCSUPPORT)
 
 # M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS
 # from the config/ directory.
@@ -201,32 +203,32 @@  SFILES = \
 	$(srcdir)/arch/arm-linux.c \
 	$(srcdir)/arch/ppc-linux-common.c \
 	$(srcdir)/../alloc.c \
-	$(srcdir)/gdbsupport/btrace-common.c \
-	$(srcdir)/gdbsupport/buffer.c \
-	$(srcdir)/gdbsupport/cleanups.c \
-	$(srcdir)/gdbsupport/common-debug.c \
-	$(srcdir)/gdbsupport/common-exceptions.c \
-	$(srcdir)/gdbsupport/common-inferior.c \
-	$(srcdir)/gdbsupport/common-regcache.c \
-	$(srcdir)/gdbsupport/common-utils.c \
-	$(srcdir)/gdbsupport/errors.c \
-	$(srcdir)/gdbsupport/environ.c \
-	$(srcdir)/gdbsupport/fileio.c \
-	$(srcdir)/gdbsupport/filestuff.c \
-	$(srcdir)/gdbsupport/job-control.c \
-	$(srcdir)/gdbsupport/gdb-dlfcn.c \
-	$(srcdir)/gdbsupport/gdb_tilde_expand.c \
-	$(srcdir)/gdbsupport/gdb_vecs.c \
-	$(srcdir)/gdbsupport/gdb_wait.c \
-	$(srcdir)/gdbsupport/netstuff.c \
-	$(srcdir)/gdbsupport/new-op.c \
-	$(srcdir)/gdbsupport/pathstuff.c \
-	$(srcdir)/gdbsupport/print-utils.c \
-	$(srcdir)/gdbsupport/ptid.c \
-	$(srcdir)/gdbsupport/rsp-low.c \
-	$(srcdir)/gdbsupport/safe-strerror.c \
-	$(srcdir)/gdbsupport/tdesc.c \
-	$(srcdir)/gdbsupport/xml-utils.c \
+	$(srcdir)/../../gdbsupport/btrace-common.c \
+	$(srcdir)/../../gdbsupport/buffer.c \
+	$(srcdir)/../../gdbsupport/cleanups.c \
+	$(srcdir)/../../gdbsupport/common-debug.c \
+	$(srcdir)/../../gdbsupport/common-exceptions.c \
+	$(srcdir)/../../gdbsupport/common-inferior.c \
+	$(srcdir)/../../gdbsupport/common-regcache.c \
+	$(srcdir)/../../gdbsupport/common-utils.c \
+	$(srcdir)/../../gdbsupport/errors.c \
+	$(srcdir)/../../gdbsupport/environ.c \
+	$(srcdir)/../../gdbsupport/fileio.c \
+	$(srcdir)/../../gdbsupport/filestuff.c \
+	$(srcdir)/../../gdbsupport/job-control.c \
+	$(srcdir)/../../gdbsupport/gdb-dlfcn.c \
+	$(srcdir)/../../gdbsupport/gdb_tilde_expand.c \
+	$(srcdir)/../../gdbsupport/gdb_vecs.c \
+	$(srcdir)/../../gdbsupport/gdb_wait.c \
+	$(srcdir)/../../gdbsupport/netstuff.c \
+	$(srcdir)/../../gdbsupport/new-op.c \
+	$(srcdir)/../../gdbsupport/pathstuff.c \
+	$(srcdir)/../../gdbsupport/print-utils.c \
+	$(srcdir)/../../gdbsupport/ptid.c \
+	$(srcdir)/../../gdbsupport/rsp-low.c \
+	$(srcdir)/../../gdbsupport/safe-strerror.c \
+	$(srcdir)/../../gdbsupport/tdesc.c \
+	$(srcdir)/../../gdbsupport/xml-utils.c \
 	$(srcdir)/nat/aarch64-sve-linux-ptrace.c \
 	$(srcdir)/nat/linux-btrace.c \
 	$(srcdir)/nat/linux-namespaces.c \
@@ -529,8 +531,8 @@  am--refresh:
 
 force:
 
-version-generated.c: Makefile $(srcdir)/../version.in $(srcdir)/../../bfd/version.h $(srcdir)/../gdbsupport/create-version.sh
-	$(ECHO_GEN) $(SHELL) $(srcdir)/../gdbsupport/create-version.sh $(srcdir)/.. \
+version-generated.c: Makefile $(srcdir)/../version.in $(srcdir)/../../bfd/version.h $(srcdir)/../../gdbsupport/create-version.sh
+	$(ECHO_GEN) $(SHELL) $(srcdir)/../../gdbsupport/create-version.sh $(srcdir)/.. \
 		$(host_alias) $(target_alias) $@
 
 xml-builtin-generated.c: stamp-xml; @true
@@ -588,7 +590,7 @@  arch/%-ipa.o: ../arch/%.c
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)
 
-gdbsupport/%-ipa.o: ../gdbsupport/%.c
+gdbsupport/%-ipa.o: ../../gdbsupport/%.c
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)
 
@@ -621,7 +623,7 @@  arch/%.o: ../arch/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-gdbsupport/%.o: ../gdbsupport/%.c
+gdbsupport/%.o: ../../gdbsupport/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
diff --git a/gdb/gdbserver/acinclude.m4 b/gdb/gdbserver/acinclude.m4
index 4c18e9b01db..a42f2d5e74a 100644
--- a/gdb/gdbserver/acinclude.m4
+++ b/gdb/gdbserver/acinclude.m4
@@ -18,7 +18,7 @@  m4_include(../../config/lead-dot.m4)
 dnl codeset.m4 is needed for common.m4, but not for
 dnl anything else in gdbserver.
 m4_include(../../config/codeset.m4)
-m4_include(../gdbsupport/common.m4)
+m4_include(../../gdbsupport/common.m4)
 
 dnl For libiberty_INIT.
 m4_include(../libiberty.m4)
diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c
index 3ed18f1f372..263fb0efeac 100644
--- a/gdb/gdbserver/gdbreplay.c
+++ b/gdb/gdbserver/gdbreplay.c
@@ -18,6 +18,14 @@ 
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "gdbsupport/common-defs.h"
+
+#undef PACKAGE
+#undef PACKAGE_NAME
+#undef PACKAGE_VERSION
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+
+#include <config.h>
 #include "gdbsupport/version.h"
 
 #if HAVE_SYS_FILE_H
diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index 0c74f99a161..3c286862349 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -21,6 +21,14 @@ 
 
 #include "gdbsupport/common-defs.h"
 
+#undef PACKAGE
+#undef PACKAGE_NAME
+#undef PACKAGE_VERSION
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+
+#include <config.h>
+
 gdb_static_assert (sizeof (CORE_ADDR) >= sizeof (void *));
 
 #ifdef __MINGW32CE__
diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c
index 03fc85e2ece..3a3cd8d235d 100644
--- a/gdb/nat/linux-btrace.c
+++ b/gdb/nat/linux-btrace.c
@@ -20,6 +20,14 @@ 
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "gdbsupport/common-defs.h"
+
+#undef PACKAGE
+#undef PACKAGE_NAME
+#undef PACKAGE_VERSION
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+
+#include <config.h>
 #include "linux-btrace.h"
 #include "gdbsupport/common-regcache.h"
 #include "gdbsupport/gdb_wait.h"
diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c
index 5335d690922..859feb7ca87 100644
--- a/gdb/nat/linux-ptrace.c
+++ b/gdb/nat/linux-ptrace.c
@@ -17,6 +17,14 @@ 
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "gdbsupport/common-defs.h"
+
+#undef PACKAGE
+#undef PACKAGE_NAME
+#undef PACKAGE_VERSION
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+
+#include <config.h>
 #include "linux-ptrace.h"
 #include "linux-procfs.h"
 #include "linux-waitpid.h"
diff --git a/gdb/nat/x86-linux-dregs.c b/gdb/nat/x86-linux-dregs.c
index b5dd71e3c7c..31683aab17c 100644
--- a/gdb/nat/x86-linux-dregs.c
+++ b/gdb/nat/x86-linux-dregs.c
@@ -18,6 +18,14 @@ 
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "gdbsupport/common-defs.h"
+
+#undef PACKAGE
+#undef PACKAGE_NAME
+#undef PACKAGE_VERSION
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+
+#include <config.h>
 #include "nat/gdb_ptrace.h"
 #include <sys/user.h>
 #include "target/waitstatus.h"
diff --git a/gdbsupport/ChangeLog b/gdbsupport/ChangeLog
new file mode 100644
index 00000000000..727b919bb08
--- /dev/null
+++ b/gdbsupport/ChangeLog
@@ -0,0 +1,7 @@ 
+2020-01-08  Tom Tromey  <tom@tromey.com>
+
+	* common-defs.h: Add GDBSERVER case.  Update includes.
+	* acinclude.m4, aclocal.m4, config.in, configure, configure.ac,
+	Makefile.am, Makefile.in, README: New files.
+	* Moved from ../gdb/gdbsupport/
+
diff --git a/gdbsupport/Makefile.am b/gdbsupport/Makefile.am
new file mode 100644
index 00000000000..48e6079fb9f
--- /dev/null
+++ b/gdbsupport/Makefile.am
@@ -0,0 +1,70 @@ 
+## Process this file with automake to generate Makefile.in
+#
+#   Copyright (C) 2020 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+#
+
+AUTOMAKE_OPTIONS = no-dist foreign
+ACLOCAL_AMFLAGS = -I . -I ../config
+
+AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir)/../gdb \
+    -I../gnulib/import -I$(srcdir)/../gnulib/import \
+    -I.. -I$(srcdir)/.. $(INCINTL) -I../bfd -I$(srcdir)/../bfd
+
+override CC := $(CXX)
+override CFLAGS := $(CXXFLAGS)
+
+noinst_LIBRARIES = libgdbsupport.a
+
+if SELFTEST
+selftest = selftest.c
+endif
+
+libgdbsupport_a_SOURCES = \
+    agent.c \
+    btrace-common.c \
+    buffer.c \
+    cleanups.c \
+    common-debug.c \
+    common-exceptions.c	\
+    common-inferior.c \
+    common-regcache.c \
+    common-utils.c \
+    environ.c \
+    errors.c \
+    fileio.c \
+    filestuff.c	\
+    format.c \
+    gdb-dlfcn.c	\
+    gdb_tilde_expand.c \
+    gdb_wait.c \
+    gdb_vecs.c \
+    job-control.c \
+    netstuff.c \
+    new-op.c \
+    pathstuff.c	\
+    print-utils.c \
+    ptid.c \
+    rsp-low.c \
+    run-time-clock.c \
+    safe-strerror.c \
+    scoped_mmap.c \
+    signals.c \
+    signals-state-save-restore.c \
+    tdesc.c \
+    thread-pool.c \
+    xml-utils.c	\
+    $(selftest)
diff --git a/gdbsupport/README b/gdbsupport/README
new file mode 100644
index 00000000000..257dcea5af9
--- /dev/null
+++ b/gdbsupport/README
@@ -0,0 +1,4 @@ 
+This is a helper library that is used by gdb and gdbserver.
+
+To send patches, follow the gdb patch submission instructions in
+../gdb/CONTRIBUTE.  For maintainers, see ../gdb/MAINTAINERS.
diff --git a/gdbsupport/acinclude.m4 b/gdbsupport/acinclude.m4
new file mode 100644
index 00000000000..6e20e9cdb0a
--- /dev/null
+++ b/gdbsupport/acinclude.m4
@@ -0,0 +1,5 @@ 
+m4_include([common.m4])
+m4_include([../config/ax_pthread.m4])
+m4_include([../gdb/ax_cxx_compile_stdcxx.m4])
+m4_include([../gdb/libiberty.m4])
+m4_include([../gdb/selftest.m4])
diff --git a/gdb/gdbsupport/agent.c b/gdbsupport/agent.c
similarity index 100%
rename from gdb/gdbsupport/agent.c
rename to gdbsupport/agent.c
diff --git a/gdb/gdbsupport/agent.h b/gdbsupport/agent.h
similarity index 100%
rename from gdb/gdbsupport/agent.h
rename to gdbsupport/agent.h
diff --git a/gdb/gdbsupport/alt-stack.h b/gdbsupport/alt-stack.h
similarity index 100%
rename from gdb/gdbsupport/alt-stack.h
rename to gdbsupport/alt-stack.h
diff --git a/gdb/gdbsupport/array-view.h b/gdbsupport/array-view.h
similarity index 100%
rename from gdb/gdbsupport/array-view.h
rename to gdbsupport/array-view.h
diff --git a/gdb/gdbsupport/ax.def b/gdbsupport/ax.def
similarity index 100%
rename from gdb/gdbsupport/ax.def
rename to gdbsupport/ax.def
diff --git a/gdb/gdbsupport/block-signals.h b/gdbsupport/block-signals.h
similarity index 100%
rename from gdb/gdbsupport/block-signals.h
rename to gdbsupport/block-signals.h
diff --git a/gdb/gdbsupport/break-common.h b/gdbsupport/break-common.h
similarity index 100%
rename from gdb/gdbsupport/break-common.h
rename to gdbsupport/break-common.h
diff --git a/gdb/gdbsupport/btrace-common.c b/gdbsupport/btrace-common.c
similarity index 100%
rename from gdb/gdbsupport/btrace-common.c
rename to gdbsupport/btrace-common.c
diff --git a/gdb/gdbsupport/btrace-common.h b/gdbsupport/btrace-common.h
similarity index 100%
rename from gdb/gdbsupport/btrace-common.h
rename to gdbsupport/btrace-common.h
diff --git a/gdb/gdbsupport/buffer.c b/gdbsupport/buffer.c
similarity index 100%
rename from gdb/gdbsupport/buffer.c
rename to gdbsupport/buffer.c
diff --git a/gdb/gdbsupport/buffer.h b/gdbsupport/buffer.h
similarity index 100%
rename from gdb/gdbsupport/buffer.h
rename to gdbsupport/buffer.h
diff --git a/gdb/gdbsupport/byte-vector.h b/gdbsupport/byte-vector.h
similarity index 100%
rename from gdb/gdbsupport/byte-vector.h
rename to gdbsupport/byte-vector.h
diff --git a/gdb/gdbsupport/cleanups.c b/gdbsupport/cleanups.c
similarity index 100%
rename from gdb/gdbsupport/cleanups.c
rename to gdbsupport/cleanups.c
diff --git a/gdb/gdbsupport/cleanups.h b/gdbsupport/cleanups.h
similarity index 100%
rename from gdb/gdbsupport/cleanups.h
rename to gdbsupport/cleanups.h
diff --git a/gdb/gdbsupport/common-debug.c b/gdbsupport/common-debug.c
similarity index 100%
rename from gdb/gdbsupport/common-debug.c
rename to gdbsupport/common-debug.c
diff --git a/gdb/gdbsupport/common-debug.h b/gdbsupport/common-debug.h
similarity index 100%
rename from gdb/gdbsupport/common-debug.h
rename to gdbsupport/common-debug.h
diff --git a/gdb/gdbsupport/common-defs.h b/gdbsupport/common-defs.h
similarity index 95%
rename from gdb/gdbsupport/common-defs.h
rename to gdbsupport/common-defs.h
index 214bca1ee17..d823c41607c 100644
--- a/gdb/gdbsupport/common-defs.h
+++ b/gdbsupport/common-defs.h
@@ -20,24 +20,32 @@ 
 #ifndef COMMON_COMMON_DEFS_H
 #define COMMON_COMMON_DEFS_H
 
-#include "config.h"
+#ifdef GDBSERVER
+
+#include <build-gnulib-gdbserver/config.h>
 
 #undef PACKAGE_NAME
+#undef PACKAGE
 #undef PACKAGE_VERSION
 #undef PACKAGE_STRING
 #undef PACKAGE_TARNAME
 
-#ifdef GDBSERVER
-#include "build-gnulib-gdbserver/config.h"
-#else
-#include "../../gnulib/config.h"
-#endif
+#include <config.h>
+
+#else  /* GDBSERVER */
+
+#include <gdbsupport/support-config.h>
 
 #undef PACKAGE_NAME
+#undef PACKAGE
 #undef PACKAGE_VERSION
 #undef PACKAGE_STRING
 #undef PACKAGE_TARNAME
 
+#include "gnulib/config.h"
+
+#endif	/* GDBSERVER */
+
 /* From:
     https://www.gnu.org/software/gnulib/manual/html_node/stdint_002eh.html
 
diff --git a/gdb/gdbsupport/common-exceptions.c b/gdbsupport/common-exceptions.c
similarity index 100%
rename from gdb/gdbsupport/common-exceptions.c
rename to gdbsupport/common-exceptions.c
diff --git a/gdb/gdbsupport/common-exceptions.h b/gdbsupport/common-exceptions.h
similarity index 100%
rename from gdb/gdbsupport/common-exceptions.h
rename to gdbsupport/common-exceptions.h
diff --git a/gdb/gdbsupport/common-gdbthread.h b/gdbsupport/common-gdbthread.h
similarity index 100%
rename from gdb/gdbsupport/common-gdbthread.h
rename to gdbsupport/common-gdbthread.h
diff --git a/gdb/gdbsupport/common-inferior.c b/gdbsupport/common-inferior.c
similarity index 100%
rename from gdb/gdbsupport/common-inferior.c
rename to gdbsupport/common-inferior.c
diff --git a/gdb/gdbsupport/common-inferior.h b/gdbsupport/common-inferior.h
similarity index 100%
rename from gdb/gdbsupport/common-inferior.h
rename to gdbsupport/common-inferior.h
diff --git a/gdb/gdbsupport/common-regcache.c b/gdbsupport/common-regcache.c
similarity index 100%
rename from gdb/gdbsupport/common-regcache.c
rename to gdbsupport/common-regcache.c
diff --git a/gdb/gdbsupport/common-regcache.h b/gdbsupport/common-regcache.h
similarity index 100%
rename from gdb/gdbsupport/common-regcache.h
rename to gdbsupport/common-regcache.h
diff --git a/gdb/gdbsupport/common-types.h b/gdbsupport/common-types.h
similarity index 100%
rename from gdb/gdbsupport/common-types.h
rename to gdbsupport/common-types.h
diff --git a/gdb/gdbsupport/common-utils.c b/gdbsupport/common-utils.c
similarity index 100%
rename from gdb/gdbsupport/common-utils.c
rename to gdbsupport/common-utils.c
diff --git a/gdb/gdbsupport/common-utils.h b/gdbsupport/common-utils.h
similarity index 100%
rename from gdb/gdbsupport/common-utils.h
rename to gdbsupport/common-utils.h
diff --git a/gdb/gdbsupport/common.m4 b/gdbsupport/common.m4
similarity index 100%
rename from gdb/gdbsupport/common.m4
rename to gdbsupport/common.m4
diff --git a/gdbsupport/configure.ac b/gdbsupport/configure.ac
new file mode 100644
index 00000000000..1dfed3cdc51
--- /dev/null
+++ b/gdbsupport/configure.ac
@@ -0,0 +1,63 @@ 
+dnl Autoconf configure script for GDB support library
+dnl Copyright (C) 2020 Free Software Foundation, Inc.
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+dnl Process this file with autoconf to produce a configure script.
+
+AC_INIT([gdbsupport], 1.0)
+AC_CONFIG_SRCDIR(common-defs.h)
+AC_CONFIG_HEADER(support-config.h:config.in)
+AC_CANONICAL_SYSTEM
+AM_MAINTAINER_MODE
+AC_CONFIG_AUX_DIR(..)
+AM_INIT_AUTOMAKE
+AM_SILENT_RULES([yes])
+
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_RANLIB
+
+AC_USE_SYSTEM_EXTENSIONS
+ACX_LARGEFILE
+AM_PROG_CC_STDC
+
+# We require a C++11 compiler.  Check if one is available, and if
+# necessary, set CXX_DIALECT to some -std=xxx switch.
+AX_CXX_COMPILE_STDCXX(11, , mandatory)
+
+dnl Set up for gettext.
+ZW_GNU_GETTEXT_SISTER_DIR
+
+libiberty_INIT
+GDB_AC_COMMON
+GDB_AC_SELFTEST
+AM_CONDITIONAL(SELFTEST, $enable_unittests)
+
+TARGET_WORD_SIZE=`sed -n 's,#define BFD_ARCH_SIZE \(.*\)$,\1,p' ../bfd/bfd-in3.h`
+AC_DEFINE_UNQUOTED(TARGET_WORD_SIZE, $TARGET_WORD_SIZE,
+   [Define to the word size for the target.])
+
+case ${host} in
+  *mingw32*)
+    AC_DEFINE(USE_WIN32API, 1,
+              [Define if we should use the Windows API, instead of the
+	       POSIX API.  On Windows, we use the Windows API when
+	       building for MinGW, but the POSIX API when building
+	       for Cygwin.])
+    ;;
+esac
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/gdb/gdbsupport/create-version.sh b/gdbsupport/create-version.sh
similarity index 100%
rename from gdb/gdbsupport/create-version.sh
rename to gdbsupport/create-version.sh
diff --git a/gdb/gdbsupport/def-vector.h b/gdbsupport/def-vector.h
similarity index 100%
rename from gdb/gdbsupport/def-vector.h
rename to gdbsupport/def-vector.h
diff --git a/gdb/gdbsupport/default-init-alloc.h b/gdbsupport/default-init-alloc.h
similarity index 100%
rename from gdb/gdbsupport/default-init-alloc.h
rename to gdbsupport/default-init-alloc.h
diff --git a/gdb/gdbsupport/enum-flags.h b/gdbsupport/enum-flags.h
similarity index 100%
rename from gdb/gdbsupport/enum-flags.h
rename to gdbsupport/enum-flags.h
diff --git a/gdb/gdbsupport/environ.c b/gdbsupport/environ.c
similarity index 100%
rename from gdb/gdbsupport/environ.c
rename to gdbsupport/environ.c
diff --git a/gdb/gdbsupport/environ.h b/gdbsupport/environ.h
similarity index 100%
rename from gdb/gdbsupport/environ.h
rename to gdbsupport/environ.h
diff --git a/gdb/gdbsupport/errors.c b/gdbsupport/errors.c
similarity index 100%
rename from gdb/gdbsupport/errors.c
rename to gdbsupport/errors.c
diff --git a/gdb/gdbsupport/errors.h b/gdbsupport/errors.h
similarity index 100%
rename from gdb/gdbsupport/errors.h
rename to gdbsupport/errors.h
diff --git a/gdb/gdbsupport/fileio.c b/gdbsupport/fileio.c
similarity index 100%
rename from gdb/gdbsupport/fileio.c
rename to gdbsupport/fileio.c
diff --git a/gdb/gdbsupport/fileio.h b/gdbsupport/fileio.h
similarity index 100%
rename from gdb/gdbsupport/fileio.h
rename to gdbsupport/fileio.h
diff --git a/gdb/gdbsupport/filestuff.c b/gdbsupport/filestuff.c
similarity index 100%
rename from gdb/gdbsupport/filestuff.c
rename to gdbsupport/filestuff.c
diff --git a/gdb/gdbsupport/filestuff.h b/gdbsupport/filestuff.h
similarity index 100%
rename from gdb/gdbsupport/filestuff.h
rename to gdbsupport/filestuff.h
diff --git a/gdb/gdbsupport/filtered-iterator.h b/gdbsupport/filtered-iterator.h
similarity index 100%
rename from gdb/gdbsupport/filtered-iterator.h
rename to gdbsupport/filtered-iterator.h
diff --git a/gdb/gdbsupport/format.c b/gdbsupport/format.c
similarity index 100%
rename from gdb/gdbsupport/format.c
rename to gdbsupport/format.c
diff --git a/gdb/gdbsupport/format.h b/gdbsupport/format.h
similarity index 100%
rename from gdb/gdbsupport/format.h
rename to gdbsupport/format.h
diff --git a/gdb/gdbsupport/forward-scope-exit.h b/gdbsupport/forward-scope-exit.h
similarity index 100%
rename from gdb/gdbsupport/forward-scope-exit.h
rename to gdbsupport/forward-scope-exit.h
diff --git a/gdb/gdbsupport/function-view.h b/gdbsupport/function-view.h
similarity index 100%
rename from gdb/gdbsupport/function-view.h
rename to gdbsupport/function-view.h
diff --git a/gdb/gdbsupport/gdb-dlfcn.c b/gdbsupport/gdb-dlfcn.c
similarity index 100%
rename from gdb/gdbsupport/gdb-dlfcn.c
rename to gdbsupport/gdb-dlfcn.c
diff --git a/gdb/gdbsupport/gdb-dlfcn.h b/gdbsupport/gdb-dlfcn.h
similarity index 100%
rename from gdb/gdbsupport/gdb-dlfcn.h
rename to gdbsupport/gdb-dlfcn.h
diff --git a/gdb/gdbsupport/gdb-sigmask.h b/gdbsupport/gdb-sigmask.h
similarity index 100%
rename from gdb/gdbsupport/gdb-sigmask.h
rename to gdbsupport/gdb-sigmask.h
diff --git a/gdb/gdbsupport/gdb_assert.h b/gdbsupport/gdb_assert.h
similarity index 100%
rename from gdb/gdbsupport/gdb_assert.h
rename to gdbsupport/gdb_assert.h
diff --git a/gdb/gdbsupport/gdb_binary_search.h b/gdbsupport/gdb_binary_search.h
similarity index 100%
rename from gdb/gdbsupport/gdb_binary_search.h
rename to gdbsupport/gdb_binary_search.h
diff --git a/gdb/gdbsupport/gdb_locale.h b/gdbsupport/gdb_locale.h
similarity index 100%
rename from gdb/gdbsupport/gdb_locale.h
rename to gdbsupport/gdb_locale.h
diff --git a/gdb/gdbsupport/gdb_optional.h b/gdbsupport/gdb_optional.h
similarity index 100%
rename from gdb/gdbsupport/gdb_optional.h
rename to gdbsupport/gdb_optional.h
diff --git a/gdb/gdbsupport/gdb_proc_service.h b/gdbsupport/gdb_proc_service.h
similarity index 100%
rename from gdb/gdbsupport/gdb_proc_service.h
rename to gdbsupport/gdb_proc_service.h
diff --git a/gdb/gdbsupport/gdb_ref_ptr.h b/gdbsupport/gdb_ref_ptr.h
similarity index 100%
rename from gdb/gdbsupport/gdb_ref_ptr.h
rename to gdbsupport/gdb_ref_ptr.h
diff --git a/gdb/gdbsupport/gdb_setjmp.h b/gdbsupport/gdb_setjmp.h
similarity index 100%
rename from gdb/gdbsupport/gdb_setjmp.h
rename to gdbsupport/gdb_setjmp.h
diff --git a/gdb/gdbsupport/gdb_signals.h b/gdbsupport/gdb_signals.h
similarity index 100%
rename from gdb/gdbsupport/gdb_signals.h
rename to gdbsupport/gdb_signals.h
diff --git a/gdb/gdbsupport/gdb_splay_tree.h b/gdbsupport/gdb_splay_tree.h
similarity index 100%
rename from gdb/gdbsupport/gdb_splay_tree.h
rename to gdbsupport/gdb_splay_tree.h
diff --git a/gdb/gdbsupport/gdb_string_view.h b/gdbsupport/gdb_string_view.h
similarity index 100%
rename from gdb/gdbsupport/gdb_string_view.h
rename to gdbsupport/gdb_string_view.h
diff --git a/gdb/gdbsupport/gdb_string_view.tcc b/gdbsupport/gdb_string_view.tcc
similarity index 100%
rename from gdb/gdbsupport/gdb_string_view.tcc
rename to gdbsupport/gdb_string_view.tcc
diff --git a/gdb/gdbsupport/gdb_sys_time.h b/gdbsupport/gdb_sys_time.h
similarity index 100%
rename from gdb/gdbsupport/gdb_sys_time.h
rename to gdbsupport/gdb_sys_time.h
diff --git a/gdb/gdbsupport/gdb_tilde_expand.c b/gdbsupport/gdb_tilde_expand.c
similarity index 100%
rename from gdb/gdbsupport/gdb_tilde_expand.c
rename to gdbsupport/gdb_tilde_expand.c
diff --git a/gdb/gdbsupport/gdb_tilde_expand.h b/gdbsupport/gdb_tilde_expand.h
similarity index 100%
rename from gdb/gdbsupport/gdb_tilde_expand.h
rename to gdbsupport/gdb_tilde_expand.h
diff --git a/gdb/gdbsupport/gdb_unique_ptr.h b/gdbsupport/gdb_unique_ptr.h
similarity index 100%
rename from gdb/gdbsupport/gdb_unique_ptr.h
rename to gdbsupport/gdb_unique_ptr.h
diff --git a/gdb/gdbsupport/gdb_unlinker.h b/gdbsupport/gdb_unlinker.h
similarity index 100%
rename from gdb/gdbsupport/gdb_unlinker.h
rename to gdbsupport/gdb_unlinker.h
diff --git a/gdb/gdbsupport/gdb_vecs.c b/gdbsupport/gdb_vecs.c
similarity index 100%
rename from gdb/gdbsupport/gdb_vecs.c
rename to gdbsupport/gdb_vecs.c
diff --git a/gdb/gdbsupport/gdb_vecs.h b/gdbsupport/gdb_vecs.h
similarity index 100%
rename from gdb/gdbsupport/gdb_vecs.h
rename to gdbsupport/gdb_vecs.h
diff --git a/gdb/gdbsupport/gdb_wait.c b/gdbsupport/gdb_wait.c
similarity index 100%
rename from gdb/gdbsupport/gdb_wait.c
rename to gdbsupport/gdb_wait.c
diff --git a/gdb/gdbsupport/gdb_wait.h b/gdbsupport/gdb_wait.h
similarity index 100%
rename from gdb/gdbsupport/gdb_wait.h
rename to gdbsupport/gdb_wait.h
diff --git a/gdb/gdbsupport/hash_enum.h b/gdbsupport/hash_enum.h
similarity index 100%
rename from gdb/gdbsupport/hash_enum.h
rename to gdbsupport/hash_enum.h
diff --git a/gdb/gdbsupport/host-defs.h b/gdbsupport/host-defs.h
similarity index 100%
rename from gdb/gdbsupport/host-defs.h
rename to gdbsupport/host-defs.h
diff --git a/gdb/gdbsupport/job-control.c b/gdbsupport/job-control.c
similarity index 100%
rename from gdb/gdbsupport/job-control.c
rename to gdbsupport/job-control.c
diff --git a/gdb/gdbsupport/job-control.h b/gdbsupport/job-control.h
similarity index 100%
rename from gdb/gdbsupport/job-control.h
rename to gdbsupport/job-control.h
diff --git a/gdb/gdbsupport/netstuff.c b/gdbsupport/netstuff.c
similarity index 100%
rename from gdb/gdbsupport/netstuff.c
rename to gdbsupport/netstuff.c
diff --git a/gdb/gdbsupport/netstuff.h b/gdbsupport/netstuff.h
similarity index 100%
rename from gdb/gdbsupport/netstuff.h
rename to gdbsupport/netstuff.h
diff --git a/gdb/gdbsupport/new-op.c b/gdbsupport/new-op.c
similarity index 100%
rename from gdb/gdbsupport/new-op.c
rename to gdbsupport/new-op.c
diff --git a/gdb/gdbsupport/next-iterator.h b/gdbsupport/next-iterator.h
similarity index 100%
rename from gdb/gdbsupport/next-iterator.h
rename to gdbsupport/next-iterator.h
diff --git a/gdb/gdbsupport/observable.h b/gdbsupport/observable.h
similarity index 100%
rename from gdb/gdbsupport/observable.h
rename to gdbsupport/observable.h
diff --git a/gdb/gdbsupport/offset-type.h b/gdbsupport/offset-type.h
similarity index 100%
rename from gdb/gdbsupport/offset-type.h
rename to gdbsupport/offset-type.h
diff --git a/gdb/gdbsupport/parallel-for.h b/gdbsupport/parallel-for.h
similarity index 100%
rename from gdb/gdbsupport/parallel-for.h
rename to gdbsupport/parallel-for.h
diff --git a/gdb/gdbsupport/pathstuff.c b/gdbsupport/pathstuff.c
similarity index 100%
rename from gdb/gdbsupport/pathstuff.c
rename to gdbsupport/pathstuff.c
diff --git a/gdb/gdbsupport/pathstuff.h b/gdbsupport/pathstuff.h
similarity index 100%
rename from gdb/gdbsupport/pathstuff.h
rename to gdbsupport/pathstuff.h
diff --git a/gdb/gdbsupport/poison.h b/gdbsupport/poison.h
similarity index 100%
rename from gdb/gdbsupport/poison.h
rename to gdbsupport/poison.h
diff --git a/gdb/gdbsupport/preprocessor.h b/gdbsupport/preprocessor.h
similarity index 100%
rename from gdb/gdbsupport/preprocessor.h
rename to gdbsupport/preprocessor.h
diff --git a/gdb/gdbsupport/print-utils.c b/gdbsupport/print-utils.c
similarity index 100%
rename from gdb/gdbsupport/print-utils.c
rename to gdbsupport/print-utils.c
diff --git a/gdb/gdbsupport/print-utils.h b/gdbsupport/print-utils.h
similarity index 100%
rename from gdb/gdbsupport/print-utils.h
rename to gdbsupport/print-utils.h
diff --git a/gdb/gdbsupport/ptid.c b/gdbsupport/ptid.c
similarity index 100%
rename from gdb/gdbsupport/ptid.c
rename to gdbsupport/ptid.c
diff --git a/gdb/gdbsupport/ptid.h b/gdbsupport/ptid.h
similarity index 100%
rename from gdb/gdbsupport/ptid.h
rename to gdbsupport/ptid.h
diff --git a/gdb/gdbsupport/refcounted-object.h b/gdbsupport/refcounted-object.h
similarity index 100%
rename from gdb/gdbsupport/refcounted-object.h
rename to gdbsupport/refcounted-object.h
diff --git a/gdb/gdbsupport/rsp-low.c b/gdbsupport/rsp-low.c
similarity index 100%
rename from gdb/gdbsupport/rsp-low.c
rename to gdbsupport/rsp-low.c
diff --git a/gdb/gdbsupport/rsp-low.h b/gdbsupport/rsp-low.h
similarity index 100%
rename from gdb/gdbsupport/rsp-low.h
rename to gdbsupport/rsp-low.h
diff --git a/gdb/gdbsupport/run-time-clock.c b/gdbsupport/run-time-clock.c
similarity index 100%
rename from gdb/gdbsupport/run-time-clock.c
rename to gdbsupport/run-time-clock.c
diff --git a/gdb/gdbsupport/run-time-clock.h b/gdbsupport/run-time-clock.h
similarity index 100%
rename from gdb/gdbsupport/run-time-clock.h
rename to gdbsupport/run-time-clock.h
diff --git a/gdb/gdbsupport/safe-iterator.h b/gdbsupport/safe-iterator.h
similarity index 100%
rename from gdb/gdbsupport/safe-iterator.h
rename to gdbsupport/safe-iterator.h
diff --git a/gdb/gdbsupport/safe-strerror.c b/gdbsupport/safe-strerror.c
similarity index 100%
rename from gdb/gdbsupport/safe-strerror.c
rename to gdbsupport/safe-strerror.c
diff --git a/gdb/gdbsupport/scope-exit.h b/gdbsupport/scope-exit.h
similarity index 100%
rename from gdb/gdbsupport/scope-exit.h
rename to gdbsupport/scope-exit.h
diff --git a/gdb/gdbsupport/scoped_fd.h b/gdbsupport/scoped_fd.h
similarity index 100%
rename from gdb/gdbsupport/scoped_fd.h
rename to gdbsupport/scoped_fd.h
diff --git a/gdb/gdbsupport/scoped_mmap.c b/gdbsupport/scoped_mmap.c
similarity index 100%
rename from gdb/gdbsupport/scoped_mmap.c
rename to gdbsupport/scoped_mmap.c
diff --git a/gdb/gdbsupport/scoped_mmap.h b/gdbsupport/scoped_mmap.h
similarity index 100%
rename from gdb/gdbsupport/scoped_mmap.h
rename to gdbsupport/scoped_mmap.h
diff --git a/gdb/gdbsupport/scoped_restore.h b/gdbsupport/scoped_restore.h
similarity index 100%
rename from gdb/gdbsupport/scoped_restore.h
rename to gdbsupport/scoped_restore.h
diff --git a/gdb/gdbsupport/selftest.c b/gdbsupport/selftest.c
similarity index 100%
rename from gdb/gdbsupport/selftest.c
rename to gdbsupport/selftest.c
diff --git a/gdb/gdbsupport/selftest.h b/gdbsupport/selftest.h
similarity index 100%
rename from gdb/gdbsupport/selftest.h
rename to gdbsupport/selftest.h
diff --git a/gdb/gdbsupport/signals-state-save-restore.c b/gdbsupport/signals-state-save-restore.c
similarity index 100%
rename from gdb/gdbsupport/signals-state-save-restore.c
rename to gdbsupport/signals-state-save-restore.c
diff --git a/gdb/gdbsupport/signals-state-save-restore.h b/gdbsupport/signals-state-save-restore.h
similarity index 100%
rename from gdb/gdbsupport/signals-state-save-restore.h
rename to gdbsupport/signals-state-save-restore.h
diff --git a/gdb/gdbsupport/signals.c b/gdbsupport/signals.c
similarity index 100%
rename from gdb/gdbsupport/signals.c
rename to gdbsupport/signals.c
diff --git a/gdb/gdbsupport/symbol.h b/gdbsupport/symbol.h
similarity index 100%
rename from gdb/gdbsupport/symbol.h
rename to gdbsupport/symbol.h
diff --git a/gdb/gdbsupport/tdesc.c b/gdbsupport/tdesc.c
similarity index 100%
rename from gdb/gdbsupport/tdesc.c
rename to gdbsupport/tdesc.c
diff --git a/gdb/gdbsupport/tdesc.h b/gdbsupport/tdesc.h
similarity index 100%
rename from gdb/gdbsupport/tdesc.h
rename to gdbsupport/tdesc.h
diff --git a/gdb/gdbsupport/thread-pool.c b/gdbsupport/thread-pool.c
similarity index 100%
rename from gdb/gdbsupport/thread-pool.c
rename to gdbsupport/thread-pool.c
diff --git a/gdb/gdbsupport/thread-pool.h b/gdbsupport/thread-pool.h
similarity index 100%
rename from gdb/gdbsupport/thread-pool.h
rename to gdbsupport/thread-pool.h
diff --git a/gdb/gdbsupport/traits.h b/gdbsupport/traits.h
similarity index 100%
rename from gdb/gdbsupport/traits.h
rename to gdbsupport/traits.h
diff --git a/gdb/gdbsupport/underlying.h b/gdbsupport/underlying.h
similarity index 100%
rename from gdb/gdbsupport/underlying.h
rename to gdbsupport/underlying.h
diff --git a/gdb/gdbsupport/valid-expr.h b/gdbsupport/valid-expr.h
similarity index 100%
rename from gdb/gdbsupport/valid-expr.h
rename to gdbsupport/valid-expr.h
diff --git a/gdb/gdbsupport/version.h b/gdbsupport/version.h
similarity index 100%
rename from gdb/gdbsupport/version.h
rename to gdbsupport/version.h
diff --git a/gdb/gdbsupport/x86-xstate.h b/gdbsupport/x86-xstate.h
similarity index 100%
rename from gdb/gdbsupport/x86-xstate.h
rename to gdbsupport/x86-xstate.h
diff --git a/gdb/gdbsupport/xml-utils.c b/gdbsupport/xml-utils.c
similarity index 100%
rename from gdb/gdbsupport/xml-utils.c
rename to gdbsupport/xml-utils.c
diff --git a/gdb/gdbsupport/xml-utils.h b/gdbsupport/xml-utils.h
similarity index 100%
rename from gdb/gdbsupport/xml-utils.h
rename to gdbsupport/xml-utils.h
diff --git a/src-release.sh b/src-release.sh
index 275f0f24b5d..92e92ac5d77 100755
--- a/src-release.sh
+++ b/src-release.sh
@@ -1,5 +1,5 @@ 
 #!/usr/bin/env bash
-#   Copyright (C) 1990-2018 Free Software Foundation
+#   Copyright (C) 1990-2019 Free Software Foundation
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -315,7 +315,7 @@  gas_release()
     tar_compress $package $tool "$GAS_SUPPORT_DIRS" "$compressors"
 }
 
-GDB_SUPPORT_DIRS="bfd include libiberty libctf opcodes readline sim intl libdecnumber cpu zlib contrib gnulib"
+GDB_SUPPORT_DIRS="bfd include libiberty libctf opcodes readline sim intl libdecnumber cpu zlib contrib gnulib gdbsupport"
 gdb_release()
 {
     compressors=$1