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 02/23/2016 03:50 PM, Dan wrote:
> Hello!
> I am in the process of trying to port binutils to a new architecture,
> the ZipCPU.  (You can find a description of it here:
>,zipcpu)  One unique "feature" of this
> processor is that the size of the minimum addressable unit is 32-bits.
> 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.

GDB 7.11 gained support for this, though I'm not aware of any bfd-side

>From gdb/NEWS:

* Support for reading/writing memory and extracting values on architectures
  whose memory is addressable in units of any integral multiple of 8 bits.

> All of these can be easily fixed, and I would like to propose a patch
> (or series of patches) to do this.  The first part of this process will
> need to be identifying which ELF variables/values are "bytes" (units of
> the targets address space), and which are "octets" (8-bit values, units
> of the more commonly used address space).  Sadly, these units are not
> consistent with the meaning of "bytes" found within the ELF
> specification, nor can they be since the ELF specification does not
> acknowledge the potential difference between these two.

For the sake of tree-wide consistency, please consider sharing
nomenclature with gdb.

Grep for "memory_unit_size" and "unit size" under src/gdb/ .


     Since this field is expressed in host bytes, its value is appropriate
     to pass to memcpy and such (it is assumed that GDB itself always runs
     on an 8-bits addressable architecture).  However, when using it for
     target address arithmetic (e.g. adding it to a target address), the
     type_length_units function should be used in order to get the length
     expressed in target addressable memory units.  */

  unsigned int length;


# Return the size in 8-bit bytes of an addressable memory unit on this
# architecture.  This corresponds to the number of 8-bit bytes associated to
# each address in memory.


Pedro Alves

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