aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2021-09-02 00:57:57 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-09-02 00:57:57 +0000
commit1308e8322139f8aeb51170613e9c2408704a5b37 (patch)
tree4d738bce3ccaa57dcec023d4c7af35ea63fc040a
parent4cd39a2dd341ff61659522170fab6a6f8b0713bb (diff)
parent80426eb0106abcf8a3fde7ce19ad08aabaf7219a (diff)
downloadllvm-1308e8322139f8aeb51170613e9c2408704a5b37.tar.gz
Merge "Add support for building llvm-rs-cc and bcc against musl" am: b7f7285e82 am: 184ff1e7bb am: c6a0a0c798 am: 80426eb010
Original change: https://android-review.googlesource.com/c/platform/external/llvm/+/1813631 Change-Id: I013b6ac53cfe81484da74e16c50881463d2e5b3d
-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);