diff options
author | Alex Richardson <arichardson@FreeBSD.org> | 2022-08-14 16:28:56 +0000 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2022-09-21 11:35:05 +0000 |
commit | 6933a9263e30e2dbfb36a038660b9387ee632d32 (patch) | |
tree | 645ee67bafdb5f4283d63157b820c0c2461c83bf /dbus | |
parent | 91f4ac9cf62f8bb99c28ddfa4f376e45fd1b2b94 (diff) | |
download | dbus-6933a9263e30e2dbfb36a038660b9387ee632d32.tar.gz |
dbus-message.c: skip 1.10 layout compatibility test on new architectures
These static assertions fail on CHERI-enabled architectures such as Arm
Morello, where pointers are 128 bits. Architectures with 128-bit pointers
were not supported in DBus 1.10, so we can skip the checks for DBus 1.10
structure layout compatibility for architectures with pointer size > 64 bit.
Diffstat (limited to 'dbus')
-rw-r--r-- | dbus/dbus-arch-deps.h.in | 2 | ||||
-rw-r--r-- | dbus/dbus-message.c | 12 |
2 files changed, 14 insertions, 0 deletions
diff --git a/dbus/dbus-arch-deps.h.in b/dbus/dbus-arch-deps.h.in index 2dc58945..7b6328bc 100644 --- a/dbus/dbus-arch-deps.h.in +++ b/dbus/dbus-arch-deps.h.in @@ -46,6 +46,8 @@ typedef unsigned @DBUS_INT32_TYPE@ dbus_uint32_t; typedef @DBUS_INT16_TYPE@ dbus_int16_t; typedef unsigned @DBUS_INT16_TYPE@ dbus_uint16_t; +#define DBUS_SIZEOF_VOID_P @DBUS_SIZEOF_VOID_P@ + /* This is not really arch-dependent, but it's not worth * creating an additional generated header just for this */ diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index a87043e3..de355b07 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -136,6 +136,15 @@ struct DBusMessageRealIter } u; /**< the type writer or reader that does all the work */ }; +#if DBUS_SIZEOF_VOID_P > 8 +/* + * Architectures with 128-bit pointers were not supported in DBus 1.10, so we + * do no check for DBus 1.10 structure layout compatibility for such + * architectures (e.g. Arm Morello). + */ +#define CHECK_DBUS_1_10_BINARY_COMPATIBILITY 0 +#else +#define CHECK_DBUS_1_10_BINARY_COMPATIBILITY 1 /** * Layout of a DBusMessageIter on the stack in dbus 1.10.0. This is no * longer used, but for ABI compatibility we need to assert that the @@ -158,6 +167,7 @@ typedef struct int pad2; void *pad3; } DBusMessageIter_1_10_0; +#endif static void get_const_signature (DBusHeader *header, @@ -2069,12 +2079,14 @@ _dbus_message_iter_init_common (DBusMessage *message, _DBUS_STATIC_ASSERT (sizeof (DBusMessageRealIter) <= sizeof (DBusMessageIter)); _DBUS_STATIC_ASSERT (_DBUS_ALIGNOF (DBusMessageRealIter) <= _DBUS_ALIGNOF (DBusMessageIter)); +#if CHECK_DBUS_1_10_BINARY_COMPATIBILITY /* A failure of these two assertions would indicate that we've broken * ABI on this platform since 1.10.0. */ _DBUS_STATIC_ASSERT (sizeof (DBusMessageIter_1_10_0) == sizeof (DBusMessageIter)); _DBUS_STATIC_ASSERT (_DBUS_ALIGNOF (DBusMessageIter_1_10_0) == _DBUS_ALIGNOF (DBusMessageIter)); +#endif /* If this static assertion fails, it means the DBusMessageIter struct * is not "packed", which might result in "iter = other_iter" not copying * every byte. */ |