GVariant: ensure GVariantIter alignment for CHERI systems

For CHERI-enabled architectures such as Arm Morello we have to align the
GVariantIter to pointer alignment (16 bytes for Morello) but defining the
opaque struct as 16 gsize elements only aligns to 8 bytes.
This does not change the layout for existing architecutre since there
gsize is the same as guintptr.

Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/2842
This commit is contained in:
Alex Richardson 2022-12-14 23:55:20 +00:00
parent 147777e342
commit 9f8edb1e3f
2 changed files with 3 additions and 1 deletions

View File

@ -2951,6 +2951,8 @@ struct heap_iter
gsize magic;
};
G_STATIC_ASSERT (sizeof (struct heap_iter) <= sizeof (GVariantIter));
#define GVSI(i) ((struct stack_iter *) (i))
#define GVHI(i) ((struct heap_iter *) (i))
#define GVSI_MAGIC ((gsize) 3579507750u)

View File

@ -270,7 +270,7 @@ GVariant * g_variant_new_from_data (const G
typedef struct _GVariantIter GVariantIter;
struct _GVariantIter {
/*< private >*/
gsize x[16];
guintptr x[16];
};
GLIB_AVAILABLE_IN_ALL