This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: binutils breaks on x64-pc-mingw32
On Thu, Aug 30, 2007 at 05:36:33AM -0700, H.J. Lu wrote:
> On Thu, Aug 30, 2007 at 07:16:59AM -0400, NightStrike wrote:
> > On 8/30/07, H.J. Lu <hjl@lucon.org> wrote:
> > > Can you try this patch?
> >
> > No change. Also broken is i686-pc-cygwin, for what it's worth.
>
> What is the error message? Did you regenerate configure?
>
>
There are several problems:
1. When we use AC_GNU_SOURCE, we shouldn't use -D_GNU_SOURCE.
2. We need to declare stpcpy if HAVE_DECL_STPCPY is 0.
3. config.h should be included first for _GNU_SOURCE to be
effective.
Can you try this patch?
Thanks.
H.J.
----
2007-08-30 H.J. Lu <hongjiu.lu@intel.com>
* Makefile.am (INCLUDES): Remove -D_GNU_SOURCE.
* Makefile.in: Regenerated.
* configure.in (AC_GNU_SOURCE): Added.
(AC_PROG_CC): Moved before AC_GNU_SOURCE.
(AC_CHECK_DECLS): Add stpcpy.
* configure: Regenerated.
* config.in: Likewise.
* i386-dis.c: Include "sysdep.h" before "dis-asm.h".
* sysdep.h (stpcpy): New.
--- opcodes/Makefile.am.stpcpy 2007-07-09 06:29:40.000000000 -0700
+++ opcodes/Makefile.am 2007-08-30 05:53:01.000000000 -0700
@@ -356,7 +356,7 @@ OFILES = @BFD_MACHINES@
# that's where the version number in Makefile comes from.
CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in
-INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(INCDIR) -I$(BFDDIR) @HDEFINES@ @INCINTL@
+INCLUDES = -I. -I$(srcdir) -I../bfd -I$(INCDIR) -I$(BFDDIR) @HDEFINES@ @INCINTL@
disassemble.lo: disassemble.c $(INCDIR)/dis-asm.h
$(LIBTOOL) --mode=compile $(COMPILE) -c @archdefs@ $(srcdir)/disassemble.c
--- opcodes/Makefile.in.stpcpy 2007-07-09 06:29:41.000000000 -0700
+++ opcodes/Makefile.in 2007-08-30 05:53:18.000000000 -0700
@@ -583,7 +583,7 @@ OFILES = @BFD_MACHINES@
# We should reconfigure whenever bfd/configure.in changes, because
# that's where the version number in Makefile comes from.
CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in
-INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(INCDIR) -I$(BFDDIR) @HDEFINES@ @INCINTL@
+INCLUDES = -I. -I$(srcdir) -I../bfd -I$(INCDIR) -I$(BFDDIR) @HDEFINES@ @INCINTL@
libopcodes_la_SOURCES = dis-buf.c disassemble.c dis-init.c
# It's desirable to list ../bfd/libbfd.la in DEPENDENCIES and LIBADD.
# Unfortunately this causes libtool to add -L$(libdir), referring to the
--- opcodes/config.in.stpcpy 2007-07-02 06:54:31.000000000 -0700
+++ opcodes/config.in 2007-08-30 05:52:18.000000000 -0700
@@ -8,6 +8,10 @@
don't. */
#undef HAVE_DECL_BASENAME
+/* Define to 1 if you have the declaration of `stpcpy', and to 0 if you don't.
+ */
+#undef HAVE_DECL_STPCPY
+
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
@@ -65,3 +69,8 @@
/* Version number of package */
#undef VERSION
+
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
--- opcodes/configure.in.stpcpy 2007-06-30 09:28:12.000000000 -0700
+++ opcodes/configure.in 2007-08-30 05:49:57.000000000 -0700
@@ -17,6 +17,9 @@ changequote([,])dnl
AM_INIT_AUTOMAKE(opcodes, ${BFD_VERSION})
+AC_PROG_CC
+AC_GNU_SOURCE
+
dnl These must be called before AM_PROG_LIBTOOL, because it may want
dnl to call AC_CHECK_PROG.
AC_CHECK_TOOL(AR, ar)
@@ -58,8 +61,6 @@ AC_EXEEXT
# host-specific stuff:
-AC_PROG_CC
-
ALL_LINGUAS="fr sv tr es da de id pt_BR ro nl fi vi ga zh_CN"
ZW_GNU_GETTEXT_SISTER_DIR
AM_PO_SUBDIRS
@@ -73,7 +74,7 @@ AC_PROG_INSTALL
AC_CHECK_HEADERS(string.h strings.h stdlib.h)
-AC_CHECK_DECLS(basename)
+AC_CHECK_DECLS([basename, stpcpy])
cgen_maint=no
cgendir='$(srcdir)/../cgen'
--- opcodes/i386-dis.c.stpcpy 2007-08-30 05:46:32.000000000 -0700
+++ opcodes/i386-dis.c 2007-08-30 05:57:53.000000000 -0700
@@ -33,8 +33,8 @@
and the small letter tells about the operand size. Refer to
the Intel manual for details. */
-#include "dis-asm.h"
#include "sysdep.h"
+#include "dis-asm.h"
#include "opintl.h"
#include "opcode/i386.h"
--- opcodes/sysdep.h.stpcpy 2007-07-05 06:21:02.000000000 -0700
+++ opcodes/sysdep.h 2007-08-30 05:55:32.000000000 -0700
@@ -42,3 +42,7 @@
#include <strings.h>
#endif
#endif
+
+#if !HAVE_DECL_STPCPY
+extern char *stpcpy (char *__dest, const char *__src);
+#endif