aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2021-09-02 00:18:52 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-09-02 00:18:52 +0000
commit184ff1e7bba8564a32f95e5086001a3df8decb5e (patch)
tree4d738bce3ccaa57dcec023d4c7af35ea63fc040a
parent4cd39a2dd341ff61659522170fab6a6f8b0713bb (diff)
parentb7f7285e820a156882b25ba600376bea3aac4783 (diff)
downloadllvm-184ff1e7bba8564a32f95e5086001a3df8decb5e.tar.gz
Merge "Add support for building llvm-rs-cc and bcc against musl" am: b7f7285e82android-s-v2-preview-2android-s-v2-preview-1android-s-v2-beta-2android-s-v2-preview-1
Original change: https://android-review.googlesource.com/c/platform/external/llvm/+/1813631 Change-Id: I501bb19ecdb55d8bab65111c14de3f177cbd6fd1
-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);