Bug 14072 - Incorrect handling of config.h and/or sysdep.h causing problems
Summary: Incorrect handling of config.h and/or sysdep.h causing problems
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.24
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-07 17:08 UTC by Daniel Richard G.
Modified: 2023-07-29 14:11 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Draft implementation of config.h include-guard (1.36 KB, patch)
2012-05-07 17:08 UTC, Daniel Richard G.
Details | Diff
example libtool, this one for arm-eabi gas; objdir/gas/libtool (7.11 KB, text/plain)
2012-05-17 18:15 UTC, Hans-Peter Nilsson
Details
Patch to fix remaining files in CVS (1.50 KB, patch)
2012-05-17 21:28 UTC, Daniel Richard G.
Details | Diff
Patch to fix remaining file in CVS (304 bytes, patch)
2012-05-19 05:43 UTC, Daniel Richard G.
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Richard G. 2012-05-07 17:08:59 UTC
Created attachment 6397 [details]
Draft implementation of config.h include-guard

This bug is a generalization of bug 13558.

When compiling a source file in binutils, config.h needs to be #included before any system header file. The configuration header may contain feature test-macro definitions, and if those are not in place before a system header is pulled in, bugs like 13558 tend to happen.

Numerous files in the binutils CVS source fail to do this correctly, however:

* Sometimes, bfd.h (or the like) is included before sysdep.h, when sysdep.h is responsible for #including config.h

* Sometimes, neither sysdep.h nor config.h is #included at all

* Sometimes, config.h is #included twice, leading to re-definition warnings


These issues are not always fatal, but when they are, they tend to occur on less-popular platforms that are not used in primary development (e.g. AIX in the case of bug 13558).

I would like to propose a mechanism, draft-implemented in the attached patch against CVS, that enforces correct inclusion of the config header. The patch is self-explanatory, as should be the issues it exposes when binutils CVS is built.
Comment 1 Nick Clifton 2012-05-16 11:20:09 UTC
Hi Daniel,

  I like the patch in principle, but I feel that there is a problem with it - we cannot rely upon building the binutils only in a glibc environment.  They are also built with other C libraries.  I cannot think of a clean way to test for the presence of system header files however, so maybe AH_VERBATIM macros could be made conditional somehow ?  Perhaps on the use of the --enable-maintainer-mode config option ?

  You also mention that config.h is included twice sometimes.  Does your patch catch this ?  I am not aware of any config.h redefinition warnings when building the binutils locally, so can you tell me more about where and when this happens ?

Cheers
  Nick
Comment 2 Daniel Richard G. 2012-05-16 17:59:55 UTC
The thought is that __GLIBC__ catches system headers in what is presumably the main development environment, GNU/Linux. It doesn't really need to work on other systems to be useful, because as long as config.h is the first thing seen on Linux, the same should hold true on other systems (given no changes in the source, and the absence of funky cpp conditionals that early on).

Even if someone hacks on binutils in a non-Linux environment, any issues with the #includes should become apparent once some other developer builds on Linux.

