libcxx now compiles
This commit is contained in:
1 parent
4808f05671
commit
1e0a216c46
7 files changed
+339
-23
No files matched your search
@@ -0,0 +1,126 @@
|
||||
From 81b5dabfed88d2976faf587598361c054630ef95 Mon Sep 17 00:00:00 2001
|
||||
From: Martell Malone <martellmalone@gmail.com>
|
||||
Date: Tue, 21 Jul 2015 04:35:55 +0100
|
||||
Subject: [PATCH] libunwind add support for mingw-w64
|
||||
|
||||
|
||||
diff --git a/include/unwind.h b/include/unwind.h
|
||||
index 31fb871..e8c63d7 100644
|
||||
--- a/include/unwind.h
|
||||
+++ b/include/unwind.h
|
||||
@@ -121,7 +121,7 @@ struct _Unwind_Exception {
|
||||
_Unwind_Exception *exc);
|
||||
uintptr_t private_1; // non-zero means forced unwind
|
||||
uintptr_t private_2; // holds sp that phase1 found for phase2 to use
|
||||
-#ifndef __LP64__
|
||||
+#if !defined(__LP64__) && !defined(_WIN64)
|
||||
// The gcc implementation of _Unwind_Exception used attribute mode on the
|
||||
// above fields which had the side effect of causing this whole struct to
|
||||
// round up to 32 bytes in size. To be more explicit, we add pad fields
|
||||
diff --git a/src/AddressSpace.hpp b/src/AddressSpace.hpp
|
||||
index 567cbda..fd0b233 100644
|
||||
--- a/src/AddressSpace.hpp
|
||||
+++ b/src/AddressSpace.hpp
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
-#ifndef _LIBUNWIND_IS_BAREMETAL
|
||||
+#if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32)
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
@@ -104,7 +104,7 @@ struct UnwindInfoSections {
|
||||
/// making local unwinds fast.
|
||||
class __attribute__((visibility("hidden"))) LocalAddressSpace {
|
||||
public:
|
||||
-#ifdef __LP64__
|
||||
+#if defined(__LP64__) || defined(_WIN64)
|
||||
typedef uint64_t pint_t;
|
||||
typedef int64_t sint_t;
|
||||
#else
|
||||
@@ -156,7 +156,7 @@ public:
|
||||
};
|
||||
|
||||
inline uintptr_t LocalAddressSpace::getP(pint_t addr) {
|
||||
-#ifdef __LP64__
|
||||
+#if defined(__LP64__) || defined(_WIN64)
|
||||
return get64(addr);
|
||||
#else
|
||||
return get32(addr);
|
||||
@@ -434,6 +434,7 @@ inline bool LocalAddressSpace::findUnwindSections(pint_t targetAddr,
|
||||
},
|
||||
&cb_data);
|
||||
return static_cast<bool>(found);
|
||||
+#elif defined(_WIN32)
|
||||
#else
|
||||
#error "_LIBUNWIND_SUPPORT_DWARF_UNWIND requires _LIBUNWIND_SUPPORT_DWARF_INDEX on this platform."
|
||||
#endif
|
||||
@@ -457,7 +458,9 @@ 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) {
|
||||
-#ifndef _LIBUNWIND_IS_BAREMETAL
|
||||
+#ifdef _WIN32
|
||||
+// FIXME: support DLLs on Windows.
|
||||
+#elif !defined(_LIBUNWIND_IS_BAREMETAL)
|
||||
Dl_info dyldInfo;
|
||||
if (dladdr((void *)addr, &dyldInfo)) {
|
||||
if (dyldInfo.dli_sname != NULL) {
|
||||
diff --git a/src/UnwindLevel1-gcc-ext.c b/src/UnwindLevel1-gcc-ext.c
|
||||
index 28ba092..0decf77 100644
|
||||
--- a/src/UnwindLevel1-gcc-ext.c
|
||||
+++ b/src/UnwindLevel1-gcc-ext.c
|
||||
@@ -29,7 +29,7 @@
|
||||
_LIBUNWIND_EXPORT _Unwind_Reason_Code
|
||||
_Unwind_Resume_or_Rethrow(_Unwind_Exception *exception_object) {
|
||||
#if _LIBUNWIND_ARM_EHABI
|
||||
- _LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%ld\n",
|
||||
+ _LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%" PRIdPTR "\n",
|
||||
(void *)exception_object,
|
||||
(long)exception_object->unwinder_cache.reserved1);
|
||||
#else
|
||||
diff --git a/src/assembly.h b/src/assembly.h
|
||||
index f46a24d..4d6c3e1 100644
|
||||
--- a/src/assembly.h
|
||||
+++ b/src/assembly.h
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#define HIDDEN_DIRECTIVE .private_extern
|
||||
+#elif defined(_WIN32)
|
||||
+#define HIDDEN_DIRECTIVE .globl
|
||||
#else
|
||||
#define HIDDEN_DIRECTIVE .hidden
|
||||
#endif
|
||||
diff --git a/src/config.h b/src/config.h
|
||||
index c9ec087..6f14e92 100644
|
||||
--- a/src/config.h
|
||||
+++ b/src/config.h
|
||||
@@ -60,6 +60,23 @@
|
||||
#define _LIBUNWIND_SUPPORT_DWARF_INDEX 0
|
||||
#endif
|
||||
|
||||
+#elif defined(_WIN32)
|
||||
+ // Note! the assembler files must be .S and not .s.
|
||||
+ #define _LIBUNWIND_BUILD_ZERO_COST_APIS 1
|
||||
+
|
||||
+ // #define _LIBUNWIND_BUILD_SJLJ_APIS
|
||||
+ // #define _LIBUNWIND_SUPPORT_FRAME_APIS
|
||||
+ #define _LIBUNWIND_EXPORT
|
||||
+ #define _LIBUNWIND_HIDDEN
|
||||
+ #define _LIBUNWIND_LOG(msg, ...) fprintf(stderr, "libuwind: " msg, __VA_ARGS__)
|
||||
+ #define _LIBUNWIND_ABORT(msg) do { fprintf(stderr, msg); abort(); } while(0)
|
||||
+ #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1
|
||||
+ #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1
|
||||
+ // #define _LIBUNWIND_SUPPORT_DWARF_INDEX
|
||||
+ #define bzero(s,n) memset(s,0,n)
|
||||
+ // libcxx may have defined __USE_MINGW_ANSI_STDIO.
|
||||
+ // Here we would like to get the regular versions, not the _mingw ones.
|
||||
+ #undef __USE_MINGW_ANSI_STDIO
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
|
||||
--
|
||||
2.4.5
|
||||
|
||||
Reference in new issue
Block a user