* Re: recent change broke gdb build
2012-05-16 18:36 recent change broke gdb build Tom Tromey
@ 2012-05-16 18:30 ` Tom Tromey
2012-05-16 19:30 ` Pedro Alves
0 siblings, 1 reply; 7+ messages in thread
From: Tom Tromey @ 2012-05-16 18:30 UTC (permalink / raw)
To: Binutils Development
Tom> I tried a quick fix of renaming BFD's config.h to bfd_config.h, but that
Tom> breaks alloca-conf.h, which assumes that every project has a config.h.
Here's a patch that works for me.
This is a bit of a frankenstein patch since I did a bit in a gdb git
repo and another in the binutils git repo.
I haven't checked the GCC tree for uses of alloca-conf.h.
A couple of other minor hacks:
BFD now exports the _ define via sysdeps.h. I changed it to make this
conditional, so that gdb can define _ and pick up its version. This
will fail if any BFD header needs to actually use its definition of _.
I changed gdb/defs.h to follow BFD's logic for including fopen-*.h.
I don't think it is too good to depend on some other package's configury
like this.
Any thoughts on this?
Tom
b/bfd/ChangeLog:
2012-05-16 Tom Tromey <tromey@redhat.com>
* sysdep.h: Include bfd_config.h.
(BFD_PACKAGE): New define.
(_): Redefine. Make conditional.
* plugin.c: Include bfd_config.h.
* compress.c: Include bfd_config.h.
* elf32-m68hc12x.c: Include bfd_config.h.
* elf64-hppa.c: Include bfd_config.h.
* som.c: Include bfd_config.h.
* xsym.c: Include bfd_config.h.
* configure, Makefile.in, doc/Makefile.in: Rebuild.
* configure.in: Generate bfd_config.h, not config.h.
Pass no-define to AM_INIT_AUTOMAKE.
* Makefile.am (LOCAL_H_DEPS): Use bfd_config.h.
b/gdb/ChangeLog:
2012-05-16 Tom Tromey <tromey@redhat.com>
* defs.h: Include bfd_config.h. Use BFD logic to include
fopen-bin.h or fopen-same.h.
b/include/ChangeLog:
2012-05-16 Tom Tromey <tromey@redhat.com>
* alloca-conf.h: Don't include config.h.
b/opcodes/ChangeLog:
2012-05-16 Tom Tromey <tromey@redhat.com>
* cgen-opc.c: Include config.h.
b/gas/ChangeLog:
2012-05-16 Tom Tromey <tromey@redhat.com>
* as.h: Include config.h.
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index b7271cc..5fc9cf2 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -909,7 +909,7 @@ pex64igen.c: peXXigen.c
mv -f pex64igen.new pex64igen.c
BFD_H_DEPS= $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
-LOCAL_H_DEPS= libbfd.h sysdep.h config.h
+LOCAL_H_DEPS= libbfd.h sysdep.h bfd_config.h
$(BFD32_LIBS) \
$(BFD64_LIBS) \
$(ALL_MACHINES) \
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 7a48fda..a76a44e 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -68,7 +68,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
-CONFIG_HEADER = config.h
+CONFIG_HEADER = bfd_config.h
CONFIG_CLEAN_FILES = bfd-in3.h po/Makefile.in
CONFIG_CLEAN_VPATH_FILES =
LIBRARIES = $(noinst_LIBRARIES)
@@ -1085,7 +1085,7 @@ libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL)
noinst_LIBRARIES = libbfd.a
libbfd_a_SOURCES =
BFD_H_DEPS = $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
-LOCAL_H_DEPS = libbfd.h sysdep.h config.h
+LOCAL_H_DEPS = libbfd.h sysdep.h bfd_config.h
BFD_H_FILES = bfd-in.h init.c opncls.c libbfd.c section.c archures.c \
reloc.c syms.c bfd.c bfdio.c bfdwin.c \
archive.c corefile.c targets.c format.c compress.c
@@ -1100,7 +1100,7 @@ CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib \
stmp-bin2-h stmp-lbfd-h stmp-lcoff-h
DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES) libtool-soversion
-all: $(BUILT_SOURCES) config.h
+all: $(BUILT_SOURCES) bfd_config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
@@ -1140,7 +1140,7 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
-config.h: stamp-h1
+bfd_config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
@@ -1148,14 +1148,14 @@ config.h: stamp-h1
stamp-h1: $(srcdir)/config.in $(top_builddir)/config.status
@rm -f stamp-h1
- cd $(top_builddir) && $(SHELL) ./config.status config.h
+ cd $(top_builddir) && $(SHELL) ./config.status bfd_config.h
$(srcdir)/config.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
distclean-hdr:
- -rm -f config.h stamp-h1
+ -rm -f bfd_config.h stamp-h1
bfd-in3.h: $(top_builddir)/config.status $(srcdir)/bfd-in2.h
cd $(top_builddir) && $(SHELL) ./config.status $@
po/Makefile.in: $(top_builddir)/config.status $(top_srcdir)/po/Make-in
@@ -1306,6 +1306,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-m68hc12.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-m68k.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-m88k.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-m9s12x.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-m9s12xg.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-mcore.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-mep.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-microblaze.Plo@am__quote@
@@ -1736,7 +1738,7 @@ distclean-tags:
check-am: all-am
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-recursive
-all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(HEADERS) config.h
+all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(HEADERS) bfd_config.h
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(bfdlibdir)" "$(DESTDIR)$(bfdincludedir)"; do \
diff --git a/bfd/compress.c b/bfd/compress.c
index a82a8bc..f80a456 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -1,5 +1,5 @@
/* Compressed section support (intended for debug sections).
- Copyright 2008, 2010, 2011
+ Copyright 2008, 2010, 2011, 2012
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,7 +19,7 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include "config.h"
+#include "bfd_config.h"
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
diff --git a/bfd/configure b/bfd/configure
index 7c52478..6c5e91a 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -3991,15 +3991,6 @@ fi
VERSION=2.22.52
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE "$PACKAGE"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define VERSION "$VERSION"
-_ACEOF
-
# Some tools Automake needs.
ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
@@ -11404,7 +11395,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11407 "configure"
+#line 11398 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11510,7 +11501,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11513 "configure"
+#line 11504 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12214,7 +12205,7 @@ fi
-ac_config_headers="$ac_config_headers config.h:config.in"
+ac_config_headers="$ac_config_headers bfd_config.h:config.in"
if test -z "$target" ; then
@@ -16916,7 +16907,7 @@ do
case $ac_config_target in
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
- "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;;
+ "bfd_config.h") CONFIG_HEADERS="$CONFIG_HEADERS bfd_config.h:config.in" ;;
"default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
"bfd_stdint.h") CONFIG_COMMANDS="$CONFIG_COMMANDS bfd_stdint.h" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
diff --git a/bfd/configure.in b/bfd/configure.in
index 47631cc..7fb452a 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -8,7 +8,7 @@ AC_CONFIG_SRCDIR([libbfd.c])
AC_CANONICAL_TARGET
AC_ISC_POSIX
-AM_INIT_AUTOMAKE(bfd, 2.22.52)
+AM_INIT_AUTOMAKE(bfd, 2.22.52, no-define)
dnl These must be called before LT_INIT, because it may want
dnl to call AC_CHECK_PROG.
@@ -115,7 +115,7 @@ ACX_BUGURL([http://www.sourceware.org/bugzilla/])
AM_BINUTILS_WARNINGS
-AC_CONFIG_HEADERS(config.h:config.in)
+AC_CONFIG_HEADERS(bfd_config.h:config.in)
if test -z "$target" ; then
AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in
index 68e17f7..18f4aaf 100644
--- a/bfd/doc/Makefile.in
+++ b/bfd/doc/Makefile.in
@@ -62,7 +62,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_HEADER = $(top_builddir)/bfd_config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
depcomp =
diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c
index 70bf09e..49867c3 100644
--- a/bfd/elf32-m68hc1x.c
+++ b/bfd/elf32-m68hc1x.c
@@ -20,6 +20,7 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
+#include "bfd_config.h"
#include "alloca-conf.h"
#include "sysdep.h"
#include "bfd.h"
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index e3de2a6..674cae4 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -20,6 +20,7 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
+#include "bfd_config.h"
#include "alloca-conf.h"
#include "sysdep.h"
#include "bfd.h"
diff --git a/bfd/plugin.c b/bfd/plugin.c
index 733ba71..7bb3401 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -19,7 +19,7 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include "config.h"
+#include "bfd_config.h"
#include "sysdep.h"
#include "bfd.h"
diff --git a/bfd/som.c b/bfd/som.c
index 0726f84..7d0290e 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -1,6 +1,6 @@
/* bfd back-end for HP PA-RISC SOM objects.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Contributed by the Center for Software Science at the
@@ -23,6 +23,7 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
+#include "bfd_config.h"
#include "alloca-conf.h"
#include "sysdep.h"
#include "bfd.h"
diff --git a/bfd/sysdep.h b/bfd/sysdep.h
index 20ef56d..5fed75e 100644
--- a/bfd/sysdep.h
+++ b/bfd/sysdep.h
@@ -1,5 +1,5 @@
/* sysdep.h -- handle host dependencies for the BFD library
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2005, 2007, 2009
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2005, 2007, 2009, 2012
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -23,7 +23,7 @@
#ifndef BFD_SYSDEP_H
#define BFD_SYSDEP_H
-#include "config.h"
+#include "bfd_config.h"
#include "ansidecl.h"
@@ -169,9 +169,17 @@ extern int fseeko64 (FILE *stream, off64_t offset, int whence);
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif
+/* BFD users might define '_'. Don't mess with that. */
+#ifndef _
+
#ifdef ENABLE_NLS
#include <libintl.h>
-/* Note the use of dgetext() and PACKAGE here, rather than gettext().
+
+/* We don't want to use PACKAGE, because that will be defined by the
+ packages which use BFD. */
+#define BFD_PACKAGE "bfd"
+
+/* Note the use of dgetext() and BFD_PACKAGE here, rather than gettext().
This is because the code in this directory is used to build a library which
will be linked with code in other directories to form programs. We want to
@@ -181,9 +189,9 @@ extern int fseeko64 (FILE *stream, off64_t offset, int whence);
In order to do this, we have to make sure that when we extract messages we
use the OPCODES domain rather than the domain of the program that included
- the bfd library, (eg OBJDUMP). Hence we use dgettext (PACKAGE, String)
- and define PACKAGE to be 'bfd'. (See the code in configure). */
-#define _(String) dgettext (PACKAGE, String)
+ the bfd library, (eg OBJDUMP). Hence we use dgettext (BFD_PACKAGE, String)
+ and define BFD_PACKAGE to be 'bfd'. (See the code in configure). */
+#define _(String) dgettext (BFD_PACKAGE, String)
#ifdef gettext_noop
#define N_(String) gettext_noop (String)
#else
@@ -199,4 +207,6 @@ extern int fseeko64 (FILE *stream, off64_t offset, int whence);
# define N_(String) (String)
#endif
+#endif /* defined _ */
+
#endif /* ! defined (BFD_SYSDEP_H) */
diff --git a/bfd/xsym.c b/bfd/xsym.c
index 0926297..ef4884a 100644
--- a/bfd/xsym.c
+++ b/bfd/xsym.c
@@ -1,6 +1,6 @@
/* xSYM symbol-file support for BFD.
Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
- 2009, 2010, 2011 Free Software Foundation, Inc.
+ 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -21,6 +21,7 @@
/* xSYM is the debugging format used by CodeWarrior on Mac OS classic. */
+#include "bfd_config.h"
#include "alloca-conf.h"
#include "sysdep.h"
#include "xsym.h"
diff --git a/gdb/defs.h b/gdb/defs.h
index 004f335..d92b86c 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -757,16 +757,12 @@ enum val_prettyprint
#include "nm.h"
#endif
-/* Assume that fopen accepts the letter "b" in the mode string.
- It is demanded by ISO C9X, and should be supported on all
- platforms that claim to have a standard-conforming C library. On
- true POSIX systems it will be ignored and have no effect. There
- may still be systems without a standard-conforming C library where
- an ISO C9X compiler (GCC) is available. Known examples are SunOS
- 4.x and 4.3BSD. This assumption means these systems are no longer
- supported. */
-#ifndef FOPEN_RB
-# include "fopen-bin.h"
+#include "bfd_config.h"
+
+#ifdef USE_BINARY_FOPEN
+#include "fopen-bin.h"
+#else
+#include "fopen-same.h"
#endif
/* Defaults for system-wide constants (if not defined by xm.h, we fake it).
diff --git a/include/alloca-conf.h b/include/alloca-conf.h
index 628a598..d75a1e4 100644
--- a/include/alloca-conf.h
+++ b/include/alloca-conf.h
@@ -1,5 +1,3 @@
-#include "config.h"
-
/* This is a merge of code recommended in the autoconf-2.61 documentation
with that recommended in the autoconf-2.13 documentation, with added
tweaks to heed C_ALLOCA. */
diff --git a/opcodes/cgen-opc.c b/opcodes/cgen-opc.c
index 263eb2c..2c6231d 100644
--- a/opcodes/cgen-opc.c
+++ b/opcodes/cgen-opc.c
@@ -1,6 +1,6 @@
/* CGEN generic opcode support.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2005, 2007, 2009
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2005, 2007, 2009, 2012
Free Software Foundation, Inc.
This file is part of libopcodes.
@@ -19,6 +19,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+#include "config.h"
#include "alloca-conf.h"
#include "sysdep.h"
#include <stdio.h>
diff --git a/gas/as.h b/gas/as.h
index f2214e8..b343725 100644
--- a/gas/as.h
+++ b/gas/as.h
@@ -36,6 +36,7 @@
COMMON as "".
If TEST is #defined, then we are testing a module: #define COMMON as "". */
+#include "config.h"
#include "alloca-conf.h"
/* Now, tend to the rest of the configuration. */
^ permalink raw reply [flat|nested] 7+ messages in thread