aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2021-08-27 13:54:32 -0700
committerColin Cross <ccross@android.com>2021-08-27 13:54:32 -0700
commit4b9df78dbadb7c30d39197929322074aec9a6bf3 (patch)
tree4d738bce3ccaa57dcec023d4c7af35ea63fc040a
parent5acd4736588c89c94527f4732505b919152f2ec1 (diff)
downloadllvm-4b9df78dbadb7c30d39197929322074aec9a6bf3.tar.gz
Add support for building llvm-rs-cc and bcc against musl
Bug: 190084016 Test: m USE_HOST_MUSL=true llvm-rs-cc bcc Change-Id: Ic8369356fdab21cd8b6113ff6ba69362cbc39106
-rw-r--r--host/include/llvm/Config/config.h4
-rw-r--r--include/llvm/Analysis/TargetLibraryInfo.h15
-rw-r--r--lib/Support/DynamicLibrary.cpp2
3 files changed, 18 insertions, 3 deletions
diff --git a/host/include/llvm/Config/config.h b/host/include/llvm/Config/config.h
index eb6c81d1ec1d..ce0c15d9184f 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 02203126f05e..48cbd9b640eb 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 9a7aeb50a216..3fdea209151b 100644
--- a/lib/Support/DynamicLibrary.cpp
+++ b/lib/Support/DynamicLibrary.cpp
@@ -143,7 +143,7 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char *symbolName) {
// 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);