Bug#674156: alignment issue
Sjoerd Simons
sjoerd at luon.net
Tue Nov 6 08:42:48 UTC 2012
reassign 674156 glib-2.0
thanks,
On Fri, Oct 19, 2012 at 10:32:46PM +0900, Koichi Akabe wrote:
> > (gst-plugin-scanner:961): GLib-GObject-WARNING **: specified instance
> > size for type `GstRtpAC3Depay' is smaller than the parent type's
> > `GstBaseRTPDepayload' instance size
Digging through this it turned out that GStaticMutex changed size since
squeeze... When running the following test program:
#include <stdio.h>
#include <glib.h>
#define SIZE(x) printf (#x ": %"G_GSIZE_FORMAT"\n", sizeof (x))
int
main (int argc, char **argv)
{
SIZE (GMutex *);
SIZE (double);
SIZE (pthread_mutex_t);
SIZE (GStaticMutex);
SIZE (GStaticRecMutex);
SIZE (struct { GMutex *a; union { char pad[24] ; char d; }; });
return 0;
}
On squeeze (armel):
GMutex *: 4
double: 8
pthread_mutex_t: 24
GStaticMutex: 32
GStaticRecMutex: 48
struct { GMutex *a; union { char pad[24] ; double d; }; }: 32
On wheezy (armel):
GMutex *: 4
double: 8
pthread_mutex_t: 24
GStaticMutex: 28
GStaticRecMutex: 40
struct { GMutex *a; union { char pad[24] ; double d; }; }: 32
Digging futher and futher on squeese GStaticMutex was defined as:
struct _GStaticMutex
{
struct _GMutex *runtime_mutex;
union {
char pad[24];
double dummy_double;
void *dummy_pointer;
long dummy_long;
} static_mutex;
};
While on wheezy:
typedef struct
{
GMutex *mutex;
#ifndef G_OS_WIN32
/* only for ABI compatibility reasons */
pthread_mutex_t unused;
#endif
} GStaticMutex;
Even though both pthread_mutex_t and the earlier union are 24 bytes themselves,
because of the double in the union it gets aligned to a multiple of 8 on ARM,
causing 4 bytes of extra padding to be added. Which in turns makes the old
GStaticMutex struct 4 bytes bigger then the current one...
This obviously breaks ABI on these platforms, not only of glib but also of
libraries which have a GStaticMutex embedded in their public structs in some
way.
I'm not sure what to do at this point... One option would be to patch
glib-2.0 so it's at least ABI compatible again with squeeze again, but it's
unlikely other distributions would follow (so we would be incompatible with
others). On the other hand this might not matter so much for arm.
Whatever we do, we do need to ensure that all affected software gets compiled
against whatever final solution we pick.
--
The light of a hundred stars does not equal the light of the moon.
More information about the pkg-gstreamer-maintainers
mailing list