aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support')
-rw-r--r--lib/Support/Android.mk114
-rw-r--r--lib/Support/Atomic.cpp12
-rw-r--r--lib/Support/Unix/Signals.inc2
3 files changed, 127 insertions, 1 deletions
diff --git a/lib/Support/Android.mk b/lib/Support/Android.mk
new file mode 100644
index 0000000..f07ad12
--- /dev/null
+++ b/lib/Support/Android.mk
@@ -0,0 +1,114 @@
+LOCAL_PATH:= $(call my-dir)
+
+support_SRC_FILES := \
+ Allocator.cpp \
+ APFloat.cpp \
+ APInt.cpp \
+ APSInt.cpp \
+ Atomic.cpp \
+ BlockFrequency.cpp \
+ BranchProbability.cpp \
+ CommandLine.cpp \
+ ConstantRange.cpp \
+ ConvertUTF.c \
+ ConvertUTFWrapper.cpp \
+ CrashRecoveryContext.cpp \
+ DAGDeltaAlgorithm.cpp \
+ DataStream.cpp \
+ DataExtractor.cpp \
+ Debug.cpp \
+ DeltaAlgorithm.cpp \
+ Dwarf.cpp \
+ DynamicLibrary.cpp \
+ Errno.cpp \
+ ErrorHandling.cpp \
+ FileUtilities.cpp \
+ FoldingSet.cpp \
+ FormattedStream.cpp \
+ GraphWriter.cpp \
+ Hashing.cpp \
+ Host.cpp \
+ IntervalMap.cpp \
+ IntEqClasses.cpp \
+ IntrusiveRefCntPtr.cpp \
+ IsInf.cpp \
+ IsNAN.cpp \
+ Locale.cpp \
+ LockFileManager.cpp \
+ MD5.cpp \
+ ManagedStatic.cpp \
+ Memory.cpp \
+ MemoryBuffer.cpp \
+ MemoryObject.cpp \
+ Mutex.cpp \
+ Path.cpp \
+ PluginLoader.cpp \
+ PrettyStackTrace.cpp \
+ Process.cpp \
+ Program.cpp \
+ Regex.cpp \
+ RWMutex.cpp \
+ SearchForAddressOfSpecialSymbol.cpp \
+ Signals.cpp \
+ SmallPtrSet.cpp \
+ SmallVector.cpp \
+ SourceMgr.cpp \
+ Statistic.cpp \
+ StreamableMemoryObject.cpp \
+ StringExtras.cpp \
+ StringMap.cpp \
+ StringPool.cpp \
+ StringRef.cpp \
+ SystemUtils.cpp \
+ TargetRegistry.cpp \
+ Threading.cpp \
+ ThreadLocal.cpp \
+ Timer.cpp \
+ TimeValue.cpp \
+ ToolOutputFile.cpp \
+ Triple.cpp \
+ Twine.cpp \
+ Valgrind.cpp \
+ Watchdog.cpp \
+ circular_raw_ostream.cpp \
+ raw_os_ostream.cpp \
+ raw_ostream.cpp \
+ regcomp.c \
+ regerror.c \
+ regexec.c \
+ regfree.c \
+ regstrlcpy.c \
+ system_error.cpp
+
+# For the host
+# =====================================================
+include $(CLEAR_VARS)
+
+# FIXME: This only requires RTTI because tblgen uses it. Fix that.
+REQUIRES_RTTI := 1
+
+LOCAL_SRC_FILES := $(support_SRC_FILES)
+
+LOCAL_MODULE:= libLLVMSupport
+
+LOCAL_CFLAGS := -D__android__
+
+LOCAL_MODULE_TAGS := optional
+
+include $(LLVM_HOST_BUILD_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
+
+# For the device
+# =====================================================
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(support_SRC_FILES)
+
+LOCAL_MODULE:= libLLVMSupport
+
+LOCAL_CFLAGS := -D__android__
+
+LOCAL_MODULE_TAGS := optional
+
+include $(LLVM_DEVICE_BUILD_MK)
+include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/Support/Atomic.cpp b/lib/Support/Atomic.cpp
index 9559ad7..13d16d4 100644
--- a/lib/Support/Atomic.cpp
+++ b/lib/Support/Atomic.cpp
@@ -13,6 +13,9 @@
#include "llvm/Support/Atomic.h"
#include "llvm/Config/llvm-config.h"
+#if defined(ANDROID_TARGET_BUILD)
+#include "cutils/atomic.h"
+#endif
using namespace llvm;
@@ -47,6 +50,9 @@ sys::cas_flag sys::CompareAndSwap(volatile sys::cas_flag* ptr,
if (result == old_value)
*ptr = new_value;
return result;
+#elif defined(ANDROID_TARGET_BUILD)
+ return android_atomic_cmpxchg((int32_t)old_value, (int32_t)new_value,
+ (volatile int*)ptr);
#elif defined(GNU_ATOMICS)
return __sync_val_compare_and_swap(ptr, old_value, new_value);
#elif defined(_MSC_VER)
@@ -60,6 +66,8 @@ sys::cas_flag sys::AtomicIncrement(volatile sys::cas_flag* ptr) {
#if LLVM_HAS_ATOMICS == 0
++(*ptr);
return *ptr;
+#elif defined(ANDROID_TARGET_BUILD)
+ return android_atomic_inc((volatile int*)ptr);
#elif defined(GNU_ATOMICS)
return __sync_add_and_fetch(ptr, 1);
#elif defined(_MSC_VER)
@@ -73,6 +81,8 @@ sys::cas_flag sys::AtomicDecrement(volatile sys::cas_flag* ptr) {
#if LLVM_HAS_ATOMICS == 0
--(*ptr);
return *ptr;
+#elif defined(ANDROID_TARGET_BUILD)
+ return android_atomic_dec((volatile int*)ptr);
#elif defined(GNU_ATOMICS)
return __sync_sub_and_fetch(ptr, 1);
#elif defined(_MSC_VER)
@@ -86,6 +96,8 @@ sys::cas_flag sys::AtomicAdd(volatile sys::cas_flag* ptr, sys::cas_flag val) {
#if LLVM_HAS_ATOMICS == 0
*ptr += val;
return *ptr;
+#elif defined(ANDROID_TARGET_BUILD)
+ return android_atomic_add((int32_t)val, (volatile int*)ptr);
#elif defined(GNU_ATOMICS)
return __sync_add_and_fetch(ptr, val);
#elif defined(_MSC_VER)
diff --git a/lib/Support/Unix/Signals.inc b/lib/Support/Unix/Signals.inc
index b4c78d6..13ae862 100644
--- a/lib/Support/Unix/Signals.inc
+++ b/lib/Support/Unix/Signals.inc
@@ -271,7 +271,7 @@ void llvm::sys::PrintStackTrace(FILE *FD) {
// Use backtrace() to output a backtrace on Linux systems with glibc.
int depth = backtrace(StackTrace,
static_cast<int>(array_lengthof(StackTrace)));
-#if HAVE_DLFCN_H && __GNUG__
+#if HAVE_DLFCN_H && HAVE_CXXABI_H && __GNUG__
int width = 0;
for (int i = 0; i < depth; ++i) {
Dl_info dlinfo;