Re[2]: [Gc] Advise for port to uClinux

Ivan Maidanski ivmai at mail.ru
Thu Nov 4 07:20:39 PST 2010


Hi, Morten!

Two advices:
1. instead of gc72a4, start with the current CVS snapshot (just not to run into a bug already solved).
2. first try to create the port for the single-threaded mode, then try to compile libatomic_ops, and then start porting GC for the multi-threaded mode.

Thu, 4 Nov 2010 16:02:36 +0100 Morten Kvistgaard <MK at pch-engineering.dk>:

> I forgot to tell that I was using the gc6.8. (stable version) That one
> hasn't got any __UCLIBC__. But it's in the gc7.2alpha4 I see, so
> I'll give that one a try.
> 
> The gc7.2alpha4 is more difficult to compile though. The build_atomic_ops.sh
> is causing me trouble. (I'm using the Makefile.Direct) It nags about not
> being meant for cross compiling... I'll give it another shot tomorrow
> though.
> 
> 
> Regards
> Morten Kvistgaard
> 
> -----Original Message-----
> From: Ivan Maidanski [mailto:ivmai at mail.ru] 
> Sent: 4. november 2010 14:55
> To: Morten Kvistgaard
> Cc: gc at linux.hpl.hp.com
> Subject: Re: [Gc] Advise for port to uClinux
> 
> Hi!
> 
> GC_HAVE_BUILTIN_BACKTRACE is not defined if __UCLIBC__.
> It looks like __UCLIBC__ is not defined in your system. Could you check this?
> 
> Fri, 5 Nov 2010 00:39:36 +1300 Bruce Hoult <bruce at hoult.org>:
> 
> > Hi!
> > 
> > I don't quite understand why you have an #ifdef LINUX inside the
> > #ifdef BLACKFIN, which is only defined if LINUX is defined. Still, it
> > won't hurt.
> > 
> > STACK_GRAN 0x10000000 (256 MB) seems absurdly big if this is an
> > embedded system. It also is I think only used if HEURISTIC1 is
> > defined, which you're not doing there.
> > 
> > Does this system have a fixed address for the bottom of the stack? If
> > so then just define STACKBOTTOM directly.
> > 
> > Read the comments relating to these definitions at the start of
> gcconfig.h
> > 
> > 
> > You may want to write a little C program that prints out the address
> > (in HEX) of a local variable in main(). That may well be enough to
> > figure out that the bottom of the stack can be found by rounding that
> > address up to the next 1k or 4k or 16k or something like that.
> > 
> > Alternatively, use a dummy and real main program as in the example
> > code just below there in gcconfig.h.
> > 
> > Getting this right -- or at least plausible -- is one of *the* main
> > things in porting to a new OS. (finding, starting and stopping
> > threads, if any and finding their stacks is the other one)
> > _______________________________________________
> > Gc mailing list
> > Gc at linux.hpl.hp.com
> > http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
> 
> 
> Thu, 4 Nov 2010 12:20:05 +0100 Morten Kvistgaard
> <MK at pch-engineering.dk>:
> 
> > Hello there,
> > 
> > I seek some advise. I'm trying to port the libgc to uClinux, which is
> > running on my Blackfin. And I almost have it running!
> > 
> > A little background:
> > - The GNU compiler for uClinux are using uclibc, which is a subset of
> glibc. 
> > - Blackfins have no MMU, so it doesn't like dynamic linking and it
> > doesn't like fork
> > - It do like POSIX threads though. (And just about everything else that
> has a
> > POSIX smell)
> > - Generally it looks a feels very much like a regular Linux. (The newest
> > version at least.) So it shouldn't be that difficult to port to I
> think.
> > 
> > Here's what I've done:
> > 
> > I've inserted the following in gcconfig.h:
> > --------------------------------------------------------------
> > # if defined(LINUX) && defined(__bfin__)
> > #    define BLACKFIN
> > #    define mach_type_known
> > # endif
> > 
> > ...
> > 
> > # ifdef BLACKFIN
> > #   define CPP_WORDSZ 32
> > #   define MACH_TYPE "BLACKFIN"
> > #   define ALIGNMENT 4
> > #   ifdef LINUX
> > #       define OS_TYPE "LINUX"
> > #       define LINUX_STACKBOTTOM
> > #       undef STACK_GRAN
> > #       define STACK_GRAN 0x10000000
> > #       define USE_GENERIC_PUSH_REGS
> > #       ifdef __ELF__
> > #	         include <features.h>
> > #	         if defined(__GLIBC__) && __GLIBC__ >= 2
> > #		        define SEARCH_FOR_DATA_START
> > #	         endif
> > #       endif
> > #   endif
> > #endif
> > --------------------------------------------------------------
> > (__GLIBC__ is still defined in uclibc)
> > 
> > 
> > 
> > I've also *undefined* GC_HAVE_BUILTIN_BACKTRACE in gc.h, due to the
> > following statement in op_deb.c:
> > --------------------------------------------------------------
> > #if defined(GC_HAVE_BUILTIN_BACKTRACE)
> > # include <execinfo.h>
> > #endif
> > --------------------------------------------------------------
> > uclibc doesn't have that one. (Unlike glibc)
> > 
> > 
> > 
> > I've also inserted the right compiler and host compiler in the
> makefile
> > and it compiles just fine! 
> > But when I run the gctest on target it says:
> > --------------------------------------------------------------
> > root:~> ./gctest
> > Absurd stack bottom value
> > ABRT
> > --------------------------------------------------------------
> > (This seems to be output from the op_deb.c)
> > 
> > 
> > 
> > Basically I have no idea what I'm doing, my alterations are just
> guessing,
> > based on the libgc documentation. I've copied the "ifdef
> > BLACKFIN" section from the "ARM" actually. But it seems so
> > close! Can anyone give some advice on how to fix it? Is it wrong to
> remove the
> > GC_HAVE_BUILTIN_BACKTRACE? Do the "ifdef BLACKFIN" section
> looks ok?
> > 
> > Regards
> > Morten Kvistgaard



More information about the Gc mailing list