[Gauche-devel-jp] OpenBSDの為のパッチ

Back to archive index

tsuwaroi np1b6****@hotma*****
2008年 5月 26日 (月) 16:08:50 JST


こんにちは、ツワロイです。
i386-OpenBSDとzaurus/arm-OpenBSDでビルドするためのパッチです。
pthreadに対応させてから送ろうと思っていたのですが
私の力不足とBoehm-GC・pthreadに対する知識不足で
いまだ実現できておりません。
とりあえずpthread非対応版を送らせていただきます。
パッチの簡単な説明は
http://practical-scheme.net/wiliki/wiliki.cgi?Gauche%3AOpenBSD
に書かせていただいてます。

pthreadをリンクさせないとsigwaitが使えないので
testのsigwait部にelse節を加えた以外は
すべてのtestのパスを確認しました。
(i386-OpenBSD4.2、zaurus/arm-OpenBSD-4.3)

そのうちpowerpc-OpenBSDにも対応させようと思ってます。

diff -urN Gauche-0.8.13.orig/configure Gauche-0.8.13/configure
--- Gauche-0.8.13.orig/configure	Sat Feb 16 14:51:55 2008
+++ Gauche-0.8.13/configure	Sat Feb 16 14:56:35 2008
@@ -5379,6 +5379,8 @@
  ;;
   alpha*)
     CFLAGS="$CFLAGS -mieee" ;;
+  arm*-*-openbsd*)
+    ;;
   arm*)
     # ARM processor uses a special mixed endian for doubles.
     cat>>confdefs.h <>conftest.$ac_ext
 cat>>conftest.$ac_ext <
 #include 
 
 typedef struct sockaddr_storage ac__type_new_;
@@ -13891,6 +13894,7 @@
 cat confdefs.h>>conftest.$ac_ext
 cat>>conftest.$ac_ext <
 #include 
 
 int
@@ -13931,6 +13935,7 @@
 cat confdefs.h>>conftest.$ac_ext
 cat>>conftest.$ac_ext <
 #include 
 
 int
@@ -13994,6 +13999,7 @@
 cat confdefs.h>>conftest.$ac_ext
 cat>>conftest.$ac_ext <
 #include 
 
 int
@@ -14034,6 +14040,7 @@
 cat confdefs.h>>conftest.$ac_ext
 cat>>conftest.$ac_ext <
 #include 
 
 int
diff -urN Gauche-0.8.13.orig/ext/charconv/Makefile.in Gauche-0.8.13/ext/charconv/Makefile.in
--- Gauche-0.8.13.orig/ext/charconv/Makefile.in	Sat Feb 16 14:50:57 2008
+++ Gauche-0.8.13/ext/charconv/Makefile.in	Sat Feb 16 14:57:18 2008
@@ -28,7 +28,7 @@
 all : $(LIBFILES)
 
 libcharconv.$(SOEXT) : $(OBJECTS)
-	$(MODLINK) libcharconv.$(SOEXT) $(OBJECTS) $(EXT_LIBGAUCHE) $(LIBS)
+	$(MODLINK) libcharconv.$(SOEXT) $(OBJECTS) $(EXT_LIBGAUCHE) -L/usr/local/lib $(LIBS)
 
 charconv_head.c charconv_tail.c :
 	$(GAUCHE_CONFIG) --fixup-extension charconv
diff -urN Gauche-0.8.13.orig/ext/dbm/Makefile.in Gauche-0.8.13/ext/dbm/Makefile.in
--- Gauche-0.8.13.orig/ext/dbm/Makefile.in	Sat Feb 16 14:50:52 2008
+++ Gauche-0.8.13/ext/dbm/Makefile.in	Sat Feb 16 14:58:12 2008
@@ -17,21 +17,21 @@
 gdbm_OBJECTS   = gdbm_head.$(OBJEXT) gdbm.$(OBJEXT) gdbm_tail.$(OBJEXT)
 
 gdbm.$(SOEXT) : $(gdbm_OBJECTS)
-	$(MODLINK) gdbm.$(SOEXT) $(gdbm_OBJECTS) $(EXT_LIBGAUCHE) @GDBMLIB@ $(LIBS)
+	$(MODLINK) gdbm.$(SOEXT) $(gdbm_OBJECTS) $(EXT_LIBGAUCHE) @GDBMLIB@ -L/usr/local/lib $(LIBS)
 
 gdbm.c : gdbm.stub
 
 ndbm_OBJECTS   = ndbm_head.$(OBJEXT) ndbm.$(OBJEXT) ndbm_tail.$(OBJEXT)
 
 ndbm.$(SOEXT) : $(ndbm_OBJECTS)
