[Mesa-dev] [PATCH V2] util/disk_cache: support caches for multiple architectures

Grazvydas Ignotas notasas at gmail.com
Fri Mar 3 12:27:20 UTC 2017


On Fri, Mar 3, 2017 at 5:27 AM, Timothy Arceri <tarceri at itsqueeze.com> wrote:
> Previously we were deleting the entire cache if a user switched
> between 32 and 64 bit applications.
>
> V2: make the check more generic, it should now work with any
> platform we are likely to support.
> ---
>  src/util/disk_cache.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>
> diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
> index 3abdec4..92528a9 100644
> --- a/src/util/disk_cache.c
> +++ b/src/util/disk_cache.c
> @@ -40,20 +40,30 @@
>  #include "zlib.h"
>
>  #include "util/crc32.h"
>  #include "util/u_atomic.h"
>  #include "util/mesa-sha1.h"
>  #include "util/ralloc.h"
>  #include "main/errors.h"
>
>  #include "disk_cache.h"
>
> +#if defined(__ILP32__)
> +#if defined(__x86_64__) || defined(__arm__)
> +#define CACHE_ARCH "ilp-32"
> +#else
> +#define CACHE_ARCH "32"
> +#endif
> +#else
> +#define CACHE_ARCH "64"
> +#endif

That reports "64" for me on gcc -m32, I think only clang sets
__ILP32__ for non-x32 32bit build. I'd still suggest using sizeof(void
*) directly in the code, perhaps within some "const char
*get_arch_bitness_string()" helper, that should be more reliable.

GraÅžvydas


More information about the mesa-dev mailing list