ELF octets_per_byte

Dan dgisselq@verizon.net
Tue Feb 23 15:50:00 GMT 2016


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:
https://opencores.org/project,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.

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 purpose of beginning a discussion, and based upon a reading of
the ELF specification, I propose the following values be in units of
"octets":

section size
section header size
section header offset

For the most part, these values *must* be in octets, or it will be
impossible to read and process an ELF file.

I also propose that the following values are in units of target address
space "bytes":

ELF header "entry" address
section header address
symbol value
symbol size
relocation offset
relocation addend

Using this definition, applications of "bfd_octets_per_byte()" can be
applied to convert units from one to the other as necessary.

Comments?  Are there any values that I have missed?

Thanks,

Dan





More information about the Binutils mailing list