How to use bits_per_byte (~OCTETS_PER_BYTE) of bfd_arch_info_type in binutils port?

Alan Modra amodra@bigpond.net.au
Fri Aug 7 01:12:00 GMT 2009


On Fri, Aug 07, 2009 at 02:28:21AM +0200, Martin Walter wrote:
> Hi Alan,
> 
> >> but 'bfd_get16(location)' seems
> >> to be interpreting the location value as a byte index:
> >
> > Well why not?  After all, "location" just points into the section
> > contents, an array of bytes.
> Anyway, shouldn't location point to the right instruction?

Certainly.  If not, you have found a bug in the caller of
_bfd_final_link_relocate.

> > There are at least two other binutils ports that work with
> > OCTETS_PER_BYTE greater than one, tic4x and tic54x.  You should look
> > at them if you have not done so already.  Unfortunately, they are both
> > COFF.  The generic ELF code is missing some conversions between octets
> > and bytes (one such is on calls to bfd_set_section_contents in
> > elflink.c).  You get to fix it.  :-)
> I know about these architectures, but mine uses ELF so I did not dig
> too much into them. I am not that much into the binutils and it does
> not seem like this can be fixed easily. Have you got some more details
> on where these missing conversions could reside?

Apart from saying they are likely in elflink.c, no.  I found the
errors on bfd_set_section_contents calls by inspection when responding
to your email.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list