-	$(MODLINK) ndbm.$(SOEXT) $(ndbm_OBJECTS) $(EXT_LIBGAUCHE) @NDBMLIB@ $(LIBS)
+	$(MODLINK) ndbm.$(SOEXT) $(ndbm_OBJECTS) $(EXT_LIBGAUCHE) @NDBMLIB@ -L/usr/local/lib $(LIBS)
 
 ndbm.c : ndbm.stub
 
 odbm_OBJECTS   = odbm_head.$(OBJEXT) odbm.$(OBJEXT) odbm_tail.$(OBJEXT)
 
 odbm.$(SOEXT) : $(odbm_OBJECTS)
-	$(MODLINK) odbm.$(SOEXT) $(odbm_OBJECTS) $(EXT_LIBGAUCHE) @ODBMLIB@ $(LIBS)
+	$(MODLINK) odbm.$(SOEXT) $(odbm_OBJECTS) $(EXT_LIBGAUCHE) @ODBMLIB@ -L/usr/local/lib $(LIBS)
 
 odbm.c : odbm.stub
 
diff -urN Gauche-0.8.13.orig/gc/dyn_load.c Gauche-0.8.13/gc/dyn_load.c
--- Gauche-0.8.13.orig/gc/dyn_load.c	Sat Feb 16 14:51:47 2008
+++ Gauche-0.8.13/gc/dyn_load.c	Sat Feb 16 15:00:55 2008
@@ -57,6 +57,7 @@
     !defined(HPUX) && !(defined(LINUX) && defined(__ELF__)) && \
     !defined(RS6000) && !defined(SCO_ELF) && !defined(DGUX) && \
     !(defined(FREEBSD) && defined(__ELF__)) && \
+    !(defined(OPENBSD) && defined(__ELF__)) && \
     !(defined(NETBSD) && defined(__ELF__)) && !defined(HURD) && \
     !defined(DARWIN)
  --> We only know how to find data segments of dynamic libraries for the
@@ -87,9 +88,9 @@
 
 #if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \
     (defined(FREEBSD) && defined(__ELF__)) || defined(DGUX) || \
+    (defined(OPENBSD) && defined(__ELF__)) || \
     (defined(NETBSD) && defined(__ELF__)) || defined(HURD)
 #   include 
-#   include 
 #   include 
 #endif
 
@@ -287,6 +288,7 @@
 
 #if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \
     (defined(FREEBSD) && defined(__ELF__)) || defined(DGUX) || \
+    (defined(OPENBSD) && defined(__ELF__)) || \
     (defined(NETBSD) && defined(__ELF__)) || defined(HURD)
 
 
@@ -465,7 +467,7 @@
 /* This doesn't necessarily work in all cases, e.g. with preloaded
  * dynamic libraries.						*/
 
-#if defined(NETBSD)
+#if defined(NETBSD) || defined(OPENBSD)
 #  include 
 /* for compatibility with 1.4.x */
 #  ifndef DT_DEBUG
diff -urN Gauche-0.8.13.orig/gc/finalize.c Gauche-0.8.13/gc/finalize.c
--- Gauche-0.8.13.orig/gc/finalize.c	Sat Feb 16 14:51:43 2008
+++ Gauche-0.8.13/gc/finalize.c	Sat Feb 16 15:01:22 2008
@@ -803,7 +803,7 @@
     return count;
 }
 
-void (* GC_finalizer_notifier)() = (void (*) GC_PROTO((void)))0;
+void (* GC_finalizer_notifier) GC_PROTO((void)) = (void (*) GC_PROTO((void)))0;
 
 static GC_word last_finalizer_notification = 0;
 
diff -urN Gauche-0.8.13.orig/gc/include/private/gcconfig.h Gauche-0.8.13/gc/include/private/gcconfig.h
--- Gauche-0.8.13.orig/gc/include/private/gcconfig.h	Sat Feb 16 14:51:38 2008
+++ Gauche-0.8.13/gc/include/private/gcconfig.h	Sat Feb 16 15:04:01 2008
@@ -63,7 +63,7 @@
 /* Determine the machine type: */
 # if defined(__arm__) || defined(__thumb__)
 #    define ARM32
