Openwrt Linux Uclibc ARM GC issue

Radu void at
Fri Dec 15 14:06:37 UTC 2017

Trying to run some D code on Openwrt with Uclibc and got stuck by 
broken GC.

Using LDC 1.6
LDC - the LLVM D compiler (1.6.0):
   based on DMD v2.076.1 and LLVM 5.0.0
   built with LDC - the LLVM D compiler (1.6.0)
   Default target: x86_64-unknown-linux-gnu
   Host CPU: broadwell -

   Registered Targets:
     aarch64    - AArch64 (little endian)
     aarch64_be - AArch64 (big endian)
     arm        - ARM
     arm64      - ARM64 (little endian)
     armeb      - ARM (big endian)
     nvptx      - NVIDIA PTX 32-bit
     nvptx64    - NVIDIA PTX 64-bit
     ppc32      - PowerPC 32
     ppc64      - PowerPC 64
     ppc64le    - PowerPC 64 LE
     thumb      - Thumb
     thumbeb    - Thumb (big endian)
     x86        - 32-bit X86: Pentium-Pro and above
     x86-64     - 64-bit X86: EM64T and AMD64

Run time libs where compiled with:

ldc-build-runtime --dFlags="-w;-mtriple=armv7-linux-gnueabihf 
-mcpu=cortex-a7 -L-lstdc++" --cFlags="-mcpu=cortex-a7 
-mfloat-abi=hard -D__UCLIBC_HAS_BACKTRACE__ -D__UCLIBC_HAS_TLS__" 
--targetSystem="Linux;UNIX" BUILD_SHARED_LIBS=OFF

The minimal program is:

import core.memory;

void main()

Compiled with `ldc2 -mtriple=armv7-linux-gnueabihf 
-mcpu=cortex-a7 -gcc=arm-openwrt-linux-gcc`

When run, I get this error spuriously:

core.exception.AssertError at rt/sections_elf_shared.d(116): 
Assertion failure
Fatal error in EH code: _Unwind_RaiseException failed with reason 
code: 9
Aborted (core dumped)

GDB on the coredump:
(gdb) bt
#0  _dl_setup_progname (argv0=<optimized out>) at 
#1  0xb6f55e34 in map_writeable (libaddr=<optimized out>, 
flags=<optimized out>, piclib=-1225360472, ppnt=0x21, 
infile=<optimized out>) at ldso/ldso/dl-elf.c:442
#2  _dl_load_elf_shared_library (rflags=<optimized out>, 
rpnt=0xbeea5d9c, libname=0x0) at ldso/ldso/dl-elf.c:703
#3  0x0001c718 in _d_dso_registry ()
#4  0x00016b14 in ldc.register_dso ()
#5  0x00016b4c in ldc.dso_ctor.4test ()
#6  0xb6f54548 in __GI__dl_tls_setup () at ldso/ldso/dl-tls.c:451
#7  0xb6ea79e4 in _pthread_cleanup_pop_restore (buffer=<optimized 
out>, execute=<optimized out>) at libpthread/nptl/forward.c:152
Backtrace stopped: previous frame identical to this frame 
(corrupt stack?)

Any idea what might be wrong?

More information about the digitalmars-d-ldc mailing list