From 865a219be5eb73742ecf324bde53473845e8b4fb Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 17 Jan 2013 11:58:00 +0000 Subject: More portable patch to fix alignement problem (sizeof(void*) < siezof(time_t) on 32bit platforms), also reported upstream. --- .../patches/patch-tools_build_v2_engine_hash.c | 87 ++++++++++++++++------ 1 file changed, 66 insertions(+), 21 deletions(-) (limited to 'meta-pkgs/boost') diff --git a/meta-pkgs/boost/patches/patch-tools_build_v2_engine_hash.c b/meta-pkgs/boost/patches/patch-tools_build_v2_engine_hash.c index 68de8c1ad56..6e86977c50c 100644 --- a/meta-pkgs/boost/patches/patch-tools_build_v2_engine_hash.c +++ b/meta-pkgs/boost/patches/patch-tools_build_v2_engine_hash.c @@ -1,27 +1,72 @@ -# $NetBSD: patch-tools_build_v2_engine_hash.c,v 1.1 2013/01/16 16:27:23 martin Exp $ -# fix alignement for sparc - time_t requires greater alignement than -# void* +$NetBSD: patch-tools_build_v2_engine_hash.c,v 1.2 2013/01/17 11:58:00 martin Exp $ ---- tools/build/v2/engine/hash.c.orig 2012-04-26 05:35:55.000000000 +0200 -+++ tools/build/v2/engine/hash.c 2013-01-16 16:13:21.000000000 +0100 -@@ -32,10 +32,19 @@ - - /* Header attached to all data items entered into a hash table. */ +# Fix alignement for 32bit platforms with alignment restrictions. +# A time_t requires greater alignement than a void*. + +--- tools/build/v2/engine/hash.c.orig 2013-01-16 16:21:53.000000000 +0100 ++++ tools/build/v2/engine/hash.c 2013-01-17 12:36:56.000000000 +0100 +@@ -34,7 +34,17 @@ -+#if defined(__sparc__) && defined(__NetBSD__) -+/* time_t is bigger than a pointer and needs natural alignement */ -+#define ARCH_ALIGNMENT 8 -+#endif -+ struct hashhdr { - struct item * next; --}; -+} -+#ifdef ARCH_ALIGNMENT -+ __attribute__((aligned(ARCH_ALIGNMENT))) -+#endif -+; +- struct item * next; ++ union { ++ struct item * next; ++ /* ++ * Some architectures have 32bit pointers but 64bit time_t (as used ++ * in file_info_t), and require natural alignement of data. ++ * Since we offset an aligned pointer by sizeof(hashhdr) in ++ * hash_item_data(item), we may cause misalignement if we do not ++ * make sure that sizeof(hashhdr) is properly aligned. ++ */ ++ time_t aligner; /* unused dummy for alignement */ ++ } h; + }; typedef struct item - { +@@ -106,7 +116,7 @@ static ITEM * hash_search( + ITEM * i = *hash_bucket(hp,keyval); + ITEM * p = 0; + +- for ( ; i; i = i->hdr.next ) ++ for ( ; i; i = i->hdr.h.next ) + { + if ( object_equal( hash_item_key( i ), keydata ) ) + { +@@ -153,7 +163,7 @@ HASHDATA * hash_insert( struct hash * hp + if ( hp->items.free ) + { + i = hp->items.free; +- hp->items.free = i->hdr.next; ++ hp->items.free = i->hdr.h.next; + assert( hash_item_key( i ) == 0 ); + } + else +@@ -162,7 +172,7 @@ HASHDATA * hash_insert( struct hash * hp + hp->items.next += hp->items.size; + } + hp->items.more--; +- i->hdr.next = *base; ++ i->hdr.h.next = *base; + *base = i; + *found = 0; + } +@@ -251,7 +261,7 @@ static void hashrehash( register struct + /* code currently assumes rehashing only when there are no free items */ + assert( hash_item_key( i ) != 0 ); + +- i->hdr.next = *ip; ++ i->hdr.h.next = *ip; + *ip = i; + } + } +@@ -367,7 +377,7 @@ void hashstats_add( struct hashstats * s + { + ITEM * item; + int here = 0; +- for ( item = tab[ i ]; item != 0; item = item->hdr.next ) ++ for ( item = tab[ i ]; item != 0; item = item->hdr.h.next ) + ++here; + + count += here; + -- cgit v1.2.3