-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow using
-C force-unwind-tables=no
when panic=unwind
- Loading branch information
hyd-dev
committed
Apr 11, 2021
1 parent
58f32da
commit 2fd4dd2
Showing
7 changed files
with
74 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// assembly-output: emit-asm | ||
// only-x86_64-unknown-linux-gnu | ||
// compile-flags: -C panic=unwind -C force-unwind-tables=n -O | ||
|
||
#![crate_type = "lib"] | ||
|
||
// CHECK-NOT: .cfi_startproc | ||
pub fn foo() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// assembly-output: emit-asm | ||
// only-x86_64-unknown-linux-gnu | ||
// compile-flags: -C panic=unwind -C force-unwind-tables=n | ||
|
||
#![crate_type = "lib"] | ||
|
||
// CHECK-LABEL: foo: | ||
// CHECK: .cfi_startproc | ||
#[no_mangle] | ||
fn foo() { | ||
panic!(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// compile-flags: -C panic=unwind -C no-prepopulate-passes | ||
|
||
#![crate_type = "lib"] | ||
|
||
// CHECK: attributes #{{.*}} uwtable | ||
pub fn foo() {} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// run-pass | ||
// ignore-windows target requires uwtable | ||
// ignore-wasm32-bare no proper panic=unwind support | ||
// compile-flags: -C panic=unwind -C force-unwind-tables=n | ||
|
||
use std::panic::{self, AssertUnwindSafe}; | ||
|
||
struct Increase<'a>(&'a mut u8); | ||
|
||
impl Drop for Increase<'_> { | ||
fn drop(&mut self) { | ||
*self.0 += 1; | ||
} | ||
} | ||
|
||
#[inline(never)] | ||
fn unwind() { | ||
panic!(); | ||
} | ||
|
||
#[inline(never)] | ||
fn increase(count: &mut u8) { | ||
let _increase = Increase(count); | ||
unwind(); | ||
} | ||
|
||
fn main() { | ||
let mut count = 0; | ||
assert!(panic::catch_unwind(AssertUnwindSafe( | ||
#[inline(never)] | ||
|| increase(&mut count) | ||
)).is_err()); | ||
assert_eq!(count, 1); | ||
} |