LDC ARM

Kai Nacke via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Wed Jan 21 12:11:38 PST 2015


On Wednesday, 21 January 2015 at 14:13:42 UTC, Daniel Kozak wrote:
> I am trying ldc on ARM. After few days I has been able to 
> compile it on tizen-common images on qemu (I have to make minor 
> change in std.math).
>
> But every app which I build with ldc segfaults. Even void 
> main(){} segfaults.
>
> Wierd is, that if I use -O (optimize) flag it works OK. I try 
> GDB but it does not help at all.
>
> #0  onAssertErrorMsg (file=..., line=41, msg=...) at 
> exception.d:431
> #1  0x0000e8d0 in _d_assert_msg (msg=..., file=..., line=41) at 
> exception.d:600
> #2  0x0000bdc0 in 
> _D2rt4util9container5array36__T5ArrayTPS2rt14sections_linux3DSOZ5Array5emptyMxFNaNbNdNiNfZb 
> (this=...)
> #3  0x0000b85c in _d_dso_registry (data=0x7ed7fa28) at 
> sections_linux.d:311
> #4  0x00009980 in ldc.dso_ctor.4test ()
> #5  0x00034cc0 in __libc_csu_init (argc=1, argv=0x7ed7fbc4, 
> envp=0x7ed7fbcc) at elf-init.c:88
> #6  0x76d8e26e in __libc_start_main () from /lib/libc.so.6
> #7  0x00009850 in _start () at ../sysdeps/arm/start.S:124
>
> this code _loadedDSOs.empty throw exception with message "null 
> this"
>
> So can you give me some advice how to properly debug

The problem is in _d_dso_registry. One of the first statements in 
the function is to call _loadedDSOs.empty. But _loadedDOSs is 
null (I do not understand why!) and the application crashes. This 
does not happen if you use -O1 or higher.

If you find the reason for this then please tell me. :-)

(This happens only on ARM. On x86/x86_64, PowerPC 32/64 bit and 
MIPS64 the code works as expected.)

Regards,
Kai


More information about the digitalmars-d-ldc mailing list