From owner-freebsd-amd64@FreeBSD.ORG Thu Mar 31 18:07:26 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 C763716A4CE for ; Thu, 31 Mar 2005 18:07:26 +0000 (GMT) Received: from ipe.cnpm.embrapa.br (ipe.cnpm.embrapa.br [200.136.111.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7E6D143D2F for ; Thu, 31 Mar 2005 18:07:20 +0000 (GMT) (envelope-from pan@cnpm.embrapa.br) Received: from localhost (localhost.cnpm.embrapa.br [127.0.0.1]) by ipe.cnpm.embrapa.br (Postfix) with ESMTP id 19C1784499 for ; Thu, 31 Mar 2005 15:07:18 -0300 (BRT) Received: from [200.136.111.44] (oliveira.cnpm.embrapa.br [200.136.111.44]) by ipe.cnpm.embrapa.br (Postfix) with ESMTP id 7B3168447D for ; Thu, 31 Mar 2005 15:07:16 -0300 (BRT) Message-ID: <424C3C98.30602@cnpm.embrapa.br> Date: Thu, 31 Mar 2005 15:08:24 -0300 From: "Carlos F. A. Paniago" User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050328) X-Accept-Language: pt-br, pt MIME-Version: 1.0 To: freebsd-amd64@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd 0.1 Subject: 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 18:07:26 -0000 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??? Paniago -- Nome: Carlos Fernando Assis Paniago Email: pan@cnpm.embrapa.br Fone: +55 (19) 3256-60-30 Web: http://www.cnpm.embrapa.br/ Fax: +55 (19) 3254-11-00 --