[Gc] Advise for port to uClinux

Morten Kvistgaard MK at pch-engineering.dk
Thu Nov 4 03:20:05 PST 2010


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