about summary refs log tree commit diff
path: root/src/rt/rust_upcall.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-08-26 11:46:13 -0700
committerbors <bors@rust-lang.org>2013-08-26 11:46:13 -0700
commitce27752a69df6093ec0d104a7ecce755983a0f78 (patch)
tree9f81660a9117b57830d18b659d1dbfe1b3dc6fb7 /src/rt/rust_upcall.cpp
parent36b511558595a49b8c091937915d7616c2d62f14 (diff)
parent442f4a5f2ca6f7f4082c09968e0fd83601a50d2a (diff)
downloadrust-ce27752a69df6093ec0d104a7ecce755983a0f78.tar.gz
rust-ce27752a69df6093ec0d104a7ecce755983a0f78.zip
auto merge of #8488 : klutzy/rust/mingw-w64, r=brson
This patchset enables rustc to cross-build mingw-w64 outputs.
Tested on mingw + mingw-w64 (mingw-builds, win64/seh/win32-threads/gcc-4.8.1).

I also patched llvm to support Win64 stack unwinding.
https://github.com/klutzy/llvm/commit/ebe22bdbcebc4f8342c4c7c50e3b61fa6c68c1ad

I cross-built test/run-pass/smallest-hello-world.rs and confirmed it works.
However, I also found something went wrong if I don't have custom `#[start]` routine.
Diffstat (limited to 'src/rt/rust_upcall.cpp')
-rw-r--r--src/rt/rust_upcall.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp
index 21c0d219242..7ccb06a3296 100644
--- a/src/rt/rust_upcall.cpp
+++ b/src/rt/rust_upcall.cpp
@@ -54,8 +54,18 @@ upcall_call_shim_on_rust_stack(void *args, void *fn_ptr) {
 
 /**********************************************************************/
 
+#ifdef __SEH__
+#  define PERSONALITY_FUNC __gxx_personality_seh0
+#else
+#  ifdef __USING_SJLJ_EXCEPTIONS__
+#    define PERSONALITY_FUNC __gxx_personality_sjlj
+#  else
+#    define PERSONALITY_FUNC __gxx_personality_v0
+#  endif
+#endif
+
 extern "C" _Unwind_Reason_Code
-__gxx_personality_v0(int version,
+PERSONALITY_FUNC(int version,
                      _Unwind_Action actions,
                      uint64_t exception_class,
                      _Unwind_Exception *ue_header,
@@ -72,11 +82,11 @@ struct s_rust_personality_args {
 
 extern "C" void
 upcall_s_rust_personality(s_rust_personality_args *args) {
-    args->retval = __gxx_personality_v0(args->version,
-                                        args->actions,
-                                        args->exception_class,
-                                        args->ue_header,
-                                        args->context);
+    args->retval = PERSONALITY_FUNC(args->version,
+                                    args->actions,
+                                    args->exception_class,
+                                    args->ue_header,
+                                    args->context);
 }
 
 /**