October 11
Hi!

I compile in C and D sources by clang-11, ldc2 (1.24.0-git-e8f331c), LLD 11.0.0 into one Cortex M3 static binary. And looks like it produces binary with broken debug info.

When I start this binary and connect to it by GDB at some debug step it calls D symbol from initial C code. Then GDB immediately says:
Dwarf Error: Cannot find DIE at 0x191d5 referenced from DIE at 0x1e9ab [in module /home/denizzz/Dev/d_c_arm_test/builddir/firmware.elf]
Dwarf Error: Cannot find DIE at 0x191d5 referenced from DIE at 0x1e9ab [in module /home/denizzz/Dev/d_c_arm_test/builddir/firmware.elf]

and debugging session stalls (but execution flow works ok)

I unsucessfully tried to find what is going wrong by llvm-dwarfdump:

llvm-dwarfdump --verify firmware.elf
Verifying firmware.elf:	file format elf32-littlearm
Verifying .debug_abbrev...
Verifying .debug_info Unit Header Chain...
(here is llvm-dwarfdump goes into infinity loop and eats 100% CPU)

llvm-dwarfdump --all firmware.elf shows:
[...]
0x0001e9ab:           DW_TAG_inlined_subroutine
                        DW_AT_abstract_origin	(0x000191d5)
                        DW_AT_low_pc	(0x0000000021025ba6)
                        DW_AT_high_pc	(0x0000000021025bbe)
                        DW_AT_call_file	("/home/denizzz/Dev/d_c_arm_test/builddir/../subprojects/druntime/src/gc/bits.d")
                        DW_AT_call_line	(1965)
                        DW_AT_call_column	(0x0d)
[...]

191d5 value in llvm-dwarfdump output actually can be found only in "DW_AT_abstract_origin	(0x000191d5)" form.

DW_AT_call_line 1965 in druntime/src/gc/bits.d is missing, this file contains only 484 lines.

Tell me what else can I do to investigate this issue?

October 11
On Sunday, 11 October 2020 at 04:46:45 UTC, Denis Feklushkin wrote:
> Hi!
>
> I compile in C and D sources by clang-11, ldc2 (1.24.0-git-e8f331c), LLD 11.0.0 into one Cortex M3 static binary. And looks like it produces binary with broken debug info.

Problem found! It isn't related to ldc2: compiler was accidentally called with LTO support but linker called without this option.