From owner-freebsd-amd64@FreeBSD.ORG Thu Sep 14 07:50:27 2006 Return-Path: X-Original-To: freebsd-amd64@hub.freebsd.org Delivered-To: freebsd-amd64@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C7E0316A417 for ; Thu, 14 Sep 2006 07:50:27 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6895D43D4C for ; Thu, 14 Sep 2006 07:50:27 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k8E7oRHY099730 for ; Thu, 14 Sep 2006 07:50:27 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k8E7oRtQ099729; Thu, 14 Sep 2006 07:50:27 GMT (envelope-from gnats) Date: Thu, 14 Sep 2006 07:50:27 GMT Message-Id: <200609140750.k8E7oRtQ099729@freefall.freebsd.org> To: freebsd-amd64@FreeBSD.org From: Ruslan Ermilov Cc: Subject: Re: amd64/102996: powerpc cross-build fails on amd64 host, works fine on i386 X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Ruslan Ermilov List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2006 07:50:28 -0000 The following reply was made to PR amd64/102996; it has been noted by GNATS. From: Ruslan Ermilov To: bug-followup@FreeBSD.org Cc: John Baldwin , Peter Grehan 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@FreeBSD.org FreeBSD committer