summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2014-04-08 12:04:51 -0700
committerDan Albert <danalbert@google.com>2014-04-15 10:23:29 -0700
commite085735cbedc82b1064f05ff796e32e906a95036 (patch)
treeeb31ee9d7012974318a2c653e9b6acc29284dabd /src
parent426b4a2074546a3be819110978876163a8f1704c (diff)
downloadlibcxxabi-e085735cbedc82b1064f05ff796e32e906a95036.tar.gz
Gets libcxxabi building for Android
Fixes a few configuration issues in libcxxabi and adds an Android makefile. Change-Id: I247372d87caabe0310bedc4540b68ab2ed1986c1
Diffstat (limited to 'src')
-rw-r--r--src/Unwind/AddressSpace.hpp2
-rw-r--r--src/Unwind/UnwindCursor.hpp3
-rw-r--r--src/Unwind/config.h14
-rw-r--r--src/cxa_exception.cpp6
-rw-r--r--src/cxa_personality.cpp2
5 files changed, 21 insertions, 6 deletions
diff --git a/src/Unwind/AddressSpace.hpp b/src/Unwind/AddressSpace.hpp
index fafee04..ff8c8b0 100644
--- a/src/Unwind/AddressSpace.hpp
+++ b/src/Unwind/AddressSpace.hpp
@@ -298,7 +298,7 @@ inline bool LocalAddressSpace::findOtherFDE(pint_t targetAddr, pint_t &fde) {
inline bool LocalAddressSpace::findFunctionName(pint_t addr, char *buf,
size_t bufLen,
unw_word_t *offset) {
- dl_info dyldInfo;
+ Dl_info dyldInfo;
if (dladdr((void *)addr, &dyldInfo)) {
if (dyldInfo.dli_sname != NULL) {
strlcpy(buf, dyldInfo.dli_sname, bufLen);
diff --git a/src/Unwind/UnwindCursor.hpp b/src/Unwind/UnwindCursor.hpp
index 235922f..035e471 100644
--- a/src/Unwind/UnwindCursor.hpp
+++ b/src/Unwind/UnwindCursor.hpp
@@ -151,10 +151,12 @@ void DwarfFDECache<A>::removeAllIn(pint_t mh) {
_LIBUNWIND_LOG_NON_ZERO(::pthread_rwlock_unlock(&_lock));
}
+#if __APPLE__
template <typename A>
void DwarfFDECache<A>::dyldUnloadHook(const struct mach_header *mh, intptr_t ) {
removeAllIn((pint_t) mh);
}
+#endif
template <typename A>
void DwarfFDECache<A>::iterateCacheEntries(void (*func)(
@@ -363,6 +365,7 @@ private:
class _LIBUNWIND_HIDDEN AbstractUnwindCursor {
public:
+ virtual ~AbstractUnwindCursor() {}
virtual bool validReg(int) = 0;
virtual unw_word_t getReg(int) = 0;
virtual void setReg(int, unw_word_t) = 0;
diff --git a/src/Unwind/config.h b/src/Unwind/config.h
index 7d7e6bf..5aaadaf 100644
--- a/src/Unwind/config.h
+++ b/src/Unwind/config.h
@@ -43,7 +43,7 @@
#define _LIBUNWIND_SUPPORT_FRAME_APIS (__i386__ || __x86_64__)
#define _LIBUNWIND_EXPORT __attribute__((visibility("default")))
#define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden")))
- #define _LIBUNWIND_LOG(msg, ...) fprintf(stderr, "libuwind: " msg, __VA_ARGS__)
+ #define _LIBUNWIND_LOG(msg, ...) fprintf(stderr, "libunwind: " msg, __VA_ARGS__)
#define _LIBUNWIND_ABORT(msg) __assert_rtn(__func__, __FILE__, __LINE__, msg)
#if FOR_DYLD
@@ -56,6 +56,18 @@
#define _LIBUNWIND_SUPPORT_DWARF_INDEX 0
#endif
+#elif defined(__BIONIC__)
+ #define _LIBUNWIND_BUILD_ZERO_COST_APIS (__i386__ || __x86_64__ || __arm64__ || __arm__)
+ #define _LIBUNWIND_BUILD_SJLJ_APIS 0
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS (__i386__ || __x86_64__)
+ #define _LIBUNWIND_EXPORT __attribute__((visibility("default")))
+ #define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden")))
+ #define _LIBUNWIND_LOG(msg, ...) fprintf(stderr, "libunwind: " msg, __VA_ARGS__)
+ #define _LIBUNWIND_ABORT(msg) __assert2(__FILE__, __LINE__, __func__, msg)
+
+ #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1
+ #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1
+ #define _LIBUNWIND_SUPPORT_DWARF_INDEX 0
#else
// #define _LIBUNWIND_BUILD_ZERO_COST_APIS
// #define _LIBUNWIND_BUILD_SJLJ_APIS
diff --git a/src/cxa_exception.cpp b/src/cxa_exception.cpp
index 744dddd..787d8a8 100644
--- a/src/cxa_exception.cpp
+++ b/src/cxa_exception.cpp
@@ -232,7 +232,7 @@ __cxa_throw(void* thrown_object, std::type_info* tinfo, void (*dest)(void*))
globals->uncaughtExceptions += 1; // Not atomically, since globals are thread-local
exception_header->unwindHeader.exception_cleanup = exception_cleanup_func;
-#if __arm__
+#if _LIBUNWIND_BUILD_SJLJ_APIS
_Unwind_SjLj_RaiseException(&exception_header->unwindHeader);
#else
_Unwind_RaiseException(&exception_header->unwindHeader);
@@ -465,7 +465,7 @@ __cxa_rethrow()
// nothing
globals->caughtExceptions = 0;
}
-#if __arm__
+#if _LIBUNWIND_BUILD_SJLJ_APIS
_Unwind_SjLj_RaiseException(&exception_header->unwindHeader);
#else
_Unwind_RaiseException(&exception_header->unwindHeader);
@@ -594,7 +594,7 @@ __cxa_rethrow_primary_exception(void* thrown_object)
setDependentExceptionClass(&dep_exception_header->unwindHeader);
__cxa_get_globals()->uncaughtExceptions += 1;
dep_exception_header->unwindHeader.exception_cleanup = dependent_exception_cleanup;
-#if __arm__
+#if _LIBUNWIND_BUILD_SJLJ_APIS
_Unwind_SjLj_RaiseException(&dep_exception_header->unwindHeader);
#else
_Unwind_RaiseException(&dep_exception_header->unwindHeader);
diff --git a/src/cxa_personality.cpp b/src/cxa_personality.cpp
index 81104b8..32a3127 100644
--- a/src/cxa_personality.cpp
+++ b/src/cxa_personality.cpp
@@ -838,7 +838,7 @@ _UA_CLEANUP_PHASE
*/
_Unwind_Reason_Code
-#if __arm__
+#if _LIBUNWIND_BUILD_SJLJ_APIS
__gxx_personality_sj0
#else
__gxx_personality_v0