From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31916 invoked by alias); 16 Aug 2007 00:30:27 -0000 Received: (qmail 31823 invoked by uid 22791); 16 Aug 2007 00:30:26 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 16 Aug 2007 00:30:21 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 228CD98308; Thu, 16 Aug 2007 00:30:21 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 07E2B9812E; Thu, 16 Aug 2007 00:30:21 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.67) (envelope-from ) id 1ILTFi-0003uN-Lm; Wed, 15 Aug 2007 20:30:18 -0400 Date: Thu, 16 Aug 2007 00:30:00 -0000 From: Daniel Jacobowitz To: Marius Nita Cc: gdb@sourceware.org Subject: Re: a question Message-ID: <20070816003018.GA15009@caradoc.them.org> Mail-Followup-To: Marius Nita , gdb@sourceware.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.15 (2007-04-09) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-08/txt/msg00131.txt.bz2 On Wed, Aug 15, 2007 at 05:20:23PM -0700, Marius Nita wrote: > I have a rather specific question regarding the code below, which is > in bfd/aout-arm.c line 420. This code seems to deal with bit-level > endianness. E.g. a "char" address holding a bit pattern 00010000 > represents 0x10 on one endianness and 0x08 on the other. The r_length > left-shift below shifts data by 5 bits on big-endian and 1 bit on > little-endian. The r_length data will end up occupying 2 bits in the > natptr->r_type[0] byte. On big-endian, they'll be bits 6 and 7, and on > little-endian, they are bits 2 and 3. > > My question is: why aren't the bits in r_length "reversed" to conform > with bit-level endianness? For example, if the r_length bits are "10", > this left-shift results in "0100 0000" on big-endian and "0000 0100" > on little-endian. These bit strings are clearly not the reverse of > each other. Each byte is written out, one at a time. At that point there is no definition of "endianness". Bitfields are always special, since they are at finer than byte resolution. Try writing the obvious C struct equivalent of the data type, and think about how it's laid out in each endianness. I don't want to know what you're doing that involves ARM and a.out; whatever it is, use ELF instead :-) -- Daniel Jacobowitz CodeSourcery