From 9ec6ae4f798941eee94ea3796c219e7c0069d580 Mon Sep 17 00:00:00 2001 From: Kedar Sovani Date: Wed, 21 Oct 2009 13:28:12 +0200 Subject: [PATCH] Fix Alignment Errors. Signed-off-by: Kedar Sovani --- gobject-introspection-alignment-fix.patch | 56 +++++++++++++++++++++++++++++ gobject-introspection.spec | 7 +++- 2 files changed, 62 insertions(+), 1 deletions(-) create mode 100644 gobject-introspection-alignment-fix.patch diff --git a/gobject-introspection-alignment-fix.patch b/gobject-introspection-alignment-fix.patch new file mode 100644 index 0000000..b2bde44 --- /dev/null +++ b/gobject-introspection-alignment-fix.patch @@ -0,0 +1,56 @@ +--- gobject-introspection-0.6.5/girepository/girnode.c.orig 2009-07-09 19:20:46.000000000 +0200 ++++ gobject-introspection-0.6.5/girepository/girnode.c 2009-10-21 13:17:53.000000000 +0200 +@@ -53,6 +53,13 @@ _g_irnode_dump_stats (void) + g_message ("%lu types (%lu before sharing)", unique_types_count, types_count); + } + ++#define DO_ALIGNED_COPY(dest_addr, value, type) \ ++do { \ ++ type tmp_var; \ ++ tmp_var = value; \ ++ memcpy(dest_addr, &tmp_var, sizeof(type)); \ ++} while(0) ++ + #define ALIGN_VALUE(this, boundary) \ + (( ((unsigned long)(this)) + (((unsigned long)(boundary)) -1)) & (~(((unsigned long)(boundary))-1))) + +@@ -2249,11 +2256,11 @@ g_ir_node_build_typelib (GIrNode + break; + case GI_TYPE_TAG_INT64: + blob->size = 8; +- *(gint64*)&data[blob->offset] = (gint64) parse_int_value (constant->value); ++ DO_ALIGNED_COPY(&data[blob->offset], parse_int_value (constant->value), gint64); + break; + case GI_TYPE_TAG_UINT64: + blob->size = 8; +- *(guint64*)&data[blob->offset] = (guint64) parse_uint_value (constant->value); ++ DO_ALIGNED_COPY(&data[blob->offset], parse_uint_value (constant->value), guint64); + break; + case GI_TYPE_TAG_SHORT: + blob->size = sizeof (gshort); +@@ -2274,21 +2281,21 @@ g_ir_node_build_typelib (GIrNode + case GI_TYPE_TAG_SSIZE: /* FIXME */ + case GI_TYPE_TAG_LONG: + blob->size = sizeof (glong); +- *(glong*)&data[blob->offset] = (glong) parse_int_value (constant->value); ++ DO_ALIGNED_COPY(&data[blob->offset], parse_int_value (constant->value), glong); + break; + case GI_TYPE_TAG_SIZE: /* FIXME */ + case GI_TYPE_TAG_TIME_T: + case GI_TYPE_TAG_ULONG: + blob->size = sizeof (gulong); +- *(gulong*)&data[blob->offset] = (gulong) parse_uint_value (constant->value); ++ DO_ALIGNED_COPY(&data[blob->offset], parse_uint_value (constant->value), gulong); + break; + case GI_TYPE_TAG_FLOAT: + blob->size = sizeof (gfloat); +- *(gfloat*)&data[blob->offset] = (gfloat) parse_float_value (constant->value); ++ DO_ALIGNED_COPY(&data[blob->offset], parse_float_value (constant->value), gfloat); + break; + case GI_TYPE_TAG_DOUBLE: + blob->size = sizeof (gdouble); +- *(gdouble*)&data[blob->offset] = (gdouble) parse_float_value (constant->value); ++ DO_ALIGNED_COPY(&data[blob->offset], parse_float_value (constant->value), gdouble); + break; + case GI_TYPE_TAG_UTF8: + case GI_TYPE_TAG_FILENAME: diff --git a/gobject-introspection.spec b/gobject-introspection.spec index ff1576d..0cebf35 100644 --- a/gobject-introspection.spec +++ b/gobject-introspection.spec @@ -3,13 +3,14 @@ Name: gobject-introspection Version: 0.6.5 -Release: 1%{?dist} +Release: 1%{?dist}.fa1 Summary: Introspection system for GObject-based libraries Group: Development/Libraries License: GPLv2+, LGPLv2+, MIT URL: http://live.gnome.org/GObjectIntrospection Source0: ftp://ftp.gnome.org/pub/gnome/sources/%{name}/0.6/%{name}-%{version}.tar.gz +Patch1: gobject-introspection-alignment-fix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: glib2-devel @@ -48,6 +49,7 @@ Libraries and headers for gobject-introspection %prep %setup -q +%patch1 -p1 -b .alignment-fix %build %configure @@ -95,6 +97,9 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man1/*.gz %changelog +* Wed Oct 21 2009 Kedar Sovani +- Fix Alignment Errors + * Fri Sep 11 2009 Colin Walters - 0.6.5-1 - New upstream - Drop libtool dep -- 1.5.5.6