From owner-freebsd-current@FreeBSD.ORG Mon Mar 8 01:11:46 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9426E16A4CE; Mon, 8 Mar 2004 01:11:46 -0800 (PST) Received: from tigra.ip.net.ua (tigra.ip.net.ua [82.193.96.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id F40D543D31; Mon, 8 Mar 2004 01:11:44 -0800 (PST) (envelope-from ru@ip.net.ua) Received: from heffalump.office.ipnet (heffalump.ip.net.ua [82.193.96.213]) by tigra.ip.net.ua (8.12.10/8.12.9) with ESMTP id i289F41t023932 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 8 Mar 2004 11:15:05 +0200 (EET) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.office.ipnet (8.12.11/8.12.11) id i289BbEL028249; Mon, 8 Mar 2004 11:11:37 +0200 (EET) (envelope-from ru) Date: Mon, 8 Mar 2004 11:11:37 +0200 From: Ruslan Ermilov To: Francois Tigeot Message-ID: <20040308091137.GC28067@ip.net.ua> References: <20040304175103.GA36195@ares.wolfpond.org> <20040307175852.GD40161@ares.wolfpond.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="IDYEmSnFhs3mNXr+" Content-Disposition: inline In-Reply-To: <20040307175852.GD40161@ares.wolfpond.org> User-Agent: Mutt/1.5.6i X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) cc: Alexander Kabaev cc: freebsd-current@FreeBSD.org cc: freebsd-amd64@FreeBSD.org cc: David O'Brien Subject: Re: Cross-compilation to i386 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 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: Mon, 08 Mar 2004 09:11:46 -0000 --IDYEmSnFhs3mNXr+ Content-Type: multipart/mixed; boundary="JgQwtEuHJzHdouWu" Content-Disposition: inline --JgQwtEuHJzHdouWu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Mar 07, 2004 at 06:58:53PM +0100, Francois Tigeot wrote: > [copy to -current since it may be of help to other freebsd ports] >=20 > On Thu, Mar 04, 2004 at 06:51:03PM +0100, Francois Tigeot wrote: > >=20 > > I'm currently running a 5.2.1-RELEASE/amd64 system and I'm trying to > > cross-build an i386 world with the following command : > >=20 > > time nice make buildworld TARGET_ARCH=3Di386 DESTDIR=3D/itx > >=20 > > This fails miserably with these error messages : > >=20 > > cc -Os -march=3Dc3 -fno-strict-aliasing -pipe -I/usr/src/sbin/gbde/../.= =2E/sys -DRESCUE -Wsystem -headers -Werror -Wall -Wno-format-y2k -W -Wstric= t-prototypes -Wmissing-prototypes -Wpointer -arith -Wreturn-type -Wcast-qua= l -Wwrite-strings -Wswitch -Wshadow -Wcast-align -c /usr/src/sys/crypto/sh= a2/sha2.c > > {standard input}: Assembler messages: > > {standard input}:92: Error: bignum invalid > > {standard input}:93: Error: bignum invalid > > [more bignum invalid lines] >=20 > I've managed to make it work. >=20 > The 'bignum invalid' error is caused by this type of gcc-generated > assembly code : >=20 > .quad 8158064640168781261 > .quad -5349999486874862801 >=20 > For some reason, as doesn't like big negative numbers. >=20 I use the attached patch to cross-compile world for 64-bit machines. > This is what I did : >=20 > - I installed a stock copy of binutils compiled with > --target=3Di386-freebsd and --enable-64-bit-bfd >=20 > - I initiated a buildworld to populate /usr/obj >=20 > - After the first build failure, I replaced /usr/obj/i386/usr/src/amd64/= usr/bin/as > with the new assembler, protecting it by a chflags command >=20 > The world and kernel builds then completed succesfully. The new i386 kern= el > boots on a diskless machine. >=20 > Now, I understand a new binutils import was scheduled before 5.3-RELEASE. > Is there any reason not to compile it with the '--enable-64-bit-bfd' > option on 64-bit architectures ? >=20 Nice to hear there are other options that do not require patching. David, any chance you can investigate the effect of enabling the --enable-64-bit-bfd knob? Cheers, --=20 Ruslan Ermilov FreeBSD committer ru@FreeBSD.org --JgQwtEuHJzHdouWu Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gas.diff" Content-Transfer-Encoding: quoted-printable Index: expr.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/contrib/binutils/gas/expr.c,v retrieving revision 1.1.1.7 diff -u -r1.1.1.7 expr.c --- expr.c 11 Oct 2002 06:00:09 -0000 1.1.1.7 +++ expr.c 2 Feb 2003 03:06:50 -0000 @@ -37,6 +37,7 @@ #ifdef BFD64 static valueT generic_bignum_to_int64 PARAMS ((void)); #endif +static void bignum_negate PARAMS ((expressionS *)); static void integer_constant PARAMS ((int radix, expressionS * expressionP= )); static void mri_char_constant PARAMS ((expressionS *)); static void current_location PARAMS ((expressionS *)); @@ -756,6 +757,40 @@ } } =20 +/* In: An expressionP for a bignum to negate. + + Out: A negated expressionP. + && exp->X_add_number =3D=3D 0 + && symbol_get_value_expression (exp->X_add_symbol)->X_op =3D=3D O_big +*/ + +static void +bignum_negate (exp) + expressionS *exp; +{ + int i; + unsigned long carry; + + /* Negate the bignum: one's complement each digit and add 1. */ + carry =3D 1; + for (i =3D 0; i < exp->X_add_number; i++) + { + unsigned long next; + + next =3D (((~(generic_bignum[i] & LITTLENUM_MASK)) + & LITTLENUM_MASK) + + carry); + generic_bignum[i] =3D next & LITTLENUM_MASK; + carry =3D next >> LITTLENUM_NUMBER_OF_BITS; + } + + if (carry > 0) + { + generic_bignum[exp->X_add_number] =3D carry; + exp->X_add_number ++; + } +} + /* In: Input_line_pointer points to 1st char of operand, which may be a space. =20 @@ -1082,14 +1117,24 @@ else if (expressionP->X_op !=3D O_illegal && expressionP->X_op !=3D O_absent) { - expressionP->X_add_symbol =3D make_expr_symbol (expressionP); if (c =3D=3D '-') - expressionP->X_op =3D O_uminus; + { + if (expressionP->X_op =3D=3D O_big + && expressionP->X_add_number > 0) + bignum_negate(expressionP); + else + expressionP->X_op =3D O_uminus; + } else if (c =3D=3D '~' || c =3D=3D '"') expressionP->X_op =3D O_bit_not; else expressionP->X_op =3D O_logical_not; - expressionP->X_add_number =3D 0; + + if (expressionP->X_op !=3D O_big) + { + expressionP->X_add_number =3D 0; + expressionP->X_add_symbol =3D make_expr_symbol (expressionP); + } } else as_warn (_("Unary operator %c ignored because bad operand follows"), --JgQwtEuHJzHdouWu-- --IDYEmSnFhs3mNXr+ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFATDjJUkv4P6juNwoRAts4AKCIiGbzI1Vu7WFJjmPVj2ujE4NvxACfRALH laKiWJr4hbpPn3+2Uiszskc= =zeuK -----END PGP SIGNATURE----- --IDYEmSnFhs3mNXr+--