The buffers from objstack_alloc will store pointers, so they must
be aligned on a pointer's size, or else it will cause issues on the
CPUs which do not support unaligned addresses access.
Signed-off-by: Fredrik Markstrom <fredrik.markstrom@gmail.com>
Signed-off-by: Roy Li <rongqing.li@windriver.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
#include <stdlib.h>
#include <babeltrace/list.h>
#include <babeltrace/babeltrace-internal.h>
#include <stdlib.h>
#include <babeltrace/list.h>
#include <babeltrace/babeltrace-internal.h>
+#include <babeltrace/align.h>
#define OBJSTACK_INIT_LEN 128
#define OBJSTACK_POISON 0xcc
#define OBJSTACK_INIT_LEN 128
#define OBJSTACK_POISON 0xcc
struct bt_list_head node;
size_t len;
size_t used_len;
struct bt_list_head node;
size_t len;
size_t used_len;
+ char __attribute__ ((aligned (sizeof(void *)))) data[];
struct objstack_node *last_node;
void *p;
struct objstack_node *last_node;
void *p;
+ len = ALIGN(len, sizeof(void *));
+
/* Get last node */
last_node = bt_list_entry(objstack->head.prev,
struct objstack_node, node);
/* Get last node */
last_node = bt_list_entry(objstack->head.prev,
struct objstack_node, node);