fc-arch ponderings

Jeremy Huddleston jeremyhu at freedesktop.org
Thu Feb 19 14:36:28 PST 2009


Actually, one small point before that patch gets pushed...

On darwin-ppc right now, fc-arch is returning m68k rather than ppc.   
Should we stick with this (to match the signature) or make it ppc (to  
make it "right" for humans)?

Diving into this, I see that sizeof(FcValue) is 12 (0xc) rather than  
16 (0x10), so fc-arch returns m68k for darwin-ppc.  I'm guessing the  
ppc signature in the template came from linux-ppc.  I'm curious why  
FcValue is different in size for these two cases.  Is it just an  
alignment issue being forced in linux-ppc that isn't the case in  
darwin-ppc?

typedef struct _FcValue {
     FcType      type;        // 4
     union {
         const FcChar8   *s;  // 4
         int             i;   // 4
         FcBool          b;   // 1/4?
         double          d;   // 8
         const FcMatrix  *m;  // 4
         const FcCharSet *c;  // 4
         void            *f;  // 4
         const FcLangSet *l;  // 4
     } u;
} FcValue;

So the size would be 12.  Being word aligned would make sense for the  
64bit archs to pad this up to 16, but why is "ppc" padding it to 16?   
Was the ppc signature generated with some -falign-foo?  Is linux-ppc  
doing something I wouldn't expect?

On Feb 19, 2009, at 13:40, Jeremy Huddleston wrote:

> I don't have commit access to fontconfig, so could some else please
> push this?  Without it, fontconfig uses the same cache files for
> different archs (and sees the cache as corrupt when switching archs).
>
> Resolves: https://bugs.freedesktop.org/show_bug.cgi?id=20208
> ---
>  fc-arch/fc-arch.c |   14 ++++++++++++++
>  1 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/fc-arch/fc-arch.c b/fc-arch/fc-arch.c
> index 2fa6b18..1766bb1 100644
> --- a/fc-arch/fc-arch.c
> +++ b/fc-arch/fc-arch.c
> @@ -92,6 +92,20 @@ main (int argc, char **argv)
>
>      if (strcmp (arch, "auto") == 0)
>      {
> +#if defined(__APPLE__) && defined(__MACH__)
> +	printf(
> +		"#if defined(__ppc__)\n"
> +		"#define FC_ARCHITECTURE \"ppc\"\n"
> +		"#elif defined(__ppc64__)\n"
> +		"#define FC_ARCHITECTURE \"ppc64\"\n"
> +		"#elif defined(__i386__)\n"
> +		"#define FC_ARCHITECTURE \"x86\"\n"
> +		"#elif defined(__x86_64__)\n"
> +		"#define FC_ARCHITECTURE \"x86-64\"\n"
> +		"#endif\n");
> +	fflush (stdout);
> +	exit (ferror (stdout));
> +#endif
>  	arch = NULL;
>  	/*
>  	 * Search for signature
> -- 
> 1.6.1.2
>
>
> _______________________________________________
> xorg-devel mailing list
> xorg-devel at lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-devel



More information about the xorg-devel mailing list