This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ELF octets_per_byte

On Wed, 24 Feb 2016, Cary Coutant wrote:

> > While binutils has support for an "octets_per_byte" value other than
> > one, this feature does not appear to be fully supported.  Indeed, the
> > "bfd/elflink.c" file contains several "FIXME" lines regarding the
> > insufficiency of the current support.
> It doesn't seem to me that having a minimum addressable unit of
> 32-bits necessarily makes your byte size 32 bits. That would actually
> surprise me quite a lot. You've simply described a word-addressed
> machine, and it would be quite sensible to continue to have four 8-bit
> bytes in each of those 32-bit words. Does your C compiler evaluate
> sizeof(void *) to 1 or to 4?

 Your understanding of bytes however seems to me contradicted by the C 
language standard[1]:



addressable unit of data storage large enough to hold any member of the 
basic character set of the execution environment

NOTE 1  It is possible to express the address of each individual byte of 
an object uniquely.

NOTE 2  A byte is composed of a contiguous sequence of bits, the number of 
which is implementation-defined.  The least significant bit is called the 
low-order bit; the most significant bit is called the high-order bit."

-- notice how the standard explicitly states that a byte is an addressable 
unit and that individual bytes have unique addresses.  This means that you 
cannot squeeze multiple bytes into a single addressable word in a 
word-addressed machine, because by doing so -- by definition -- you have 
no means to address the individual bytes.

 NB this is different from a byte-addressable machine which can only 
access memory in larger quantities you could refer to as "words" such as 
early DEC Alpha (EV4, EV45) processors.  While they could not access 
individual bytes addresses were still multiples of 4, so conceptually you 
could assign addresses to individual bytes.  In fact for many (most?) 
modern machines that have their data bus wider than a byte individual byte 
addresses are indeed conceptual only as they're never observed in the 
address cycle and lane enables are used instead in the data cycle.


[1] "Programming languages -- C", ISO/IEC 9899:201x, Committee Draft -- 
    April 12, 2011, p. 4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]