Snap for 7862349 from f7125fb38d6c2f4878a33eca33138ce3964bfb6a to t-keystone-qcom-release
Change-Id: I7a6e1f559d9f9bd1e4dffcfa5898afe6b2f7b2db
diff --git a/host/include/llvm/Config/config.h b/host/include/llvm/Config/config.h
index eb6c81d..ce0c15d 100644
--- a/host/include/llvm/Config/config.h
+++ b/host/include/llvm/Config/config.h
@@ -115,7 +115,7 @@
#define HAVE_ERROR_T 1
/* Define to 1 if you have the <execinfo.h> header file. */
-#ifndef __BIONIC__
+#if !defined(__BIONIC__) && !defined(ANDROID_HOST_MUSL)
#define HAVE_EXECINFO_H 1
#endif
@@ -247,7 +247,7 @@
/* #undef HAVE_MACH_O_DYLD_H */
/* Define if mallinfo() is available on this platform. */
-#if !defined(__APPLE__)
+#if !defined(__APPLE__) && !defined(ANDROID_HOST_MUSL)
#define HAVE_MALLINFO 1
#else
/* #undef HAVE_MALLINFO */
diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
index 0220312..48cbd9b 100644
--- a/include/llvm/Analysis/TargetLibraryInfo.h
+++ b/include/llvm/Analysis/TargetLibraryInfo.h
@@ -27,6 +27,21 @@
#undef ftello
#endif
#endif // _WIN32
+
+#ifdef ANDROID_HOST_MUSL
+# ifdef fopen64
+# undef fopen64
+# endif
+# ifdef fseeko64
+# undef fseeko64
+# endif
+# ifdef ftello64
+# undef ftello64
+# endif
+# ifdef tmpfile64
+# undef tmpfile64
+# endif
+#endif
// END ANDROID-SPECIFIC
namespace llvm {
diff --git a/lib/Support/DynamicLibrary.cpp b/lib/Support/DynamicLibrary.cpp
index 9a7aeb5..3fdea20 100644
--- a/lib/Support/DynamicLibrary.cpp
+++ b/lib/Support/DynamicLibrary.cpp
@@ -143,7 +143,7 @@
// On linux we have a weird situation. The stderr/out/in symbols are both
// macros and global variables because of standards requirements. So, we
// boldly use the EXPLICIT_SYMBOL macro without checking for a #define first.
-#if defined(__linux__) and !defined(__ANDROID__)
+#if defined(__linux__) and !defined(__ANDROID__) && !defined(ANDROID_HOST_MUSL)
{
EXPLICIT_SYMBOL(stderr);
EXPLICIT_SYMBOL(stdout);