UPSTREAM: Fix Android host build
Cherry-pick https://github.com/google/marl/pull/246
to fix arm host builds.
Bug: b/242184599
Test: Android presubmit on aosp/2568870
Change-Id: Id414efdaed902b5d71e569f607b3034f1322c603
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/71568
Reviewed-by: Geoff Lang <geofflang@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Presubmit-Ready: Jason Macnak <natsu@google.com>
Tested-by: Jason Macnak <natsu@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
diff --git a/third_party/marl/include/marl/thread.h b/third_party/marl/include/marl/thread.h
index f317ac9..43bb719 100644
--- a/third_party/marl/include/marl/thread.h
+++ b/third_party/marl/include/marl/thread.h
@@ -52,7 +52,8 @@
struct Affinity {
// supported is true if marl supports controlling thread affinity for this
// platform.
-#if defined(_WIN32) || (defined(__linux__) && !defined(__ANDROID__)) || \
+#if defined(_WIN32) || \
+ (defined(__linux__) && !defined(__ANDROID__) && !defined(__BIONIC__)) || \
defined(__FreeBSD__)
static constexpr bool supported = true;
#else
diff --git a/third_party/marl/src/thread.cpp b/third_party/marl/src/thread.cpp
index 6851d07..c6b34ae 100644
--- a/third_party/marl/src/thread.cpp
+++ b/third_party/marl/src/thread.cpp
@@ -150,7 +150,7 @@
}
}
}
-#elif defined(__linux__) && !defined(__ANDROID__)
+#elif defined(__linux__) && !defined(__ANDROID__) && !defined(__BIONIC__)
auto thread = pthread_self();
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
@@ -379,7 +379,7 @@
return;
}
-#if defined(__linux__) && !defined(__ANDROID__)
+#if defined(__linux__) && !defined(__ANDROID__) && !defined(__BIONIC__)
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
for (size_t i = 0; i < count; i++) {