Re: Use the address mask with addresses for SREC, etc.

Jim Blandy
2007-07-27T20:22:43Z

"Maciej W. Rozycki" <macro@mips.com> writes:
> On Wed, 25 Jul 2007, Jim Blandy wrote:
>> have any idea that it's a MIPS SREC file? It looks like
>> bfd_get_sign_extend_vma doesn't know about MIPS SREC targets; would
>> fixing that, and then bfd/srec.c, help us get the right addresses into
>> the BFD?
>
> Well, AFAICS SREC and HEX files are target-agnostic, much like "binary"
> BFD. The only possible way of handling it in BFD itself would be by
> sign-extending addresses at the "right point" if the destination BFD
> implies bfd_get_sign_extend_vma() true. I somehow dislike hardcoding the
> "right point" in {ihex,srec,tekhex}.c, but given these formats appear to
> me as pure 32-bit, perhaps chosing bit 31 as the "right point" is OK.
> What do you think?

For srec.c, that seems reasonable to me. The logic there for writing
records will always output "negative" addresses as 32-bit values ---
it does not assume that s-records with two- or three-byte addresses
will be sign-extended from those lengths. I haven't looked at ihex or
texhex.

The binutils folks will be the ones to approve the BFD changes, so
before you dive into this, you might want to explain your situation
there and get their general approval. They might even have better
ideas. :)