Where is LDSA created?

Denis Feklushkin feklushkin.denis at gmail.com
Sat Jul 18 21:17:26 UTC 2020


On Monday, 6 July 2020 at 20:57:51 UTC, kinke wrote:
> On Monday, 6 July 2020 at 20:43:33 UTC, Denis Feklushkin wrote:
>> I think D personality data for EH ABI can be corrupt.
>
> LLVM generating wrong tables is *extremely* unlikely.

Not wrong, but maybe language-specific part is not included into 
it for some target triplets?

I cant check this because I still not found where is it shoud 
begenerated for ARM EHABI.
I mean this D-specific information, what, for example, DMD 
generates here:
https://github.com/dlang/dmd/blob/d17d08100203c24091f00f489a1d37a2d99b28ea/src/dmd/backend/dwarfeh.d#L299

And than druntime scans it by scanLSDA

> The D (and LDC) specific EH personality function (and catch 
> hooks) in druntime seems to be quite okay too, because as I've 
> already told you, we haven't seen any big issues for 32-bit 
> ARM's EHABI a few years back, with both armv6-linux-gnueabihf 
> and armv7a-linux-android. I don't know of any more recent test 
> results, but I also don't remember any recent relevant changes 
> in this part of druntime.

Latest ldc2 still produces code with TType = 0x00

Sample code:
void main()
{
         import std.exception;

	try
	{
		auto e = new Exception("sdf");

		throw e;
	}
	catch(Exception e)
	{
		while(true){}
	}
}

With logUnwinding enabled for libunwind produces:

