From owner-freebsd-current@FreeBSD.ORG Wed Jan 31 22:42:56 2007 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 93E1816A400 for ; Wed, 31 Jan 2007 22:42:56 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.183]) by mx1.freebsd.org (Postfix) with ESMTP id 73CAA13C4B3 for ; Wed, 31 Jan 2007 22:42:54 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from mac.com (smtpin07-en2 [10.13.10.152]) by smtpout.mac.com (Xserve/8.12.11/smtpout13/MantshX 4.0) with ESMTP id l0VMgdID011232; Wed, 31 Jan 2007 14:42:39 -0800 (PST) Received: from [192.168.1.2] (c-67-164-11-148.hsd1.ca.comcast.net [67.164.11.148]) (authenticated bits=0) by mac.com (Xserve/smtpin07/MantshX 4.0) with ESMTP id l0VMgakQ027597 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 31 Jan 2007 14:42:38 -0800 (PST) In-Reply-To: <20070130132839.GA1052@rambler-co.ru> References: <45B97535.5070900@delphij.net> <45B997ED.7000605@delphij.net> <45B99C6E.2030803@delphij.net> <1C63ACE4-DD1E-4FDB-A36B-F3D9650773EF@mac.com> <45B9AA00.3030906@delphij.net> <20070130132839.GA1052@rambler-co.ru> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <5DC1BBA2-94E6-4A32-B000-498244D7BB30@mac.com> Content-Transfer-Encoding: 7bit From: Marcel Moolenaar Date: Wed, 31 Jan 2007 14:41:12 -0800 To: Ruslan Ermilov X-Mailer: Apple Mail (2.752.3) X-Brightmail-Tracker: AAAAAA== X-Brightmail-scanned: yes Cc: FreeBSD Current , LI Xin Subject: Re: PowerPC port broken? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2007 22:42:56 -0000 On Jan 30, 2007, at 5:28 AM, Ruslan Ermilov wrote: >>>> Latest build shows this: >>>> >>>> (What does Assembler messages: >>>> FATAL: can't create crtbegin.o: Invalid bfd target >>>> mean for me, by the way?) >>> >> > We've a fix for this problem since last summer. > See PR amd64/102996 for details and the patch. > > Please don't ask me about committing it into > our Binutils. :-) The fix is actually wrong but happen to do the right thing. BFD_DEFAULT_TARGET_SIZE is used outside of the libbfd directory. It is references by gas/config/tc-ppc.c and opcodes/ppc-dis.c. Within BFD it is also referenced only for PowerPC, which is why this problem only exists for PowerPC. The fixes in the PR only define TARGET_64BIT in the libbfd Makefile, which means that BFD_DEFAULT_TARGET_SIZE may not get the right definitions when used by sources outside the libbfd directory. A good fix in our context is to define it BFD_DEFAULT_TARGET_SIZE as 32 unconditionally in bfd.h. Since the define is only referenced for PowerPC targets and our PowerPC target is 32-bit only, e.g: Index: libbfd/bfd.h =================================================================== RCS file: /home/ncvs/src/gnu/usr.bin/binutils/libbfd/bfd.h,v retrieving revision 1.3 diff -u -r1.3 bfd.h --- libbfd/bfd.h 8 Jul 2004 17:05:32 -0000 1.3 +++ libbfd/bfd.h 31 Jan 2007 22:30:30 -0000 @@ -56,16 +56,14 @@ been selected with --enable-targets, or if --enable-64-bit-bfd. */ #define BFD_ARCH_SIZE 64 +/* The word size of the default PowerPC bfd target. */ +#define BFD_DEFAULT_TARGET_SIZE 32 #if defined(__i386__) || defined(__powerpc__) || defined(__arm__) -/* The word size of the default bfd target. */ -#define BFD_DEFAULT_TARGET_SIZE 32 #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 A better fix would be to define BFD_DEFAULT_TARGET_SIZE in the top- level Makefile so that the definition can be used everywhere within the binutils sources. It's setting can be made dependent upon TARGET_ARCH. This makes sure that future imports of binutils where BFD_DEFAULT_TARGET_SIZE may be referenced for more targets will work in this respect, e.g: Index: Makefile.inc0 =================================================================== RCS file: /home/ncvs/src/gnu/usr.bin/binutils/Makefile.inc0,v retrieving revision 1.37 diff -u -r1.37 Makefile.inc0 --- Makefile.inc0 8 Jul 2004 17:05:30 -0000 1.37 +++ Makefile.inc0 31 Jan 2007 22:39:14 -0000 @@ -22,6 +22,12 @@ RELSRC= ${RELTOP}/../../../contrib/binutils SRCDIR= ${.CURDIR}/${RELSRC} +.if ${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "i386" || $ {TARGET_ARCH} == "powerpc" +CFLAGS+= -DBFD_DEFAULT_TARGET_SIZE=32 +.else +CFLAGS+= -DBFD_DEFAULT_TARGET_SIZE=64 +.endif + CFLAGS+= -I. .if exists(${.CURDIR}/${TARGET_ARCH}) CFLAGS+= -I${.CURDIR}/${TARGET_ARCH} Index: libbfd/bfd.h =================================================================== RCS file: /home/ncvs/src/gnu/usr.bin/binutils/libbfd/bfd.h,v retrieving revision 1.3 diff -u -r1.3 bfd.h --- libbfd/bfd.h 8 Jul 2004 17:05:32 -0000 1.3 +++ libbfd/bfd.h 31 Jan 2007 22:38:32 -0000 @@ -58,14 +58,10 @@ #if defined(__i386__) || defined(__powerpc__) || defined(__arm__) -/* The word size of the default bfd target. */ -#define BFD_DEFAULT_TARGET_SIZE 32 #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 -- Marcel Moolenaar xcllnt@mac.com