From owner-freebsd-questions@FreeBSD.ORG Tue Jan 12 21:47:28 2010 Return-Path: Delivered-To: FreeBSD-Questions@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51560106566C for ; Tue, 12 Jan 2010 21:47:28 +0000 (UTC) (envelope-from freebsd-questions-local@be-well.ilk.org) Received: from mail2.sea5.speakeasy.net (mail2.sea5.speakeasy.net [69.17.117.4]) by mx1.freebsd.org (Postfix) with ESMTP id 2A18C8FC13 for ; Tue, 12 Jan 2010 21:47:27 +0000 (UTC) Received: (qmail 23164 invoked from network); 12 Jan 2010 21:47:27 -0000 Received: from dsl092-078-145.bos1.dsl.speakeasy.net (HELO be-well.ilk.org) ([66.92.78.145]) (envelope-sender ) by mail2.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 12 Jan 2010 21:47:27 -0000 Received: by be-well.ilk.org (Postfix, from userid 1147) id 8E7235082B; Tue, 12 Jan 2010 16:47:25 -0500 (EST) From: Lowell Gilbert To: Kaya Saman References: <20100112210427.GB18673@Grumpy.DynDNS.org> <4B4CE9B1.4040508@netscape.net> Date: Tue, 12 Jan 2010 16:47:25 -0500 In-Reply-To: <4B4CE9B1.4040508@netscape.net> (Kaya Saman's message of "Tue, 12 Jan 2010 23:29:21 +0200") Message-ID: <44hbqrm1w2.fsf@be-well.ilk.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Rob Farmer , FreeBSD-Questions@FreeBSD.org Subject: Re: Endianness X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: FreeBSD-Questions@FreeBSD.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jan 2010 21:47:28 -0000 Kaya Saman writes: > David Kelly wrote: >> On Tue, Jan 12, 2010 at 12:51:00PM -0800, Rob Farmer wrote: >> >>> I'm trying to create a port of an application which only works on >>> little endian systems and I'm trying to figure out how to set >>> ONLY_FOR_ARCHS. Wikipedia says PowerPC, Sparc, and IA64 are bi-endian >>> and the OS chooses the mode. I'm not familiar with these platforms - >>> I'm sure it has been answered somewhere, but I can't find it - which >>> FreeBSD archs are little/big endian? Thanks. >>> >> >> i386 is little endian. Would expect ia64 to be the same. >> >> > > SPARC is big endian. Or at least it used to be..... > > Power4,5,6 are all big endian too if I'm not mistaken. > > Correct me if I'm wrong but anything based around the CISC > architecture is big endian. As the original poster observed, PowerPC, Sparc and IA64 are all capable of being used in either endian setting. I checked endian.h, and it looks as though FreeBSD uses Sparc as big-endian, IA64 as little-endian, and PowerPC as whatever it picks up from gcc (probably big-endian, since the architecture does funny things with alignment in little-endian mode. My best advice, though, is to suggest that Mr. Farmer shouldn't assume that the application will work anywhere without actually trying it. -- Lowell Gilbert, embedded/networking software engineer, Boston area http://be-well.ilk.org/~lowell/