Skip to content

LDC 1.3 (1.2) ARMv5 issues #2058

@rracariu

Description

@rracariu

This is a continuation of #2024 (comment)

The issues so far observed are related to exception handling when compiled with optimizations turned on.

For example, compiling a simple test:

void main()
{
  throw new Exception("");
}

ldc druntime and phobos compiled with -O2 or -O3

= Throwing new exception of type object.Exception: 0x402ff280 (struct at 0x4008c4ac, classinfo at 0x61980, 1 structs in flight)

  • entering personality function. state: 0; ucb: 0x4008c4b0, context: 0xbe823970
  • LSDA: 0x49e94
  • callsite: 0x49e9b, action: 0x49ec2, classinfo_table: 0x49ec8, ciEncoding: 144
  • ip=0x2c1b3 654508032 32 0
  • entering personality function. state: 0; ucb: 0x4008c4b0, context: 0xbe823970
  • LSDA: 0x49e40
  • callsite: 0x49e45, action: 0x49e86, classinfo_table: 0x49e8c, ciEncoding: 144
  • ip=0x2c0ab 1090519040 396 0
    Fatal error in EH code: _Unwind_RaiseException failed with reason code: 9

ldc druntime and phobos compiled with -O0 (No optimization) seems to work:

= Throwing new exception of type object.Exception: 0x403be280 (struct at 0x400704ac, classinfo at 0x87170, 1 structs in flight)

  • entering personality function. state: 0; ucb: 0x400704b0, context: 0xbeead7e0
  • LSDA: 0x6e980
  • callsite: 0x6e988, action: 0x6e9a2, classinfo_table: 0x6e9a8, ciEncoding: 144
  • ip=0x4125b 72 8 a4
  • Found correct landing pad and actionTableStartOffset 1
  • ci_size: 4, ci_encoding: 144
  • ti_offset: 1
  • Comparing catch object.Throwable to exception object.Exception
  • Found catch clause for 0x400704ac
  • entering personality function. state: 1; ucb: 0x400704b0, context: 0xbeeada3c
  • LSDA: 0x6e980
  • callsite: 0x6e988, action: 0x6e9a2, classinfo_table: 0x6e9a8, ciEncoding: 144
  • ip=0x4125b 72 8 a4
  • Found correct landing pad and actionTableStartOffset 1
  • ci_size: 4, ci_encoding: 144
  • ti_offset: 1
  • Comparing catch object.Throwable to exception object.Exception
  • Found catch clause for 0x400704ac
  • Calling catch block for 0x403be280 (struct at 0x400704ac)
  • Setting switch value to: 0x1
  • Setting landing pad to: 0x412b0
  • Destroyed exception struct at 0x400704ac, 0 structs in flight
    [email protected](23)
    ----------------Segmentation fault (core dumped)

When compiling with optimizations turned on the landing pads are not found by the unwind function.

The segmentation fault is reported as a possible stack corruption by gdb (could be alignment issues, see bellow).

One problem I notices is that the ARM ehabi (http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038b/IHI0038B_ehabi.pdf) suggest that _Unwind_Control_Block struct should be aligned to 8 byte boundary. Playing with that didn't do any good.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions