about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2016-03-22 20:32:08 -0400
committerNiko Matsakis <niko@alum.mit.edu>2016-03-25 14:07:20 -0400
commitb385ce12232a6c192b168b75ec9867a5a83d2036 (patch)
tree06bfa5bdb79ada3af366a7523c364541af951562
parent751c24d345cd016429583e4d6654538ed881748a (diff)
downloadrust-b385ce12232a6c192b168b75ec9867a5a83d2036.tar.gz
rust-b385ce12232a6c192b168b75ec9867a5a83d2036.zip
workarounds to make link guards work on windows
Link guards cause problems in some specific scenarios on windows because
they force libcore to be instantiated, since we do not GC functions
effectively on windows.

The changes here are two:

1. disable core for rsbegin/rsend
2. make panic_fmt an extern fn for smallest-hello-world so that it
   is not marked as "internal" for LLVM
-rw-r--r--src/rtstartup/rsbegin.rs13
-rw-r--r--src/rtstartup/rsend.rs7
-rw-r--r--src/test/run-pass/smallest-hello-world.rs2
3 files changed, 19 insertions, 3 deletions
diff --git a/src/rtstartup/rsbegin.rs b/src/rtstartup/rsbegin.rs
index d1b6fe6655a..bbabed20ec1 100644
--- a/src/rtstartup/rsbegin.rs
+++ b/src/rtstartup/rsbegin.rs
@@ -23,9 +23,20 @@
 // of other runtime components (registered via yet another special image section).
 
 #![crate_type="rlib"]
-#![no_std]
+#![feature(no_core, lang_items, optin_builtin_traits)]
+#![no_core]
 #![allow(non_camel_case_types)]
 
+#[lang="sized"]
+trait Sized {}
+
+#[lang="copy"]
+trait Copy {}
+
+#[lang="sync"]
+trait Sync {}
+impl Sync for .. {}
+
 #[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))]
 pub mod eh_frames
 {
diff --git a/src/rtstartup/rsend.rs b/src/rtstartup/rsend.rs
index 5e4e13ebd05..1ab194d5eb9 100644
--- a/src/rtstartup/rsend.rs
+++ b/src/rtstartup/rsend.rs
@@ -11,7 +11,12 @@
 // See rsbegin.rs for details.
 
 #![crate_type="rlib"]
-#![no_std]
+#![feature(no_core, lang_items, optin_builtin_traits)]
+#![no_core]
+
+#[lang="sync"]
+trait Sync {}
+impl Sync for .. {}
 
 #[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))]
 pub mod eh_frames
diff --git a/src/test/run-pass/smallest-hello-world.rs b/src/test/run-pass/smallest-hello-world.rs
index b11970560d5..7fc6e6ba1b0 100644
--- a/src/test/run-pass/smallest-hello-world.rs
+++ b/src/test/run-pass/smallest-hello-world.rs
@@ -22,7 +22,7 @@ extern "rust-intrinsic" { fn transmute<T, U>(t: T) -> U; }
 
 #[lang = "eh_personality"] extern fn eh_personality() {}
 #[lang = "eh_unwind_resume"] extern fn eh_unwind_resume() {}
-#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
+#[lang = "panic_fmt"] extern fn panic_fmt() -> ! { loop {} }
 #[no_mangle] pub extern fn rust_eh_register_frames () {}
 #[no_mangle] pub extern fn rust_eh_unregister_frames () {}