Re: [PATCH 2/4] Add a dwarf unit type to represent 24 bit values.

Simon Marchi
2018-09-27T17:53:47Z

On 2018-09-27 01:49, John Darrington wrote:
> On Wed, Sep 26, 2018 at 10:53:34PM -0400, Simon Marchi wrote:
> On 2018-09-26 13:41, John Darrington wrote:
> > After discussion with the gcc folks, it seems that there is an
> easier
> > and much simpler solution, which I'm attaching.
> >
> > J'
>
> Err can you explain how this works, or link to the gcc discussion
> if it's
> explained there? I must be missing something, because as far as I
> understand, this will read 4 bytes when reading an address, when I
> suppose it's encoded with 3 bytes in the DWARF info, isn't it?
>
> Simon
>
> The relevant discussion is here:
> https://gcc.gnu.org/ml/gcc-patches/2018-09/msg00712.html
>
> The bottom line is that the dwarf address size does not need to
> correspond to the machine address size (and in general it does not) -
> it just needs to be at least as long.

After a short discussion with John on IRC, what I understand is that the
debug info he is dealing with encodes the 24-bit addresses on 32-bits,
with the most significant byte equal to zero. Therefore that revised
patch looks ok to me. I would just ask you to add a comment explaining
that this "case" exists for producer XYZ on S12Z, which encodes 24 bit
addresses on 32 bits. Maybe that in the future somebody will stumble on
a producer that encodes 24 bit addresses on 24 bits. Having an
explanation for why things are the way they are will help.

Thanks,

Simon