[Mesa-dev] [PATCH] mesa: Fix test for big-endian architecture in compiler.h

Jonathan Gray jsg at jsg.id.au
Tue Feb 16 07:23:24 UTC 2016


On Fri, Feb 12, 2016 at 10:01:21AM +0100, Jochen Rollwagen wrote:
> Hi,
> 
> i think i found & fixed a bug in mesa concerning tests for big-endian
> machines. The defines tested don't exist or are wrongly defined so the test
> (probably) never fires. The gcc defines on my machine concerning big-endian
> are
> 
> jochen at mac-mini:~/sources/mesa$ gcc -dM -E - < /dev/null | grep BIG
> #define __BIGGEST_ALIGNMENT__ 16
> #define __BIG_ENDIAN__ 1
> #define __FLOAT_WORD_ORDER__ __ORDER_BIG_ENDIAN__
> #define _BIG_ENDIAN 1
> #define __ORDER_BIG_ENDIAN__ 4321
> #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
> 
> The tested values in current mesa are quite different :-)
> 
> The following patch fixes this.

I think you have this backwards.

On OpenBSD/sparc64
$ gcc -dM -E - < /dev/null | grep BIG
$
$ sysctl hw.byteorder
hw.byteorder=4321

endian.h defines BYTE_ORDER and it should be included to test it.

I was under the impression the headers on linux had similiar defines.

Look at how src/gallium/include/pipe/p_config.h does it.


More information about the mesa-dev mailing list