From owner-freebsd-amd64@FreeBSD.ORG Thu Mar 31 23:07:06 2005 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 724C116A4D3 for ; Thu, 31 Mar 2005 23:07:06 +0000 (GMT) Received: from mail28.sea5.speakeasy.net (mail28.sea5.speakeasy.net [69.17.117.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1F85A43D49 for ; Thu, 31 Mar 2005 23:07:06 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: (qmail 14254 invoked from network); 31 Mar 2005 23:07:06 -0000 Received: from server.baldwin.cx ([216.27.160.63]) (envelope-sender )AES256-SHA encrypted SMTP for ; 31 Mar 2005 23:07:05 -0000 Received: from [10.50.41.231] (gw1.twc.weather.com [216.133.140.1]) (authenticated bits=0) by server.baldwin.cx (8.13.1/8.13.1) with ESMTP id j2VN6iQV028069; Thu, 31 Mar 2005 18:06:58 -0500 (EST) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: freebsd-amd64@FreeBSD.org Date: Thu, 31 Mar 2005 17:27:44 -0500 User-Agent: KMail/1.6.2 References: <424C3C98.30602@cnpm.embrapa.br> In-Reply-To: <424C3C98.30602@cnpm.embrapa.br> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <200503311727.44841.jhb@FreeBSD.org> X-Spam-Status: No, score=-102.8 required=4.2 tests=ALL_TRUSTED, USER_IN_WHITELIST autolearn=failed version=3.0.2 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on server.baldwin.cx cc: "Carlos F. A. Paniago" Subject: Re: fstatfs break in amd64 ia32 emulation X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Mar 2005 23:07:06 -0000 On Thursday 31 March 2005 01:08 pm, Carlos F. A. Paniago wrote: > hi: > I'm tring to compile in an amd64 and running in an i386.. I read in the > list that is not possible, but some things work if we compile using: > gcc -Di386 -D__i386__ -Uamd64 -U__amd64__ -m32 -B/lib32 -B/usr/lib32 -g > -o test-i386.amd test-i386.c > some simple program could be compiled in an amd64 machine and run in a > i386 machine. > but this program don't work: > -- > #include > #include > #include > #include > > int main(int argc, char** argv) > { > struct statfs buf; > > if (fstatfs(0, &buf) < 0) { > perror("fstatfs"); > } > > printf("%d %d\n", sizeof(buf), sizeof(&buf)); > return 0; > } > -- > the result is: > --- > ipe# ./test-i386 > 472 4 > ipe# ./test-i386.amd > 384 4 > Segmentation fault (core dumped) > ipe# > --- > this ipe machine is an i386 machine... the ./test-i386 is compiled in > this machine as > gcc -g -o test-i386 test-i386.c > and the ./test-i386.amd is compiled in an amd64 using: gcc -Di386 > -D__i386__ -Uamd64 -U__amd64__ -m32 -B/lib32 -B/usr/lib32 -g -o > test-i386.amd test-i386.c > The strange thing is the size of struct statfs that changes... If I > compile this in an amd64 machine (oliveira is an amd64 machine) > --- > oliveira: {248} gcc -g -o test-i386.amd test-i386.c > oliveira: {249} ./test-i386.amd > 472 8 > oliveira: {250} > --- > strange the size of the struct is the same as in i386 and the size of > the pointer is 8 (instead of 4), but in the compilation using the -m32 > the sizeof is strange... Someone know how to solve this problem??? You need to be using a different /usr/include, specifically a different /usr/include/machine (one from an i386 machine) when trying to compile -m32. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org