amd64/102996: powerpc cross-build fails on amd64 host,
works fine on i386
Ruslan Ermilov
ru at FreeBSD.org
Thu Sep 14 00:50:28 PDT 2006
The following reply was made to PR amd64/102996; it has been noted by GNATS.
From: Ruslan Ermilov <ru at FreeBSD.org>
To: bug-followup at FreeBSD.org
Cc: John Baldwin <jhb at FreeBSD.org>, Peter Grehan <grehan at FreeBSD.org>
Subject: Re: amd64/102996: powerpc cross-build fails on amd64 host, works fine on i386
Date: Thu, 14 Sep 2006 11:49:37 +0400
On Fri, Sep 08, 2006 at 11:10:52AM -0400, John Baldwin wrote:
> On Thursday 07 September 2006 17:51, Peter Grehan wrote:
> > %%%
> > Index: Makefile
> > ===================================================================
> > RCS file: /home/ncvs/src/gnu/usr.bin/binutils/libbfd/Makefile,v
> > retrieving revision 1.33
> > diff -u -r1.33 Makefile
> > --- Makefile 24 Oct 2004 15:32:25 -0000 1.33
> > +++ Makefile 26 Aug 2006 00:48:26 -0000
> > @@ -48,6 +48,12 @@
> > CFLAGS+= -DSELECT_VECS="${SELVEC}"
> > CFLAGS+= -DDEFAULT_VECTOR=${DEFAULT_VECTOR}
> >
> > +.if ${TARGET_ARCH:M*64}
> > +CFLAGS+= -DTARGET_64BIT=1
> > +.else
> > +CFLAGS+= -DTARGET_64BIT=0
> > +.endif
> > +
>
> This doesn't match alpha (though that only matters if you MFC this). Seems
> that a more general purpose solution would be to test TARGET_ARCH and use
> that to set TARGET properties
>
I just quickly prototyped the patch back then. How's this instead?
%%%
Index: Makefile
===================================================================
RCS file: /home/ncvs/src/gnu/usr.bin/binutils/libbfd/Makefile,v
retrieving revision 1.33
diff -u -p -u -r1.33 Makefile
--- Makefile 24 Oct 2004 15:32:25 -0000 1.33
+++ Makefile 14 Sep 2006 07:45:19 -0000
@@ -48,6 +48,14 @@ SELVEC+= ,&${_v}
CFLAGS+= -DSELECT_VECS="${SELVEC}"
CFLAGS+= -DDEFAULT_VECTOR=${DEFAULT_VECTOR}
+.if ${DEFAULT_VECTOR:Mbfd_elf64_*}
+CFLAGS+= -DTARGET_64BIT=1
+.elif ${DEFAULT_VECTOR:Mbfd_elf32_*}
+CFLAGS+= -DTARGET_64BIT=0
+.else
+.error unknown DEFAULT_VECTOR=${DEFAULT_VECTOR}
+.endif
+
# XXX:DEO should grab BFD_VERSION_DATE from ${VERSION}...
bfdver.h: Makefile
echo '#define BFD_VERSION 215000000' > ${.TARGET}
Index: bfd.h
===================================================================
RCS file: /home/ncvs/src/gnu/usr.bin/binutils/libbfd/bfd.h,v
retrieving revision 1.3
diff -u -p -u -r1.3 bfd.h
--- bfd.h 8 Jul 2004 17:05:32 -0000 1.3
+++ bfd.h 14 Sep 2006 07:34:28 -0000
@@ -57,15 +57,18 @@ extern "C" {
#define BFD_ARCH_SIZE 64
-#if defined(__i386__) || defined(__powerpc__) || defined(__arm__)
/* The word size of the default bfd target. */
+#if TARGET_64BIT
+#define BFD_DEFAULT_TARGET_SIZE 64
+#else
#define BFD_DEFAULT_TARGET_SIZE 32
+#endif
+
+#if defined(__i386__) || defined(__powerpc__) || defined(__arm__)
#define BFD_HOST_64BIT_LONG 0
#define BFD_HOST_64_BIT long long
#define BFD_HOST_U_64_BIT unsigned long long
#elif defined(__alpha__) || defined(__sparc64__) || defined(__amd64__) || defined(__ia64__)
-/* The word size of the default bfd target. */
-#define BFD_DEFAULT_TARGET_SIZE 64
#define BFD_HOST_64BIT_LONG 1
#define BFD_HOST_64_BIT long
#define BFD_HOST_U_64_BIT unsigned long
%%%
> (i.e. the bug seems to be that it's setting
> TARGET properties based on the host arch, which is wrong).
>
Exactly!
Cheers,
--
Ruslan Ermilov
ru at FreeBSD.org
FreeBSD committer
More information about the freebsd-amd64
mailing list