[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Anyone working on libgc?



>Has anyone ARM ported libgc?  Its absense is blocking debconf.

I took a look at this.  The changes to libgc itself are pretty trivial; I've 
appended a patch that does it for me, so to speak, and I've sent a copy of 
this message to the Debian maintainer for libgc.  I don't have any programs 
on hand that really use libgc but "make test" seems happy enough so I'm 
assuming all is well.

Unfortunately this shows up a slightly embarrassing omission in the kernel, 
namely that it doesn't actually include the fault address in its signal 
context structure.  (I'm mildly surprised nobody has come across this before, 
but there you are.)  I have checked a fix for it into the mainline (2.3) CVS 
tree at netwinder.org and I'll do the same for the 2.2 branch later today.  

p.

diff -u --recursive clean/libgc-5.0.alpha4/gcconfig.h libgc-5.0.alpha4/gcconfig.h
--- clean/libgc-5.0.alpha4/gcconfig.h	Tue Dec 28 14:16:50 1999
+++ libgc-5.0.alpha4/gcconfig.h	Tue Dec 28 14:10:46 1999
@@ -147,6 +147,10 @@
 #    define I386
 #    define mach_type_known
 # endif
+# if defined(LINUX) && defined(__arm__)
+#    define ARM32
+#    define mach_type_known
+# endif
 # if defined(LINUX) && (defined(__ia64__) || defined(__ia64))
 #    define IA64
 #    define mach_type_known
@@ -1060,7 +1064,28 @@
 #       define HEURISTIC2
         extern char etext;
 #       define DATASTART ((ptr_t)(&etext))
-#       define USE_GENERIC_PUSH_REGS
+#   endif
+#   ifdef LINUX
+#       define OS_TYPE "Linux"
+	/* The stack usually grows down from 0xC0000000 on Linux/ARM.
+	   But on some machines it may be at 0x03000000 or 0x80000000.
+	   Let's try HEURISTIC1 and see what happens. */
+#       define HEURISTIC1
+#       if !defined(LINUX_THREADS) || !defined(REDIRECT_MALLOC)
+#	    define MPROTECT_VDB
+#	else
+	    /* We seem to get random errors in incremental mode,	*/
+	    /* possibly because Linux threads is itself a malloc client */
+	    /* and can't deal with the signals.				*/
+#	endif
+#       ifdef __ELF__
+#            define DYNAMIC_LOADING
+	     extern int __data_start, _end;
+#	     define DATASTART ((ptr_t)(&__data_start))
+#	     define DATAEND (&_end)
+#	else
+	     eat flaming death, a.out weenies!
+#       endif
 #   endif
 #endif
 
@@ -1170,7 +1195,8 @@
 # endif
 
 # if defined(HP_PA) || defined(M88K) || defined(POWERPC) \
-     || (defined(I386) && defined(OS2)) || defined(UTS4) || defined(LINT)
+     || (defined(I386) && defined(OS2)) || defined(UTS4) \
+     || defined(ARM32) || defined(LINT)
 	/* Use setjmp based hack to mark from callee-save registers. */
 #	define USE_GENERIC_PUSH_REGS
 # endif
diff -u --recursive clean/libgc-5.0.alpha4/os_dep.c libgc-5.0.alpha4/os_dep.c
--- clean/libgc-5.0.alpha4/os_dep.c	Fri Oct 29 23:04:10 1999
+++ libgc-5.0.alpha4/os_dep.c	Tue Dec 28 13:37:49 1999
@@ -1676,7 +1676,7 @@
 #endif
 #if defined(LINUX)
 #   include <linux/version.h>
-#   if (LINUX_VERSION_CODE >= 0x20100) && !defined(M68K) || defined(ALPHA) || defined(IA64)
+#   if (LINUX_VERSION_CODE >= 0x20100) && !defined(M68K) || defined(ALPHA) || defined(IA64) || defined(ARM32)
       typedef struct sigcontext s_c;
 #   else
       typedef struct sigcontext_struct s_c;
@@ -1743,7 +1743,11 @@
 #     if defined(IA64)
         void GC_write_fault_handler(int sig, siginfo_t * si, s_c * scp)
 #     else
-        void GC_write_fault_handler(int sig, s_c sc)
+#       if defined(ARM32)
+          void GC_write_fault_handler(int sig, int a2, int a3, int a4, s_c sc)
+#       else
+          void GC_write_fault_handler(int sig, s_c sc)
+#       endif
 #     endif
 #   endif
 #   define SIG_OK (sig == SIGSEGV)
@@ -1829,7 +1833,11 @@
 #             if defined(POWERPC)
                 char * addr = (char *) (sc.regs->dar);
 #	      else
-		--> architecture not supported
+#               if defined(ARM32)
+		  char * addr = (char *)sc.fault_address;
+#               else
+		  --> architecture not supported
+#               endif
 #	      endif
 #	    endif
 #	  endif



Reply to: