diff options
author | Geert Uytterhoeven <geert@linux-m68k.org> | 2022-03-03 17:39:12 +0100 |
---|---|---|
committer | Dmitry Baryshkov <dbaryshkov@gmail.com> | 2023-10-31 13:24:32 +0000 |
commit | 5dba8d73df173c422e39eba93ea88f18e87a2d4b (patch) | |
tree | 4d6d0990812ace4aadf2b299e26f21b3ac85888d | |
parent | de88f74df911362ddd7988b2b5b9df4d8c19251f (diff) | |
download | libdrm-5dba8d73df173c422e39eba93ea88f18e87a2d4b.tar.gz libdrm-5dba8d73df173c422e39eba93ea88f18e87a2d4b.tar.bz2 libdrm-5dba8d73df173c422e39eba93ea88f18e87a2d4b.zip |
intel: determine target endianness using meson
The endianness of the target is currently determined based on
preprocessor symbols. Unfortunately some symbols checked are wrong
(sparc64-linux-gnu-gcc does not define __BIG_ENDIAN__ or SPARC), and
several checks for big-endian architectures are missing.
Fix this by introducing a new preprocessor symbol HAVE_BIG_ENDIAN, which
is set based on meson's knowledge of the target endianness.
Android.common.mk does not need an update, as Android is always
little-endian (https://developer.android.com/ndk/guides/abis.html).
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
v5:
- Add Reviewed-by,
v4:
- Replace explicit #ifdef checks by a define set by meson,
v3:
- No changes,
v2:
- Add arm, aarch64, microblaze, s390, and sh.
-rw-r--r-- | intel/uthash.h | 4 | ||||
-rw-r--r-- | meson.build | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/intel/uthash.h b/intel/uthash.h index 45d1f9fc..62e16508 100644 --- a/intel/uthash.h +++ b/intel/uthash.h @@ -648,11 +648,11 @@ do { #define MUR_PLUS2_ALIGNED(p) (((unsigned long)p & 3UL) == 2UL) #define MUR_PLUS3_ALIGNED(p) (((unsigned long)p & 3UL) == 3UL) #define WP(p) ((uint32_t*)((unsigned long)(p) & ~3UL)) -#if (defined(__BIG_ENDIAN__) || defined(SPARC) || defined(__ppc__) || defined(__ppc64__)) +#ifdef HAVE_BIG_ENDIAN #define MUR_THREE_ONE(p) ((((*WP(p))&0x00ffffff) << 8) | (((*(WP(p)+1))&0xff000000) >> 24)) #define MUR_TWO_TWO(p) ((((*WP(p))&0x0000ffff) <<16) | (((*(WP(p)+1))&0xffff0000) >> 16)) #define MUR_ONE_THREE(p) ((((*WP(p))&0x000000ff) <<24) | (((*(WP(p)+1))&0xffffff00) >> 8)) -#else /* assume little endian non-intel */ +#else /* little endian non-intel */ #define MUR_THREE_ONE(p) ((((*WP(p))&0xffffff00) >> 8) | (((*(WP(p)+1))&0x000000ff) << 24)) #define MUR_TWO_TWO(p) ((((*WP(p))&0xffff0000) >>16) | (((*(WP(p)+1))&0x0000ffff) << 16)) #define MUR_ONE_THREE(p) ((((*WP(p))&0xff000000) >>24) | (((*(WP(p)+1))&0x00ffffff) << 8)) diff --git a/meson.build b/meson.build index e203965d..d2fdf792 100644 --- a/meson.build +++ b/meson.build @@ -226,6 +226,11 @@ if with_freedreno_kgsl and not with_freedreno error('cannot enable freedreno-kgsl without freedreno support') endif config.set10('_GNU_SOURCE', true) + +if target_machine.endian() == 'big' + config.set('HAVE_BIG_ENDIAN', 1) +endif + config_file = configure_file( configuration : config, output : 'config.h', |