- slightly improve the situation on sparc64:

* extend the DO_ALIGNED_COPY usage from girnode.c into ginfo.c
(freebsd seems to do the same)
* skips tests/scanner/ as opensolaris and several other distributions do,
this prevents g-ir-repository SIGBUSing there and allows the build to succeed.

it's not really a great improvement (apart from ginfo.c patch), but at least
it allows things to move forward, and gobject-introspection isn't enabled yet
in other ports.

ok ajacoutot@
This commit is contained in:
jasper 2010-09-07 11:39:12 +00:00
parent 56a34dfaf4
commit 8cad0d9dcd
3 changed files with 74 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.13 2010/08/30 22:03:58 jasper Exp $
# $OpenBSD: Makefile,v 1.14 2010/09/07 11:39:12 jasper Exp $
# Look at cairo-related regression failure.
# and cairo/cairo.h: No such file or directory during build.
@ -8,7 +8,7 @@ COMMENT= GObject Introspection
GNOME_VERSION= 0.6.14
GNOME_PROJECT= gobject-introspection
REVISION= 1
REVISION= 2
CATEGORIES= devel

View File

@ -0,0 +1,53 @@
$OpenBSD: patch-girepository_ginfo_c,v 1.1 2010/09/07 11:39:12 jasper Exp $
Fix build on strict aligned arches, such as sparc64. This would cause
unaligned memory access/SIGBUS later on.
See girnode.c:g_ir_node_build_typelib()
--- girepository/ginfo.c.orig Tue Sep 7 11:18:06 2010
+++ girepository/ginfo.c Tue Sep 7 11:20:16 2010
@@ -2110,6 +2110,9 @@ g_constant_info_get_type (GIConstantInfo *info)
return g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 8);
}
+#define DO_ALIGNED_COPY(dest_addr, src_addr, type) \
+ memcpy((dest_addr), (src_addr), sizeof(type))
+
gint
g_constant_info_get_value (GIConstantInfo *info,
GArgument *value)
@@ -2148,16 +2151,16 @@ g_constant_info_get_value (GIConstantInfo *info,
value->v_uint32 = *(guint32*)&rinfo->typelib->data[blob->offset];
break;
case GI_TYPE_TAG_INT64:
- value->v_int64 = *(gint64*)&rinfo->typelib->data[blob->offset];
+ DO_ALIGNED_COPY(&value->v_int64, &rinfo->typelib->data[blob->offset], gint64);
break;
case GI_TYPE_TAG_UINT64:
- value->v_uint64 = *(guint64*)&rinfo->typelib->data[blob->offset];
+ DO_ALIGNED_COPY(&value->v_uint64, &rinfo->typelib->data[blob->offset], guint64);
break;
case GI_TYPE_TAG_FLOAT:
- value->v_float = *(gfloat*)&rinfo->typelib->data[blob->offset];
+ DO_ALIGNED_COPY(&value->v_float, &rinfo->typelib->data[blob->offset], gfloat);
break;
case GI_TYPE_TAG_DOUBLE:
- value->v_double = *(gdouble*)&rinfo->typelib->data[blob->offset];
+ DO_ALIGNED_COPY(&value->v_double, &rinfo->typelib->data[blob->offset], gdouble);
break;
case GI_TYPE_TAG_TIME_T:
value->v_long = *(long*)&rinfo->typelib->data[blob->offset];
@@ -2175,10 +2178,10 @@ g_constant_info_get_value (GIConstantInfo *info,
value->v_uint = *(guint*)&rinfo->typelib->data[blob->offset];
break;
case GI_TYPE_TAG_LONG:
- value->v_long = *(glong*)&rinfo->typelib->data[blob->offset];
+ DO_ALIGNED_COPY(&value->v_long, &rinfo->typelib->data[blob->offset], glong);
break;
case GI_TYPE_TAG_ULONG:
- value->v_ulong = *(gulong*)&rinfo->typelib->data[blob->offset];
+ DO_ALIGNED_COPY(&value->v_ulong, &rinfo->typelib->data[blob->offset], gulong);
break;
}
}

View File

@ -0,0 +1,19 @@
$OpenBSD: patch-tests_Makefile_in,v 1.1 2010/09/07 11:39:12 jasper Exp $
Don't enter scanner/, it's causing us to crash on sparc64 with:
../../tools/g-ir-generate --includedir=. --includedir=../../gir annotation-1.0.typelib -o annotation-1.0.tgir
gmake[3]: *** [annotation-1.0.tgir] Segmentation fault (core dumped)
From OpenSolaris' gobject-introspection-02-test-scanner.diff
--- tests/Makefile.in.orig Tue Sep 7 13:07:36 2010
+++ tests/Makefile.in Tue Sep 7 13:07:40 2010
@@ -255,7 +255,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-SUBDIRS = . scanner repository invoke offsets
+SUBDIRS = . repository invoke offsets
all: all-recursive
.SUFFIXES: