www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - LDC ARM

reply "Daniel Kozak" <kozzi11 gmail.com> writes:
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_linux3DSOZ5Array5
mptyMxFNaNbNdNiNfZb 
(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
Jan 21 2015
next sibling parent "Kagamin" <spam here.lot> writes:
It's a thread-local variable. See if it's IR fails.
Jan 21 2015
prev sibling next sibling parent "Kai Nacke" <kai redstar.de> writes:
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_linux3DSOZ5Array5
mptyMxFNaNbNdNiNfZb 
 (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
Jan 21 2015
prev sibling parent "Joakim" <dlang joakim.fea.st> writes:
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_linux3DSOZ5Array5
mptyMxFNaNbNdNiNfZb 
 (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
I ran into something like this too, when compiling unoptimized. When optimized, do all druntime and phobos tests pass for you though? Because I could only get druntime to mostly pass on a Cubieboard2, most of phobos's tests would segfault, but that was a hard-float system.
Jan 21 2015