28 lines · plain
1#include <string.h>2#include <sys/system_properties.h>3 4static bool __isExynos9810(void) {5 char arch[PROP_VALUE_MAX];6 return __system_property_get("ro.arch", arch) > 0 &&7 strncmp(arch, "exynos9810", sizeof("exynos9810") - 1) == 0;8}9 10static void CONSTRUCTOR_ATTRIBUTE init_have_lse_atomics(void) {11 unsigned long hwcap = getauxval(AT_HWCAP);12 _Bool result = (hwcap & HWCAP_ATOMICS) != 0;13 if (result) {14 // Some cores in the Exynos 9810 CPU are ARMv8.2 and others are ARMv8.0;15 // only the former support LSE atomics. However, the kernel in the16 // initial Android 8.0 release of Galaxy S9/S9+ devices incorrectly17 // reported the feature as being supported.18 //19 // The kernel appears to have been corrected to mark it unsupported as of20 // the Android 9.0 release on those devices, and this issue has not been21 // observed anywhere else. Thus, this workaround may be removed if22 // compiler-rt ever drops support for Android 8.0.23 if (__isExynos9810())24 result = false;25 }26 __aarch64_have_lse_atomics = result;27}28