diff options
| author | bors <bors@rust-lang.org> | 2015-06-27 05:06:22 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-06-27 05:06:22 +0000 |
| commit | d3c03d098747be06286f2aebc1e76f8c08352fdf (patch) | |
| tree | 2059612a95a7a6032f8321b7fab55b1c5b6766c6 /src/test | |
| parent | 773052a608736b873906f9bf1c3fd222d0b54764 (diff) | |
| parent | 759a7f1f66490191a6f809c9709151d6d27cea87 (diff) | |
| download | rust-d3c03d098747be06286f2aebc1e76f8c08352fdf.tar.gz rust-d3c03d098747be06286f2aebc1e76f8c08352fdf.zip | |
Auto merge of #26569 - alexcrichton:msvc-llvm-update, r=brson
Now that LLVM has been updated, the only remaining roadblock to implementing unwinding for MSVC is to fill out the runtime support in `std::rt::unwind::seh`. This commit does precisely that, fixing up some other bits and pieces along the way: * The `seh` unwinding module now uses `RaiseException` to initiate a panic. * The `rust_try.ll` file was rewritten for MSVC (as it's quite different) and is located at `rust_try_msvc_64.ll`, only included on MSVC builds for now. * The personality function for all landing pads generated by LLVM is hard-wired to `__C_specific_handler` instead of the standard `rust_eh_personality` lang item. This is required to get LLVM to emit SEH unwinding information instead of DWARF unwinding information. This also means that on MSVC the `rust_eh_personality` function is entirely unused (but is defined as it's a lang item). More details about how panicking works on SEH can be found in the `rust_try_msvc_64.ll` or `seh.rs` files, but I'm always open to adding more comments! A key aspect of this PR is missing, however, which is that **unwinding is still turned off by default for MSVC**. There is a [bug in llvm][llvm-bug] which causes optimizations to inline enough landing pads that LLVM chokes. If the compiler is optimized at `-O1` (where inlining isn't enabled) then it can bootstrap with unwinding enabled, but when optimized at `-O2` (inlining is enabled) then it hits a fatal LLVM error. [llvm-bug]: https://llvm.org/bugs/show_bug.cgi?id=23884
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/auxiliary/lang-item-public.rs | 35 | ||||
| -rw-r--r-- | src/test/run-pass/lang-item-public.rs | 30 |
2 files changed, 8 insertions, 57 deletions
diff --git a/src/test/auxiliary/lang-item-public.rs b/src/test/auxiliary/lang-item-public.rs index d195bd7e77b..4b60a370187 100644 --- a/src/test/auxiliary/lang-item-public.rs +++ b/src/test/auxiliary/lang-item-public.rs @@ -8,15 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(no_std)] +#![feature(no_std, core, libc)] #![no_std] #![feature(lang_items)] -#[lang="sized"] -pub trait Sized { } - -#[lang="panic"] -fn panic(_: &(&'static str, &'static str, usize)) -> ! { loop {} } +extern crate core; +extern crate libc; #[lang = "stack_exhausted"] extern fn stack_exhausted() {} @@ -24,26 +21,8 @@ extern fn stack_exhausted() {} #[lang = "eh_personality"] extern fn eh_personality() {} -#[lang="copy"] -pub trait Copy { - // Empty. -} - -#[lang="rem"] -pub trait Rem<RHS=Self> { - type Output = Self; - fn rem(self, rhs: RHS) -> Self::Output; -} - -impl Rem for isize { - type Output = isize; - - #[inline] - fn rem(self, other: isize) -> isize { - // if you use `self % other` here, as one would expect, you - // get back an error because of potential failure/overflow, - // which tries to invoke error fns that don't have the - // appropriate signatures anymore. So...just return 0. - 0 - } +#[lang = "panic_fmt"] +extern fn rust_begin_unwind(msg: core::fmt::Arguments, file: &'static str, + line: u32) -> ! { + loop {} } diff --git a/src/test/run-pass/lang-item-public.rs b/src/test/run-pass/lang-item-public.rs index f5b9bd4fbaa..57a32ba599f 100644 --- a/src/test/run-pass/lang-item-public.rs +++ b/src/test/run-pass/lang-item-public.rs @@ -11,39 +11,11 @@ // aux-build:lang-item-public.rs // ignore-android -#![feature(lang_items, start, no_std)] +#![feature(start, no_std)] #![no_std] extern crate lang_item_public as lang_lib; -#[cfg(target_os = "linux")] -#[link(name = "c")] -extern {} - -#[cfg(target_os = "android")] -#[link(name = "c")] -extern {} - -#[cfg(target_os = "freebsd")] -#[link(name = "execinfo")] -extern {} - -#[cfg(target_os = "freebsd")] -#[link(name = "c")] -extern {} - -#[cfg(target_os = "dragonfly")] -#[link(name = "c")] -extern {} - -#[cfg(any(target_os = "bitrig", target_os = "openbsd"))] -#[link(name = "c")] -extern {} - -#[cfg(target_os = "macos")] -#[link(name = "System")] -extern {} - #[start] fn main(_: isize, _: *const *const u8) -> isize { 1_isize % 1_isize |
