[PATCH] D101353: [DebugInfo] do not add pc value if lsda value in fde is 0

Yifeng Dong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 28 07:43:00 PDT 2021


dongAxis1944 added a comment.

In D101353#2720517 <https://reviews.llvm.org/D101353#2720517>, @rafauler wrote:

> Hi @dongAxis1944, thanks for submitting this!
>
>> But the LDSA value is zero in FDE, in this case llvm should set lsda value to 0 even if LSDA is relative to pc.
>
> I don't understand why is zero special? We know it looks wrong because no LSDA would ever be encoded with a zero offset from the current address. But in that logic, 1 or 2 is also wrong, and so on. This looks like a special case to account for a bug in the compiler, is that right? What is the compiler that is generating that and why? It would be good to get to the bottom of that before special casing the parser library.
>
> I'm saying this because if the violating FDE entry with LSDA set to 0 is being generated by source code written in assembly language that just happens to be coded by someone writing incorrect FDE metadata, it seems wrong to adapt the parser library to swallow that mistake -- and the source code should be fixed instead.

Thanks for reviewing, I think zero is very special, it means although cie shows fde should have lsda, but it should not have.

In D101353#2720517 <https://reviews.llvm.org/D101353#2720517>, @rafauler wrote:

> Hi @dongAxis1944, thanks for submitting this!
>
>> But the LDSA value is zero in FDE, in this case llvm should set lsda value to 0 even if LSDA is relative to pc.
>
> I don't understand why is zero special? We know it looks wrong because no LSDA would ever be encoded with a zero offset from the current address. But in that logic, 1 or 2 is also wrong, and so on. This looks like a special case to account for a bug in the compiler, is that right? What is the compiler that is generating that and why? It would be good to get to the bottom of that before special casing the parser library.
>
> I'm saying this because if the violating FDE entry with LSDA set to 0 is being generated by source code written in assembly language that just happens to be coded by someone writing incorrect FDE metadata, it seems wrong to adapt the parser library to swallow that mistake -- and the source code should be fixed instead.

hi @rafauler, thanks for reviewing.
I think 0 is a special case, I think it means although the CIE should have lsda and related to PC, but if the value of lsda is 0, it should not add pc value.

> But in that logic, 1 or 2 is also wrong, and so on.

Yes, but I do not have the address and size of gcc_exception_table, so I can not judge whether it is right or not if it is not zero.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101353/new/

https://reviews.llvm.org/D101353



More information about the llvm-commits mailing list