Make lang/gauceh work on arm baed NetBSD.

- Don't define DOUBLE_ARMENDIAN if netbsd.
- Backport alignment problem fix from trunk.
This commit is contained in:
enami 2009-11-29 13:01:06 +00:00
parent e33fc3e8e2
commit 7ddd7e4203
3 changed files with 75 additions and 6 deletions

View file

@ -1,9 +1,10 @@
$NetBSD: distinfo,v 1.24 2009/11/27 09:26:06 enami Exp $
$NetBSD: distinfo,v 1.25 2009/11/29 13:01:06 enami Exp $
SHA1 (Gauche-0.9.tgz) = ebc18917c36201d6c3fda29dfdc52fce2d856a5f
RMD160 (Gauche-0.9.tgz) = 3e0dfc1d498849b0d647e13f49addd0a56cc56fe
Size (Gauche-0.9.tgz) = 3938498 bytes
SHA1 (patch-aa) = 5ba93d6c1310ee9fd86e6d2f7edf6ef832bf7a5c
SHA1 (patch-aa) = fc85a438f3c4e032001a3b875d575a455f91a3ac
SHA1 (patch-ab) = 342ac7055e3e35a1f59c470376cfb7c21b05053d
SHA1 (patch-af) = 0741e1a047ee7935bffa215a69cc417ba67b81f2
SHA1 (patch-ag) = ee9946e364d6723b0efe3b260fc5d02ccb04621d
SHA1 (patch-ah) = db08d8363368331e006b45d88ef0f05e150adc86

View file

@ -1,8 +1,18 @@
$NetBSD: patch-aa,v 1.9 2008/02/25 23:14:19 tnn Exp $
$NetBSD: patch-aa,v 1.10 2009/11/29 13:01:06 enami Exp $
--- configure.orig 2008-02-13 16:32:18.000000000 +0100
+++ configure
@@ -9322,7 +9322,7 @@ fi
--- configure.orig 2009-11-22 08:32:29.000000000 +0000
+++ configure 2009-11-29 09:13:36.000000000 +0000
@@ -5459,6 +5459,9 @@
;;
alpha*)
CFLAGS="$CFLAGS -mieee" ;;
+ arm*-*-netbsd*)
+ # Don't define DOUBLE_ARMENDIAN on netbsd.
+ ;;
arm*)
# ARM processor uses a special mixed endian for doubles.
cat >>confdefs.h <<\_ACEOF
@@ -9402,7 +9405,7 @@

View file

@ -0,0 +1,58 @@
$NetBSD: patch-ah,v 1.7 2009/11/29 13:01:06 enami Exp $
Index: src/gauche.h
===================================================================
--- src/gauche.h (revision 6883)
+++ src/gauche.h (revision 6885)
@@ -134,6 +134,16 @@
Hence this macro. */
#define SCM_IGNORE_RESULT(expr) do { if(expr) {} } while(0)
+/* ScmFlonum and ScmClass must always be aligned in 8-byte boundaries.
+ (All other Scheme objects can be in 4-byte boundary.)
+ Some platform doesn't align static double in 8-byte boundaries, so
+ we try this as well. */
+#ifdef __GNUC__
+#define SCM_ALIGN8 __attribute__ ((aligned (8)))
+#else /* !__GNUC__ */
+#define SCM_ALIGN8 /*empty*/
+#endif /* !__GNUC__ */
+
/*-------------------------------------------------------------
* BASIC TYPES
*/
@@ -289,7 +299,7 @@
typedef struct ScmFlonumRec {
double val;
-} ScmFlonum;
+} ScmFlonum SCM_ALIGN8;
#define SCM_FLONUM(obj) ((ScmFlonum*)(SCM_WORD(obj)&~0x07))
#define SCM_FLONUMP(obj) (SCM_TAG2(obj) == 2)
@@ -599,13 +609,9 @@
those fields casually. Also, the order of these fields must be
reflected to the class definition macros below. */
struct ScmClassRec {
- /* We need all class structures be aligned on (at least) 8-byte boundary
- to make our tagging scheme work. Dynamically allocated objects
- are *always* 8-byte aligned due to Boehm GC's architecture. However,
- we found that statically allocated class structures can be placed
- 4-byte boundary on some 32bit systems if we started ScmClassRec
- with SCM_INSTANCE_HEADER. The following union is the trick
- to ensure 8-byte alighment on such systems. */
+ /* A trick to align statically allocated class structure on 8-byte
+ boundary. This doesn't guarantee, though, so we use __alignment__
+ attribute as well, whenever possible (see SCM_ALIGN8 macro). */
union {
SCM_INSTANCE_HEADER;
double align_dummy;
@@ -642,7 +648,7 @@
ScmInternalMutex mutex; /* to protect from MT hazard */
ScmInternalCond cv; /* wait on this while a class being updated */
void *data; /* extra data to do nasty trick */
-};
+} SCM_ALIGN8;
typedef struct ScmClassStaticSlotSpecRec ScmClassStaticSlotSpec;