Skip to content

Commit

Permalink
Fix redefinition of CONF_ARCH_STRING for ARM architectures
Browse files Browse the repository at this point in the history
The macro `__ARM_ARCH` is defined both for 32-bit and 64-bit ARM so it cannot be used to identify ARM64. Now `__ARM_ARCH_ISA_A64` is used instead, which should only be defined for ARM64. This caused a warning due to the macro `CONF_ARCH_STRING` being redefined when compiling for Android. Furthermore, support for detecting big-endian ARM64 with the `__ARM_BIG_ENDIAN` macro is added.

See https://developer.arm.com/documentation/dui0774/g/chr1383660321827
  • Loading branch information
Robyt3 committed Sep 7, 2024
1 parent 11fd820 commit 8e45d0a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/base/detect.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,19 @@
#define CONF_ARCH_ARM 1
#define CONF_ARCH_STRING "arm"
#define CONF_ARCH_ENDIAN_BIG 1
#endif

#if defined(__ARMEL__)
#elif defined(__ARMEL__)
#define CONF_ARCH_ARM 1
#define CONF_ARCH_STRING "arm"
#define CONF_ARCH_ENDIAN_LITTLE 1
#endif

#if defined(__aarch64__) || defined(__arm64__) || defined(__ARM_ARCH)
#elif defined(__aarch64__) || defined(__arm64__) || defined(__ARM_ARCH_ISA_A64)
#define CONF_ARCH_ARM64 1
#define CONF_ARCH_STRING "arm64"
#if defined(__ARM_BIG_ENDIAN)
#define CONF_ARCH_ENDIAN_BIG 1
#else
#define CONF_ARCH_ENDIAN_LITTLE 1
#endif
#endif

#ifndef CONF_FAMILY_STRING
#define CONF_FAMILY_STRING "unknown"
Expand Down

0 comments on commit 8e45d0a

Please sign in to comment.