Updated libunwind, libcxx and libcxx patches and build commands

Build libcxx and libcxxabi (succeeding) and libunwind (patch rebased
but build not working).
This commit is contained in:
Martin Storsjö authored and Martin Storsjo committed 2016-08-31 12:25:08 +03:00
1 parent 0e847128ef
commit c1e32c9587
8 files changed
+455 -167

No files matched your search

+47 -26
View File
@@ -1,11 +1,18 @@
From 81b5dabfed88d2976faf587598361c054630ef95 Mon Sep 17 00:00:00 2001
From 46a001b37a0355b588ad99a3aab5593926fa31bc 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
Subject: [PATCH 1/2] libunwind add support for mingw-w64
---
include/unwind.h | 2 +-
src/AddressSpace.hpp | 11 +++++++----
src/UnwindLevel1-gcc-ext.c | 2 +-
src/assembly.h | 2 ++
src/config.h | 14 ++++++++++++++
5 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/include/unwind.h b/include/unwind.h
index 31fb871..e8c63d7 100644
index f3860d9..8f54d4d 100644
--- a/include/unwind.h
+++ b/include/unwind.h
@@ -121,7 +121,7 @@ struct _Unwind_Exception {
@@ -14,11 +21,11 @@ index 31fb871..e8c63d7 100644
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
// The implementation of _Unwind_Exception uses an attribute mode on the
// above fields which has 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
index da1b6a4..892950f 100644
--- a/src/AddressSpace.hpp
+++ b/src/AddressSpace.hpp
@@ -18,7 +18,7 @@
@@ -30,7 +37,7 @@ index 567cbda..fd0b233 100644
#include <dlfcn.h>
#endif
@@ -104,7 +104,7 @@ struct UnwindInfoSections {
@@ -109,7 +109,7 @@ struct UnwindInfoSections {
/// making local unwinds fast.
class __attribute__((visibility("hidden"))) LocalAddressSpace {
public:
@@ -39,7 +46,7 @@ index 567cbda..fd0b233 100644
typedef uint64_t pint_t;
typedef int64_t sint_t;
#else
@@ -156,7 +156,7 @@ public:
@@ -161,7 +161,7 @@ public:
};
inline uintptr_t LocalAddressSpace::getP(pint_t addr) {
@@ -48,7 +55,7 @@ index 567cbda..fd0b233 100644
return get64(addr);
#else
return get32(addr);
@@ -434,6 +434,7 @@ inline bool LocalAddressSpace::findUnwindSections(pint_t targetAddr,
@@ -439,6 +439,7 @@ inline bool LocalAddressSpace::findUnwindSections(pint_t targetAddr,
},
&cb_data);
return static_cast<bool>(found);
@@ -56,7 +63,7 @@ index 567cbda..fd0b233 100644
#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) {
@@ -462,7 +463,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) {
@@ -81,7 +88,7 @@ index 28ba092..0decf77 100644
(long)exception_object->unwinder_cache.reserved1);
#else
diff --git a/src/assembly.h b/src/assembly.h
index f46a24d..4d6c3e1 100644
index 06b29b3..96f46e3 100644
--- a/src/assembly.h
+++ b/src/assembly.h
@@ -26,6 +26,8 @@
@@ -94,33 +101,47 @@ index f46a24d..4d6c3e1 100644
#define HIDDEN_DIRECTIVE .hidden
#endif
diff --git a/src/config.h b/src/config.h
index c9ec087..6f14e92 100644
index a50222f..acc52a5 100644
--- a/src/config.h
+++ b/src/config.h
@@ -60,6 +60,23 @@
@@ -39,6 +39,14 @@
#define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1
#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)
+ #define _LIBUNWIND_SUPPORT_DWARF_INDEX 0
+ // 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>
#if defined(__ARM_DWARF_EH__) || !defined(__arm__)
#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 0
@@ -51,9 +59,14 @@
#endif
#endif
+#ifdef _WIN32
+#define _LIBUNWIND_EXPORT
+#define _LIBUNWIND_HIDDEN
+#else
// FIXME: these macros are not correct for COFF targets
#define _LIBUNWIND_EXPORT __attribute__((visibility("default")))
#define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden")))
+#endif
#if (defined(__APPLE__) && defined(__arm__)) || defined(__USING_SJLJ_EXCEPTIONS__)
#define _LIBUNWIND_BUILD_SJLJ_APIS 1
@@ -69,6 +82,7 @@
#if defined(__i386__) || defined(__x86_64__) || \
(!defined(__APPLE__) && defined(__arm__)) || \
+ (defined(_WIN32)) || \
(defined(__arm64__) || defined(__aarch64__)) || \
(defined(__APPLE__) && defined(__mips__))
#define _LIBUNWIND_BUILD_ZERO_COST_APIS 1
--
2.4.5
2.7.4