[PATCH] Fix sleb128 encoding for difference expressions

Jan Beulich JBeulich@suse.com
Mon Nov 12 08:01:00 GMT 2012


>>> On 09.11.12 at 18:57, Julian Brown <julian@codesourcery.com> wrote:
> On Thu, 8 Nov 2012 14:02:19 +0000 Jan Beulich <JBeulich@suse.com> wrote:
>> >>> On 08.11.12 at 14:05, Julian Brown <julian@codesourcery.com>
>> I could see your change being correct for the <symbol> -
>> <symbol> case, but certainly not for <constant> - <constant>
>> (<symbol> - <constant> being questionable).
> 
> I'm not sure I understand this comment. Note that <constant> -
> <constant> is just as broken at the moment for .sleb128...

It may be as broken, but that's not my point. The point is that,
without type information, there's no way for you to guess whether
a difference between constants in particular (but possibly not
limited to this) is meant to be signed or unsigned, as you can't
guess whether or not the programmer intended to make use of
wraparound (I assume you realize that one can detect the
width the assembler uses for calculations, and adjust code - e.g.
through macros - accordingly).

So before proposing any solutions, I think you first need to
propose a scheme how things are intended to work. That's
particularly being complicated by the fact that .sleb128 can
encode arbitrarily large numbers, whereas calculations are
being done at fixed widths (i.e. you specifically can't use the top
bit of a number to tell its signed-ness - that's why I believe the
X_unsigned flag got introduced in the first place).

And if this scheme involves _any_ changes to the generic
expression evaluation code, you would also have to make clear
why that would be correct (specifically not causing regressions)
for all other contexts using that code.

Jan



More information about the Binutils mailing list