From: Mathieu Desnoyers Date: Wed, 17 Sep 2014 18:56:04 +0000 (-0400) Subject: Fix: align objstack on 8 bytes X-Git-Tag: v1.2.3~3 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=7ff90364f5b293613e133aff5cd6ec80be9ebc18 Fix: align objstack on 8 bytes Architectures such as sparc32 have 32-bit pointers, but require alignment on 8 bytes multiples for 64-bit integers. Signed-off-by: Mathieu Desnoyers --- diff --git a/formats/ctf/metadata/objstack.c b/formats/ctf/metadata/objstack.c index 14d92521..80877220 100644 --- a/formats/ctf/metadata/objstack.c +++ b/formats/ctf/metadata/objstack.c @@ -29,6 +29,7 @@ #include #include +#define OBJSTACK_ALIGN 8 /* Object stack alignment */ #define OBJSTACK_INIT_LEN 128 #define OBJSTACK_POISON 0xcc @@ -40,7 +41,7 @@ struct objstack_node { struct bt_list_head node; size_t len; size_t used_len; - char __attribute__ ((aligned (sizeof(void *)))) data[]; + char __attribute__ ((aligned (OBJSTACK_ALIGN))) data[]; }; BT_HIDDEN @@ -119,7 +120,7 @@ void *objstack_alloc(struct objstack *objstack, size_t len) struct objstack_node *last_node; void *p; - len = ALIGN(len, sizeof(void *)); + len = ALIGN(len, OBJSTACK_ALIGN); /* Get last node */ last_node = bt_list_entry(objstack->head.prev,