From 9abbf2eec2ab65cdec95d56d567ae55b531b2228 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Wed, 14 Dec 2022 23:55:20 +0000 Subject: [PATCH] glib-compile-resources: ensure alignment is at least sizeof(void *) This triggered a warning from the CHERI compiler since the struct contains a `void *` but `__attribute__((aligned(8))` reduced alignment to less than the `void *` alignment (which is 16 for Arm Morello). Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/2842 --- gio/glib-compile-resources.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/glib-compile-resources.c b/gio/glib-compile-resources.c index 46eec1914..2ce923766 100644 --- a/gio/glib-compile-resources.c +++ b/gio/glib-compile-resources.c @@ -1196,7 +1196,7 @@ main (int argc, char **argv) "#include \n" "\n" "#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))\n" - "# define SECTION __attribute__ ((section (\".gresource.%s\"), aligned (8)))\n" + "# define SECTION __attribute__ ((section (\".gresource.%s\"), aligned (sizeof(void *) > 8 ? sizeof(void *) : 8)))\n" "#else\n" "# define SECTION\n" "#endif\n"