-#    if !defined(LINUX) && !defined(NETBSD)
+#    if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD)
 #      define NOSYS
 #      define mach_type_known
 #    endif
@@ -94,7 +94,7 @@
 #    define POWERPC
 #    define mach_type_known
 # endif
-# if defined(NETBSD) && (defined(__arm32__) || defined(__arm__))
+# if (defined(OPENBSD) || defined(NETBSD)) && (defined(__arm32__) || defined(__arm__))
 #    define ARM32
 #    define mach_type_known
 # endif
@@ -1850,6 +1850,16 @@
 #   define CPP_WORDSZ 32
 #   define MACH_TYPE "ARM32"
 #   define ALIGNMENT 4
+#   ifdef OPENBSD
+#       define OS_TYPE "OPENBSD"
+#       define HEURISTIC2
+#       define DATASTART GC_data_start
+        extern int __data_start[];
+#       define DATASTART2 ((ptr_t) __data_start)
+#       define DATAEND2 GC_data_end2
+#       define DYNAMIC_LOADING
+#       define USE_GENERIC_PUSH_REGS
+#   endif
 #   ifdef NETBSD
 #       define OS_TYPE "NETBSD"
 #       define HEURISTIC2
diff -urN Gauche-0.8.13.orig/gc/misc.c Gauche-0.8.13/gc/misc.c
--- Gauche-0.8.13.orig/gc/misc.c	Sat Feb 16 14:51:49 2008
+++ Gauche-0.8.13/gc/misc.c	Sat Feb 16 15:05:38 2008
@@ -664,7 +664,10 @@
 #   if defined(SEARCH_FOR_DATA_START)
 	GC_init_linux_data_start();
 #   endif
-#   if (defined(NETBSD) || defined(OPENBSD)) && defined(__ELF__)
+#   if defined(OPENBSD) && defined(__ELF__)
+        GC_init_openbsd_elf();
+#   endif
+#   if defined(NETBSD) && defined(__ELF__)
 	GC_init_netbsd_elf();
 #   endif
 #   if defined(GC_PTHREADS) || defined(GC_SOLARIS_THREADS) \
diff -urN Gauche-0.8.13.orig/gc/os_dep.c Gauche-0.8.13/gc/os_dep.c
--- Gauche-0.8.13.orig/gc/os_dep.c	Sat Feb 16 14:51:51 2008
+++ Gauche-0.8.13/gc/os_dep.c	Sat Feb 16 15:08:21 2008
@@ -380,7 +380,23 @@
 #define sbrk tiny_sbrk
 # endif /* ECOS */
 
-#if (defined(NETBSD) || defined(OPENBSD)) && defined(__ELF__)
+#if defined(OPENBSD) && defined(__ELF__)
+  ptr_t GC_data_start;
+# if defined(DATAEND2)
+    ptr_t GC_data_end2;
+# endif
+
+  void GC_init_openbsd_elf()
+  {
+    extern ptr_t GC_find_limit();
+    GC_data_start = GC_find_limit(DATAEND, FALSE);
+#   if defined(DATAEND2)
+      GC_data_end2 = GC_find_limit(DATASTART2, TRUE);
+#   endif
+  }
+#endif
+
+#if defined(NETBSD) && defined(__ELF__)
   ptr_t GC_data_start;
 
   void GC_init_netbsd_elf()
diff -urN Gauche-0.8.13.orig/test/system.scm Gauche-0.8.13/test/system.scm
--- Gauche-0.8.13.orig/test/system.scm	Sat Feb 16 14:50:28 2008
+++ Gauche-0.8.13/test/system.scm	Sat Feb 16 15:09:30 2008
@@ -762,7 +762,8 @@
       (test* "sys-sigwait / signal handler restoration" 'foo
              (guard (e (else e))
                (sys-kill (sys-getpid) SIGINT))))
-    )) ;; gauche.sys.sigwait
+    )
+   (else)) ;; gauche.sys.sigwait
 
   ) ;; (not gauche.os.windows)
  (else))
_________________________________________________________________
10M 1★480円!Hotmailユーザー限定のブロードバンドサービス
http://campaign.live.jp/eaccess/Top/




Gauche-devel-jp メーリングリストの案内
Back to archive index