Page 1 of 1

Boehm GC on NDS

Posted: Mon Jun 29, 2009 9:21 pm
by m4c0
I'm trying to use boehm gc with my NDS. I've compiled it with:

Code: Select all

sh ../configure --host=arm-eabi --prefix=%DEVKITPRO%/libgc --target=arm-eabi --disable-shared --disable-libtool-lock --disable-dependency-tracking --disable-threads --with-cross-host=mingw32
Works fine, except that I receive this error when compiling my ELF:

Code: Select all

.../devkitPro/libgc/lib\libgc.a(os_dep.o): In function `GC_get_main_stack_base':
...\gc-7.0\build/../os_dep.c:941: undefined reference to `__stack_base__'
.../devkitPro/libgc/lib\libgc.a(os_dep.o): In function `GC_register_data_segments':
...\gc-7.0\build/../os_dep.c:1718: undefined reference to `end'
collect2: ld returned 1 exit status
"Googling it", I found that "__stack_base__" seems to be mandatory and is defined by newlib's crt0.o (which is not used by devkitARM). How can I solve it? Is it safe to add a .S with this symbol defined? Isn't it possible to use boehm gc?

Re: Boehm GC on NDS

Posted: Thu Jul 02, 2009 2:59 am
by WinterMute
Can't say this is something anyone has ever tried before tbh, hard to say if it's worthwhile or not.

You'll need to define STACKBOTTOM & DATAEND specifically for the DS when compiling, looks like these are set in include/private/gcconfig.h

something like

Code: Select all

#ifdef NDS
       extern int _end[];
#     define DATAEND (ptr_t)(_end)
       extern int _sp_usr[];
#     define STACKBOTTOM (ptr_t)(_sp_usr)
#endif
and use sh CFLAGS=-DNDS ../configure ...