Re: [Gc] mingw32ce patch

Ivan Maidanski ivmai at
Wed Sep 30 02:55:59 PDT 2009


Foreword from doc/Readme:

"If you are contemplating a major addition, you might also send mail to ask whether it's already been done (or whether we tried and discarded it)."

"Vincent R." <forumer at> wrote:
> Hi,
> I am trying to compile boehm gc on a windows ce devices and I have some
> remarks/feedback.
> 1) cegcc is a cross compiler project based on gcc and targeting wince
> devices.
> ...
> To compile boehm with this toolchain:
> ./configure --host=arm-mingw32ce
> make
> Unfortunately Boehm-gc doesn't not support it.

Not true. Use the latest CVS snapshot. It supports VC++ for CE, CeGCC and mingw32ce (tested only on arm).

> You need to know that compiler exports the following defines :
> -D__COREDLL__ -D__MINGW32__ -D__MINGW32CE__

Not fully true, AFAIK: __MINGW32CE__ is defined only for mingw32ce (not for CeGCC).

> You will find attached a patch to fix it.

I'll look it thru in a moment.

> However now I have one error left :
> /cygdrive/c/downloads/gc-7.2alpha2.tar/gc-7.2alpha2_NEW/misc.c:765:
> undefined reference to `GC_thr_init'
> but I don't know exactly what to do with it so before to go any further I
> would like your comments.

Everything seems to work (as report others) except may be - configure (I haven't tried) - If you care send us a patch for it.

At present, I use the following to build a DLL:
gcc -O2 -fno-strict-aliasing -Wall -DALL_INTERIOR_POINTERS -DJAVA_FINALIZATION -DGC_GCJ_SUPPORT -DNO_DEBUGGING -DGC_THREADS -DNDEBUG -I include -I libatomic_ops/src -DUSE_MUNMAP -DTHREAD_LOCAL_ALLOC -march=armv6 -DPARALLEL_MARK -shared -DGC_DLL -o gc.dll -s *.c

There may be some problems with compiling for some WinCE 6.0 custom builds because GCC doesn't support SEH.

> Oh I forget one last thing by reading very quickly source code I could see
> that you need to find stack address on different platforms but it seems
> that on existing code for MSWINCE you are using an approximate method.

At present, GC uses for WinCE the same approach as for Win32. The problems could arise if GC_INIT() would be called from a deeply recursive func (so that the stack committed space has grown) - but this could hardly occur in practice.

> Microsoft release sources of windows ce OS(see Platform Builder)
> and from it you can see that to retrieve stack bottom you can use the
> following code :
> void *os_query_stackBottom()
> {
>    const LPBYTE PUserKData = cast(LPBYTE)0xFFFFC800;
>     DWORD dwStackBase;
>     BOOL bKmode;
>     bKmode = SetKMode(TRUE);
>     dwStackBase = *(cast(DWORD*) (*(cast(DWORD*)(PUserKData + 0x094)) +
> 0x1C));
>     SetKMode(bKmode);
>     return cast(void *)dwStackBase;
> }
> You just need to know that wince kernel is always loaded at the same
> address on ARM architecture
> (0xFFFFC800) and that from it we can get stack address.
> If my memory serves me rightn, stack is descending (from high address to
> low address) so
> function is called stackBottom but could be renamed stackBound.
> I could give you more information if you need to.

Is this specific to ARM only? Is it working for all recent WinCE versions (say, since v3.0)? Is it for main thread only?

PS. At present, I'm working on WinCE 5 and 6 differences so that to choose proper algorithm at runtime.

> Regards
> Vincent Richomme


More information about the Gc mailing list