Re[6]: [Gc] Native Client support? (Android support)

Ivan Maidanski ivmai at
Sat Jan 1 01:03:55 PST 2011


Thu, 30 Dec 2010 05:34:38 +0100 Manuel.Serrano at

> Hi Ivan,
> > Hi Manuel,
> > 
> > 1. The patch is just a diff between the current CVS snap and the previous
> one, so it is most probably not usable for other GC versions.
> > 2. Android port in BDWGC is not (or should not) be worse than that for
> mono/libgc.
> > 3. I haven't test it myself on Android (I only compiled it in the past w/o
> linking)
> > 4. According to the comment in gcconfig.h, __stack_base__ should be defined
> in newlib/libc/sys/arm/crt0.S.
> > 5. If something is wrong and you know how to fix it properly, please send me
> a patch.
> > 6. I suggest you also use -Wall and -fno-strict-aliasing.
> > 7. Is -I libatomic_ops-install/include the same as -I libatomic_ops/include?
> > 8. If you are not defining -DGC_THREADS then there is no sense in
> -Ilibatomic_ops-install/include.
> Thanks for these explanations. As far as I can tell, the patch you 
> previously sent does not solve all the problems. According to my experience
> (but I might have misunderstood some points) the GC works on Android only for
> static libraries. When my binaries are linked against static libraries 
> everything is fine. When they are linked against dynamic libraries, they
> crash (that's quite unfortunate because on Android, you are not really
> supposed to write binaries but mostly dynamic libraries).
> I have not been able to use as is the patch you sent, for three reasons:
> 1. I have not been able to find any __stack_base__ symbol in the Android
> sources.

I found we had discussed it:

I don't know how to solve this issue. I wonder how it's solved in mono/libgc.

> 2. There is not linker.h in the Android sources.

Just to repeat, it is here: bionic/linker/linker.h

> 3. The multithreading API is included in the lib C so there is no 
> libpthread.{so,a}

 AC_CHECK_LIB(pthread, pthread_self, THREADDLLIBS="-lpthread",,) should solve this issue, shouln't it?


> In consequence, I did the following:
> i. I have declared a new global variable __stack_base__ in the file os_dep.c
> ii. I have created a new include file private/android_link.h which defines
> the data structures needed by dyn_load.c. I'm really not sure of that file.
> iii. Once configured, I manually remove the -lpthread. Obviously this is
> not the good way of doing things. The configure.XXX files should be
> patched to address that issue.
> For points i and ii please find attached the new patch:
> ...

More information about the Gc mailing list