[llvm-commits] [llvm] r97183 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp

Duncan Sands baldrick at free.fr
Fri Feb 26 02:09:17 PST 2010


Hi Bill,

> Catch a corner case where adding the padding to the "TType base offset" field
> will eliminate the need for padding in the "Call site table length". E.g., if
> we have this:
>
>      GCC_except_table1:
>      Lexception1:
>          .byte   0xff  ## @LPStart Encoding = omit
>          .byte   0x9b  ## @TType Encoding = indirect pcrel sdata4
>          .byte   0x7f  ## @TType base offset
>          .byte   0x03  ## Call site Encoding = udata4
>          .byte   0x89  ## Call site table length
>
> with padding of 1. We want to emit the padding like this:
>
>      GCC_except_table1:
>      Lexception1:
>          .byte   0xff  ## @LPStart Encoding = omit
>          .byte   0x9b  ## @TType Encoding = indirect pcrel sdata4
>          .byte   0xff  ## @TType base offset
>          .space  1,0   ## Padding
>          .byte   0x03  ## Call site Encoding = udata4
>          .byte   0x89  ## Call site table length
>
> and not with padding on the "Call site table length" entry.

aren't you back into the GCC style "oops, a value with variable length encoding
changed, needed a different number of bytes to output, this shifted the start
of the table, need to recalculate the alignment" loop problem?
By putting padding inside "Call site table length", you change the value of
"TType base offset".  Since this is uleb128 encoded, that can change the length
of "TType base offset", which shifts the position of the ttypes, so changes the
value you need for alignment, so changes the number of bytes for "Call site
table length", so changes the value of "TType base offset", so changes the
length of "TType base offset" etc.  Rinse and repeat.  If this is possible, then
I'm afraid your patch doesn't solve the problem, just one instance of it.

To avoid such issues, maybe you can put the alignment padding inside "TType base
offset ", rather than in "Call site table length"?  Since "TType base offset" is
the first field to use a variable length encoding, a bunch of problems should go
away.

Ciao,

Duncan.



More information about the llvm-commits mailing list