Enabling this only in maintainer mode would be sensible; I left that out because you would need to do this via e.g. "#ifdef MAINTAINER_MODE" in the AH_VERBATIM (note that the AH_VERBATIM itself can't be conditionalized), so then you'd need to conditionally AC_DEFINE(MAINTAINER_MODE)... it just seemed like more trouble than it was worth. I don't see that this should ever trip erroneously out in the wild, barring a user setting CPPFLAGS=-D__GLIBC__ or the like for some odd reason.

I have to walk back my comments on config.h being #included twice---what I had actually seen in my build of the CVS source was this:

g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"sidcomp\" -DVERSION=\"0.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -I. -I$(srcdir)/sid/component/cgen-cpu/xstormy16 -I$(srcdir)/sid/component/cgen-cpu/xstormy16 -I$(srcdir)/sid/component/cgen-cpu/xstormy16/.. -I../../../include -I$(srcdir)/sid/component/cgen-cpu/xstormy16/../../../include -I../../../../bfd -I$(srcdir)/sid/component/cgen-cpu/xstormy16/../../../../include -g -O2 -MT xstormy16.lo -MD -MP -MF .deps/xstormy16.Tpo -c $(srcdir)/sid/component/cgen-cpu/xstormy16/xstormy16.cxx  -fPIC -DPIC -o .libs/xstormy16.o
In file included from $(srcdir)/sid/component/cgen-cpu/xstormy16/xstormy16.cxx:8:0:
../../../../bfd/config.h:267:0: warning: "PACKAGE" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
../../../../bfd/config.h:358:0: warning: "VERSION" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition


It's actually a clash between a project that doesn't use config.h and one that does, and that in a section of the binutils tree that isn't binutils proper. My bad :]

The reason I didn't add any logic detecting double-#inclusion, at any rate, was that you'd already get copious warnings from that, and it's not likely to be a build-breaker on exotic platforms in the way the other header snafus have been.
Comment 3 Sourceware Commits 2012-05-17 15:13:36 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	nickc@sourceware.org	2012-05-17 15:13:28

Modified files:
	gas            : ChangeLog Makefile.am Makefile.in aclocal.m4 
	                 cgen.c config.in configure configure.in 
	gas/config     : tc-dlx.c tc-h8300.c tc-lm32.c tc-mep.c 
	                 tc-microblaze.c tc-mmix.c tc-msp430.c tc-or32.c 
	                 tc-tic4x.c tc-tic54x.c tc-xtensa.c 
	gas/doc        : Makefile.in 
	bfd            : ChangeLog bfd-in.h bfd-in2.h compress.c 
	                 config.in configure configure.in 
	                 elf32-m68hc1x.c elf64-hppa.c plugin.c som.c 
	                 sysdep.h xsym.c 
	ld             : ChangeLog config.in configure configure.in 
	                 sysdep.h 
	opcodes        : ChangeLog alpha-dis.c alpha-opc.c avr-dis.c 
	                 cgen-opc.c config.in configure configure.in 
	                 cr16-dis.c cris-dis.c crx-dis.c d10v-dis.c 
	                 d10v-opc.c d30v-dis.c d30v-opc.c h8500-dis.c 
	                 i370-dis.c i370-opc.c m10200-dis.c m10300-dis.c 
	                 micromips-opc.c mips-opc.c mips16-opc.c 
	                 moxie-dis.c or32-opc.c pj-dis.c ppc-dis.c 
	                 ppc-opc.c rl78-decode.c rl78-decode.opc 
	                 rx-decode.c rx-decode.opc s390-dis.c sh-dis.c 
	                 sh64-dis.c sparc-dis.c sparc-opc.c spu-dis.c 
	                 sysdep.h tic30-dis.c tic54x-dis.c tic80-dis.c 
	                 tic80-opc.c tilegx-dis.c tilepro-dis.c 
	                 v850-dis.c v850-opc.c vax-dis.c w65-dis.c 
	                 xgate-dis.c xtensa-dis.c 
	gold           : ChangeLog config.in configure configure.ac 
	binutils       : ChangeLog aclocal.m4 config.in configure 
	                 configure.in unwind-ia64.c 
Added files:
	gas            : itbl-lex-wrapper.c 
	gas/config     : bfin-lex-wrapper.c 

Log message:
	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.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/itbl-lex-wrapper.c.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&r1=1.4738&r2=1.4739
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/Makefile.am.diff?cvsroot=src&r1=1.199&r2=1.200
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/Makefile.in.diff?cvsroot=src&r1=1.222&r2=1.223
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/aclocal.m4.diff?cvsroot=src&r1=1.41&r2=1.42
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/cgen.c.diff?cvsroot=src&r1=1.40&r2=1.41
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config.in.diff?cvsroot=src&r1=1.40&r2=1.41
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/configure.diff?cvsroot=src&r1=1.268&r2=1.269
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/configure.in.diff?cvsroot=src&r1=1.229&r2=1.230
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/bfin-lex-wrapper.c.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-dlx.c.diff?cvsroot=src&r1=1.24&r2=1.25
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-h8300.c.diff?cvsroot=src&r1=1.66&r2=1.67
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-lm32.c.diff?cvsroot=src&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-mep.c.diff?cvsroot=src&r1=1.16&r2=1.17
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-microblaze.c.diff?cvsroot=src&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-mmix.c.diff?cvsroot=src&r1=1.35&r2=1.36
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-msp430.c.diff?cvsroot=src&r1=1.33&r2=1.34
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-or32.c.diff?cvsroot=src&r1=1.17&r2=1.18
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-tic4x.c.diff?cvsroot=src&r1=1.33&r2=1.34
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-tic54x.c.diff?cvsroot=src&r1=1.35&r2=1.36
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-xtensa.c.diff?cvsroot=src&r1=1.125&r2=1.126
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/doc/Makefile.in.diff?cvsroot=src&r1=1.116&r2=1.117
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5692&r2=1.5693
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/bfd-in.h.diff?cvsroot=src&r1=1.163&r2=1.164
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/bfd-in2.h.diff?cvsroot=src&r1=1.574&r2=1.575
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/compress.c.diff?cvsroot=src&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/config.in.diff?cvsroot=src&r1=1.50&r2=1.51
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/configure.diff?cvsroot=src&r1=1.365&r2=1.366
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/configure.in.diff?cvsroot=src&r1=1.313&r2=1.314
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-m68hc1x.c.diff?cvsroot=src&r1=1.44&r2=1.45
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-hppa.c.diff?cvsroot=src&r1=1.107&r2=1.108
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/plugin.c.diff?cvsroot=src&r1=1.16&r2=1.17
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/som.c.diff?cvsroot=src&r1=1.85&r2=1.86
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/sysdep.h.diff?cvsroot=src&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/xsym.c.diff?cvsroot=src&r1=1.31&r2=1.32
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ChangeLog.diff?cvsroot=src&r1=1.2444&r2=1.2445
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/config.in.diff?cvsroot=src&r1=1.35&r2=1.36
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/configure.diff?cvsroot=src&r1=1.120&r2=1.121
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/configure.in.diff?cvsroot=src&r1=1.75&r2=1.76
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/sysdep.h.diff?cvsroot=src&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/ChangeLog.diff?cvsroot=src&r1=1.1813&r2=1.1814
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/alpha-dis.c.diff?cvsroot=src&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/alpha-opc.c.diff?cvsroot=src&r1=1.16&r2=1.17
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/avr-dis.c.diff?cvsroot=src&r1=1.24&r2=1.25
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/cgen-opc.c.diff?cvsroot=src&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/config.in.diff?cvsroot=src&r1=1.16&r2=1.17
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/configure.diff?cvsroot=src&r1=1.141&r2=1.142
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/configure.in.diff?cvsroot=src&r1=1.105&r2=1.106
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/cr16-dis.c.diff?cvsroot=src&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/cris-dis.c.diff?cvsroot=src&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/crx-dis.c.diff?cvsroot=src&r1=1.17&r2=1.18
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/d10v-dis.c.diff?cvsroot=src&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/d10v-opc.c.diff?cvsroot=src&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/d30v-dis.c.diff?cvsroot=src&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/d30v-opc.c.diff?cvsroot=src&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/h8500-dis.c.diff?cvsroot=src&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/i370-dis.c.diff?cvsroot=src&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/i370-opc.c.diff?cvsroot=src&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/m10200-dis.c.diff?cvsroot=src&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/m10300-dis.c.diff?cvsroot=src&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/micromips-opc.c.diff?cvsroot=src&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/mips-opc.c.diff?cvsroot=src&r1=1.91&r2=1.92
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/mips16-opc.c.diff?cvsroot=src&r1=1.17&r2=1.18
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/moxie-dis.c.diff?cvsroot=src&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/or32-opc.c.diff?cvsroot=src&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/pj-dis.c.diff?cvsroot=src&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/ppc-dis.c.diff?cvsroot=src&r1=1.56&r2=1.57
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/ppc-opc.c.diff?cvsroot=src&r1=1.142&r2=1.143
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/rl78-decode.c.diff?cvsroot=src&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/rl78-decode.opc.diff?cvsroot=src&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/rx-decode.c.diff?cvsroot=src&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/rx-decode.opc.diff?cvsroot=src&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/s390-dis.c.diff?cvsroot=src&r1=1.19&r2=1.20
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/sh-dis.c.diff?cvsroot=src&r1=1.28&r2=1.29
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/sh64-dis.c.diff?cvsroot=src&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/sparc-dis.c.diff?cvsroot=src&r1=1.22&r2=1.23
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/sparc-opc.c.diff?cvsroot=src&r1=1.28&r2=1.29
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/spu-dis.c.diff?cvsroot=src&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/sysdep.h.diff?cvsroot=src&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/tic30-dis.c.diff?cvsroot=src&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/tic54x-dis.c.diff?cvsroot=src&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/tic80-dis.c.diff?cvsroot=src&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/tic80-opc.c.diff?cvsroot=src&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/tilegx-dis.c.diff?cvsroot=src&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/tilepro-dis.c.diff?cvsroot=src&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/v850-dis.c.diff?cvsroot=src&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/v850-opc.c.diff?cvsroot=src&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/vax-dis.c.diff?cvsroot=src&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/w65-dis.c.diff?cvsroot=src&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/xgate-dis.c.diff?cvsroot=src&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/xtensa-dis.c.diff?cvsroot=src&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.912&r2=1.913
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/config.in.diff?cvsroot=src&r1=1.32&r2=1.33
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/configure.diff?cvsroot=src&r1=1.75&r2=1.76
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/configure.ac.diff?cvsroot=src&r1=1.72&r2=1.73
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/ChangeLog.diff?cvsroot=src&r1=1.1910&r2=1.1911
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/aclocal.m4.diff?cvsroot=src&r1=1.33&r2=1.34
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/config.in.diff?cvsroot=src&r1=1.36&r2=1.37
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/configure.diff?cvsroot=src&r1=1.146&r2=1.147
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/configure.in.diff?cvsroot=src&r1=1.110&r2=1.111
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/unwind-ia64.c.diff?cvsroot=src&r1=1.17&r2=1.18
Comment 4 Nick Clifton 2012-05-17 15:55:21 UTC
Hi Daniel,

  OK, you have persuaded me.  I have applied your patch to my local sources, fixed up all the places where it found problems with the order of header file inclusion and then checked in the resulting (rather large) patch.

  If you have any more problems with header file inclusion please reopen this PR.

Cheers
  Nick
Comment 5 Hans-Peter Nilsson 2012-05-17 17:27:15 UTC
(In reply to comment #4)
> Hi Daniel,
> 
>   OK, you have persuaded me.  I have applied your patch to my local sources,
> fixed up all the places where it found problems with the order of header file
> inclusion and then checked in the resulting (rather large) patch.

Looks like this patch caused breakage all over.  Please build crosses to e.g. arm-eabi and cris-elf.  A "make check" will show weird ERRORs for missing tools.  Looks like e.g. as-new isn't linked anymore.
Comment 6 Hans-Peter Nilsson 2012-05-17 18:15:38 UTC
Created attachment 6408 [details]
example libtool, this one for arm-eabi gas; objdir/gas/libtool

Looks like libtool for some programs (like gas) is now broken; truncated just before the code for func_dirname_and_basename (the head comment is there, the function not).  Nothing suspicious in the log around building it
Comment 7 Daniel Richard G. 2012-05-17 21:28:14 UTC
Created attachment 6409 [details]
Patch to fix remaining files in CVS

Nick, thank you for getting this in; I hope it'll make everyone's lives easier once the dust settles.

I'm not seeing the odd behavior that Roland McGrath attributed to incorrect configure regeneration, but then, I'm only testing with a bog-standard Linux/x86 build.

There are a handful of files still tripping the new checks. The attached patch against CVS resolves them for me.
Comment 8 Sourceware Commits 2012-05-18 10:29:18 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	nickc@sourceware.org	2012-05-18 10:29:12

Modified files:
	bfd            : ChangeLog bfd-in.h bfd-in2.h 

Log message:
	PR 14072
	* bfd-in.h: Check for PACKAGE or PACKAGE_VERSION before
	complaining about config.h not having been included.
	* bfd-in2.h: Regenerate.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5694&r2=1.5695
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/bfd-in.h.diff?cvsroot=src&r1=1.164&r2=1.165
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/bfd-in2.h.diff?cvsroot=src&r1=1.575&r2=1.576
Comment 9 Daniel Richard G. 2012-05-19 05:43:36 UTC
Created attachment 6413 [details]
Patch to fix remaining file in CVS

Looks like most of the files that my patch addressed in comment 7 have been fixed independently. Only one file remains.
Comment 10 Pawel Sikora 2012-06-14 18:25:35 UTC
include guard in <bfd.h> breaks e.g. oprofile build.
Comment 11 Alan Modra 2012-06-15 02:19:24 UTC
See #14243 re oprofile.