From df7b86aa4cb63ce86e60949b8160438bc0f9e389 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 17 May 2012 15:13:28 +0000 Subject: PR 14072 * configure.in: Add check that sysdep.h has been included before any system header files. * configure: Regenerate. * config.in: Regenerate. * sysdep.h: Generate an error if included before config.h. * alpha-opc.c: Include sysdep.h before any other header file. * alpha-dis.c: Likewise. * avr-dis.c: Likewise. * cgen-opc.c: Likewise. * cr16-dis.c: Likewise. * cris-dis.c: Likewise. * crx-dis.c: Likewise. * d10v-dis.c: Likewise. * d10v-opc.c: Likewise. * d30v-dis.c: Likewise. * d30v-opc.c: Likewise. * h8500-dis.c: Likewise. * i370-dis.c: Likewise. * i370-opc.c: Likewise. * m10200-dis.c: Likewise. * m10300-dis.c: Likewise. * micromips-opc.c: Likewise. * mips-opc.c: Likewise. * mips61-opc.c: Likewise. * moxie-dis.c: Likewise. * or32-opc.c: Likewise. * pj-dis.c: Likewise. * ppc-dis.c: Likewise. * ppc-opc.c: Likewise. * s390-dis.c: Likewise. * sh-dis.c: Likewise. * sh64-dis.c: Likewise. * sparc-dis.c: Likewise. * sparc-opc.c: Likewise. * spu-dis.c: Likewise. * tic30-dis.c: Likewise. * tic54x-dis.c: Likewise. * tic80-dis.c: Likewise. * tic80-opc.c: Likewise. * tilegx-dis.c: Likewise. * tilepro-dis.c: Likewise. * v850-dis.c: Likewise. * v850-opc.c: Likewise. * vax-dis.c: Likewise. * w65-dis.c: Likewise. * xgate-dis.c: Likewise. * xtensa-dis.c: Likewise. * rl78-decode.opc: Likewise. * rl78-decode.c: Regenerate. * rx-decode.opc: Likewise. * rx-decode.c: Regenerate. * configure.in: Add check that sysdep.h has been included before any system header files. * configure: Regenerate. * config.in: Regenerate. * sysdep.h: Generate an error if included before config.h. * configure.in: Add check that sysdep.h has been included before any system header files. * configure: Regenerate. * config.in: Regenerate. * aclocal.m4: Regenerate. * bfd-in.h: Generate an error if included before config.h. * sysdep.h: Likewise. * bfd-in2.h: Regenerate. * compress.c: Remove #include "config.h". * plugin.c: Likewise. * elf32-m68hc1x.c: Include sysdep.h before alloca-conf.h. * elf64-hppa.c: Likewise. * som.c: Likewise. * xsymc.c: Likewise. * configure.in: Add check that sysdep.h has been included before any system header files. * configure: Regenerate. * config.in: Regenerate. * configure.in: Add check that sysdep.h has been included before any system header files. * configure: Regenerate. * config.in: Regenerate. * aclocal.m4: Regenerate. * Makefile.am: Use wrappers around C files generated by flex. * Makefile.in: Regenerate. * doc/Makefile.in: Regenerate. * itbl-lex-wrapper.c: New file. * config/bfin-lex-wrapper.c: New file. * cgen.c: Include as.h before setjmp.h. * config/tc-dlx.c: Include as.h before any other header. * config/tc-h8300.c: Likewise. * config/tc-lm32.c: Likewise. * config/tc-mep.c: Likewise. * config/tc-microblaze.c: Likewise. * config/tc-mmix.c: Likewise. * config/tc-msp430.c: Likewise. * config/tc-or32.c: Likewise. * config/tc-tic4x.c: Likewise. * config/tc-tic54x.c: Likewise. * config/tc-xtensa.c: Likewise. * configure.in: Add check that sysdep.h has been included before any system header files. * configure: Regenerate. * config.in: Regenerate. * unwind-ia64.h: Include config.h. --- bfd/ChangeLog | 19 +++++++++++++++++++ bfd/bfd-in.h | 4 ++++ bfd/bfd-in2.h | 4 ++++ bfd/compress.c | 3 +-- bfd/config.in | 7 +++++++ bfd/configure | 3 +++ bfd/configure.in | 9 +++++++++ bfd/elf32-m68hc1x.c | 2 +- bfd/elf64-hppa.c | 2 +- bfd/plugin.c | 1 - bfd/som.c | 6 +++--- bfd/sysdep.h | 4 ++++ bfd/xsym.c | 4 ++-- 13 files changed, 58 insertions(+), 10 deletions(-) (limited to 'bfd') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 46979ce..08ce86d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,22 @@ +2012-05-17 Daniel Richard G. + Nick Clifton + + PR 14072 + * configure.in: Add check that sysdep.h has been included before + any system header files. + * configure: Regenerate. + * config.in: Regenerate. + * aclocal.m4: Regenerate. + * bfd-in.h: Generate an error if included before config.h. + * sysdep.h: Likewise. + * bfd-in2.h: Regenerate. + * compress.c: Remove #include "config.h". + * plugin.c: Likewise. + * elf32-m68hc1x.c: Include sysdep.h before alloca-conf.h. + * elf64-hppa.c: Likewise. + * som.c: Likewise. + * xsymc.c: Likewise. + 2012-05-17 Maciej W. Rozycki Alan Modra diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index d88bcb6..ae8149a 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -25,6 +25,10 @@ #ifndef __BFD_H_SEEN__ #define __BFD_H_SEEN__ +#ifndef PACKAGE +#error config.h must be included before this header +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index f1fc33a..275f977 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -32,6 +32,10 @@ #ifndef __BFD_H_SEEN__ #define __BFD_H_SEEN__ +#ifndef PACKAGE +#error config.h must be included before this header +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/bfd/compress.c b/bfd/compress.c index a82a8bc..52c884c 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,6 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "config.h" #include "sysdep.h" #include "bfd.h" #include "libbfd.h" diff --git a/bfd/config.in b/bfd/config.in index cb53b14..20b619d 100644 --- a/bfd/config.in +++ b/bfd/config.in @@ -1,5 +1,12 @@ /* config.in. Generated from configure.in by autoheader. */ +/* Check that config.h is #included before system headers + (this works only for glibc, but that should be enough). */ +#if defined(__GLIBC__) && !defined(__CONFIG_H__) +# error config.h must be #included before system headers +#endif +#define __CONFIG_H__ 1 + /* Name of host specific core header file to include in elf.c. */ #undef CORE_HEADER diff --git a/bfd/configure b/bfd/configure index 7c52478..fe51170 100755 --- a/bfd/configure +++ b/bfd/configure @@ -12217,6 +12217,9 @@ fi ac_config_headers="$ac_config_headers config.h:config.in" +# PR 14072 + + if test -z "$target" ; then as_fn_error "Unrecognized target system type; please check config.sub." "$LINENO" 5 fi diff --git a/bfd/configure.in b/bfd/configure.in index 47631cc..9e72c7a 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -117,6 +117,15 @@ AM_BINUTILS_WARNINGS AC_CONFIG_HEADERS(config.h:config.in) +# PR 14072 +AH_VERBATIM([00_CONFIG_H_CHECK], +[/* Check that config.h is #included before system headers + (this works only for glibc, but that should be enough). */ +#if defined(__GLIBC__) && !defined(__CONFIG_H__) +# error config.h must be #included before system headers +#endif +#define __CONFIG_H__ 1]) + if test -z "$target" ; then AC_MSG_ERROR(Unrecognized target system type; please check config.sub.) fi diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c index 70bf09e..65d17d9 100644 --- a/bfd/elf32-m68hc1x.c +++ b/bfd/elf32-m68hc1x.c @@ -20,8 +20,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "alloca-conf.h" #include "sysdep.h" +#include "alloca-conf.h" #include "bfd.h" #include "bfdlink.h" #include "libbfd.h" diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index e3de2a6..6087fe5 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -20,8 +20,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "alloca-conf.h" #include "sysdep.h" +#include "alloca-conf.h" #include "bfd.h" #include "libbfd.h" #include "elf-bfd.h" diff --git a/bfd/plugin.c b/bfd/plugin.c index 733ba71..8d2c4b20 100644 --- a/bfd/plugin.c +++ b/bfd/plugin.c @@ -19,7 +19,6 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "config.h" #include "sysdep.h" #include "bfd.h" diff --git a/bfd/som.c b/bfd/som.c index 0726f84..efaf400 100644 --- a/bfd/som.c +++ b/bfd/som.c @@ -1,7 +1,7 @@ /* 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 - Free Software Foundation, Inc. + 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 University of Utah. @@ -23,8 +23,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "alloca-conf.h" #include "sysdep.h" +#include "alloca-conf.h" #include "bfd.h" #include "libbfd.h" diff --git a/bfd/sysdep.h b/bfd/sysdep.h index 20ef56d..b4fed10 100644 --- a/bfd/sysdep.h +++ b/bfd/sysdep.h @@ -23,6 +23,10 @@ #ifndef BFD_SYSDEP_H #define BFD_SYSDEP_H +#ifdef PACKAGE +#error sysdep.h must be included in lieu of config.h +#endif + #include "config.h" #include "ansidecl.h" diff --git a/bfd/xsym.c b/bfd/xsym.c index 0926297..e0819a9 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,8 +21,8 @@ /* xSYM is the debugging format used by CodeWarrior on Mac OS classic. */ -#include "alloca-conf.h" #include "sysdep.h" +#include "alloca-conf.h" #include "xsym.h" #include "bfd.h" #include "libbfd.h" -- cgit v1.1