This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: recent change broke gdb build


On 05/16/2012 06:47 PM, Tom Tromey wrote:

> 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.  


The issue is that bfd/mach-o.h now includes sysdeps.h, and GDB wants
to include mach-o.h.  (It's not bfd.h that includes sysdeps.h.)

I think bfd should not include sysdeps.h (of config.h) in headers
that might be used outside bfd.  Instead, the inclusion should be moved
to bfd's own .c files.  Looking at all the bfd files that include
macho.h, they're all already including sysdep.h:

mach-o.c-
mach-o.c-#include "sysdep.h"
mach-o.c:#include "mach-o.h"
mach-o.c-#include "bfd.h"
mach-o.c-#include "libbfd.h"
--
mach-o-i386.c-
mach-o-i386.c-#include "sysdep.h"
mach-o-i386.c:#include "mach-o.h"
mach-o-i386.c-#include "bfd.h"
mach-o-i386.c-#include "libbfd.h"
--
mach-o-x86-64.c-
mach-o-x86-64.c-#include "sysdep.h"
mach-o-x86-64.c:#include "mach-o.h"
mach-o-x86-64.c-#include "bfd.h"
mach-o-x86-64.c-#include "libbfd.h"

So reverting the sysdep.h inclusion from mach-o.h is enough to
fix this.  Patch below.

> 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.


The usual way to do that is to share an .m4 file.


2012-05-16  Pedro Alves  <palves@redhat.com>

	* mach-o.h: Don't include sysdep.h.
---

 bfd/mach-o.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/bfd/mach-o.h b/bfd/mach-o.h
index 67ee43d..7f54961 100644
--- a/bfd/mach-o.h
+++ b/bfd/mach-o.h
@@ -23,7 +23,6 @@
 #ifndef _BFD_MACH_O_H_
 #define _BFD_MACH_O_H_

-#include "sysdep.h"
 #include "bfd.h"
 #include "mach-o/loader.h"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]