Commit Graph

3 Commits

Author SHA1 Message Date
Pedro Alves 3684d331fd Fix gdbsupport build
I'm seeing this on F27 (a clean build from scratch):

~~~~~~~~~~~~~~~~~~~~~~~~~~~
 make[3]: Entering directory '/home/pedro/brno/pedro/gdb/binutils-gdb/build/gdbsupport'
   CC       gdb_tilde_expand.o
 In file included from /home/pedro/gdb/binutils-gdb/src/gdbsupport/../gnulib/import/libc-config.h:33:0,
                  from ../gnulib/import/glob.h:544,
                  from /home/pedro/gdb/binutils-gdb/src/gdbsupport/gdb_tilde_expand.c:22:
 ../bfd/config.h:7:4: error: #error config.h must be #included before system headers
  #  error config.h must be #included before system headers
     ^~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~

libc-config.h, where it includes config.h, says:

~~~~~~~~~~~~~~~~~~~~~~~~~~~
 /* This is intended to be a good-enough substitute for glibc system
    macros like those defined in <sys/cdefs.h>, so that Gnulib code
    shared with glibc can do this as the first #include:

      #ifndef _LIBC
      # include <libc-config.h>
      #endif

    When compiled as part of glibc this is a no-op; when compiled as
    part of Gnulib this includes Gnulib's <config.h> and defines macros
    that glibc library code would normally assume.  */

 #include <config.h>
~~~~~~~~~~~~~~~~~~~~~~~~~~~

The issue is that that '#include <config.h>' picks up bfd's config.h
instead of gnulib's.

This problem doesn't trigger in the gdb dir because there we generate
config.h under that exact name so gnulib's libc-config.h ends up
picking gdb's config.h instead of gnulib.c and that ends up harmless.

In gdbsupport, the config.h file is really named support-config.h, so
that '#include <config.h>' in libc-config.h doesn't pick it like it
would if it had the conventional config.h name.

This patch fixes it by simply renaming gdbserver's support-config.h to
config.h.

gdbsupport/ChangeLog:
2020-01-17  Pedro Alves  <palves@redhat.com>

	* configure.ac: Generate config.h instead of support-config.h.
	* common-defs.h: Include <gdbsupport/config.h> instead of
	<gdbsupport/support-config.h>.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
2020-01-17 15:14:56 +00:00
Tom Tromey 05ea2a0510 Move many configure checks to common.m4
This moves many needed configure checks from gdb and gdbserver into
common.m4.  This helps gdbsupport, nat, and target be self-contained.

The result is a bit spaghetti-ish, because gdbsupport uses another m4
file from gdb/.  The resulting code is somewhat non-obvious.  However,
these problems already exist, so it's not really that much worse than
what is already done.

gdb/ChangeLog
2020-01-14  Tom Tromey  <tom@tromey.com>

	* configure: Rebuild.
	* configure.ac: Move many checks to ../gdbsupport/common.m4.

gdb/gdbserver/ChangeLog
2020-01-14  Tom Tromey  <tom@tromey.com>

	* configure: Rebuild.
	* configure.ac: Remove any checks that were added to common.m4.
	* acinclude.m4: Include lib-ld.m4, lib-prefix.m4, and
	lib-link.m4.

gdbsupport/ChangeLog
2020-01-14  Tom Tromey  <tom@tromey.com>

	* configure, Makefile.in, aclocal.m4, common.m4, config.in:
	Rebuild.
	* common.m4 (GDB_AC_COMMON): Move many checks from
	gdb/configure.ac.
	* acinclude.m4: Include bfd.m4, ptrace.m4.

Change-Id: I931eaa94065df268b30a2f1354390710df89c7f8
2020-01-14 16:25:03 -07:00
Tom Tromey 01027315f5 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-14  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-14  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-14  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-14  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
2020-01-14 16:25:02 -07:00