(qemu) libunwind: findUnwindSections: section 0x8053a48 length 
0x5a90
libunwind: unwind_phase1(ex_ojb=0x20008a68): pc=0x8039dad, 
start_ip=0x8039d6c, func=.anonymous., lsda=0x0, 
personality=0x8039c6d
libunwind: unwind_phase1(ex_ojb=0x20008a68): calling personality 
function 0x8039c6d
libunwind: findUnwindSections: section 0x8053a48 length 0x5a90
libunwind: unwind_phase1(ex_ojb=0x20008a68): personality result 8 
start_ip 8039d6c ehtp 0x8059134 additional 1
libunwind: unwind_phase1(ex_ojb=0x20008a68): _URC_CONTINUE_UNWIND
libunwind: unwind_phase1(ex_ojb=0x20008a68): pc=0x802783f, 
start_ip=0x80277ec, func=.anonymous., lsda=0x0, 
personality=0x8039c6d
libunwind: unwind_phase1(ex_ojb=0x20008a68): calling personality 
function 0x8039c6d
libunwind: findUnwindSections: section 0x8053a48 length 0x5a90
libunwind: unwind_phase1(ex_ojb=0x20008a68): personality result 8 
start_ip 80277ec ehtp 0x805748c additional 1
libunwind: unwind_phase1(ex_ojb=0x20008a68): _URC_CONTINUE_UNWIND
libunwind: unwind_phase1(ex_ojb=0x20008a68): pc=0x8000207, 
start_ip=0x8000190, func=.anonymous., lsda=0x8052240, 
personality=0x8027911
libunwind: unwind_phase1(ex_ojb=0x20008a68): calling personality 
function 0x8027911
libunwind: findUnwindSections: section 0x8053a48 length 0x5a90
libunwind: unwind_phase1(ex_ojb=0x20008a68): personality result 8 
start_ip 8000190 ehtp 0x8052238 additional 0
libunwind: unwind_phase1(ex_ojb=0x20008a68): _URC_CONTINUE_UNWIND
libunwind: unwind_phase1(ex_ojb=0x20008a68): pc=0x8027269, 
start_ip=0x8027250, func=.anonymous., lsda=0x0, 
personality=0x8039c6d
libunwind: unwind_phase1(ex_ojb=0x20008a68): calling personality 
function 0x8039c6d
libunwind: findUnwindSections: section 0x8053a48 length 0x5a90
libunwind: unwind_phase1(ex_ojb=0x20008a68): personality result 8 
start_ip 8027250 ehtp 0x80573e4 additional 1
libunwind: unwind_phase1(ex_ojb=0x20008a68): _URC_CONTINUE_UNWIND
libunwind: unwind_phase1(ex_ojb=0x20008a68): pc=0x8027107, 
start_ip=0x80270e6, func=.anonymous., lsda=0x8053378, 
personality=0x8027911
libunwind: unwind_phase1(ex_ojb=0x20008a68): calling personality 
function 0x8027911
libunwind: findUnwindSections: section 0x8053a48 length 0x5a90
libunwind: unwind_phase1(ex_ojb=0x20008a68): personality result 8 
start_ip 80270e6 ehtp 0x8053370 additional 0
libunwind: unwind_phase1(ex_ojb=0x20008a68): _URC_CONTINUE_UNWIND
libunwind: unwind_phase1(ex_ojb=0x20008a68): pc=0x80271cb, 
start_ip=0x8027144, func=.anonymous., lsda=0x0, 
personality=0x8039c6d
libunwind: unwind_phase1(ex_ojb=0x20008a68): calling personality 
function 0x8039c6d
libunwind: findUnwindSections: section 0x8053a48 length 0x5a90
libunwind: unwind_phase1(ex_ojb=0x20008a68): personality result 8 
start_ip 8027144 ehtp 0x80573dc additional 1
libunwind: unwind_phase1(ex_ojb=0x20008a68): _URC_CONTINUE_UNWIND
libunwind: unwind_phase1(ex_ojb=0x20008a68): pc=0x8027107, 
start_ip=0x80270e6, func=.anonymous., lsda=0x8053378, 
personality=0x8027911
libunwind: unwind_phase1(ex_ojb=0x20008a68): calling personality 
function 0x8027911
libunwind: findUnwindSections: section 0x8053a48 length 0x5a90
libunwind: unwind_phase1(ex_ojb=0x20008a68): personality result 8 
start_ip 80270e6 ehtp 0x8053370 additional 0
libunwind: unwind_phase1(ex_ojb=0x20008a68): _URC_CONTINUE_UNWIND
libunwind: unwind_phase1(ex_ojb=0x20008a68): pc=0x8026f83, 
start_ip=0x8026d5c, func=.anonymous., lsda=0x8053360, 
personality=0x8039d39
libunwind: unwind_phase1(ex_ojb=0x20008a68): calling personality 
function 0x8039d39
libunwind: findUnwindSections: section 0x8053a48 length 0x5a90
libunwind: unwind_phase1(ex_ojb=0x20008a68): personality result 8 
start_ip 8026d5c ehtp 0x8053358 additional 0
libunwind: unwind_phase1(ex_ojb=0x20008a68): _URC_CONTINUE_UNWIND
libunwind: unwind_phase1(ex_ojb=0x20008a68): pc=0x8026d59, 
start_ip=0x8026d1c, func=.anonymous., lsda=0x0, 
personality=0x8039c6d
libunwind: unwind_phase1(ex_ojb=0x20008a68): calling personality 
function 0x8039c6d
libunwind: findUnwindSections: section 0x8053a48 length 0x5a90
libunwind: unwind_phase1(ex_ojb=0x20008a68): personality result 8 
start_ip 8026d1c ehtp 0x80573b4 additional 1
libunwind: unwind_phase1(ex_ojb=0x20008a68): _URC_CONTINUE_UNWIND
libunwind: unwind_phase1(ex_ojb=0x20008a68): pc=0x80002b5, 
start_ip=0x800029a, func=.anonymous., lsda=0x0, 
personality=0x8039c6d
libunwind: unwind_phase1(ex_ojb=0x20008a68): calling personality 
function 0x8039c6d
libunwind: findUnwindSections: section 0x8053a48 length 0x5a90
libunwind: unwind_phase1(ex_ojb=0x20008a68): personality result 9 
start_ip 800029a ehtp 0x8053a74 additional 1
dwarfeh(375) fatal error

gdb shows what unwinding goes into appropriate handler, but LSDA 
contains TType of exception == 0x0, and this mismaching leads to 
unwind to next table and all goes wrong.


More information about the digitalmars-d-ldc mailing list