diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2017-10-04 14:54:28 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2017-10-11 09:05:38 -0700 |
| commit | 24cc38e3b00ff399acc99a57f92bfdef4ab8c949 (patch) | |
| tree | f64b7561d7bf67481376d931d9db916a3e4a1339 /src/test/codegen | |
| parent | 264aafe0566e521bbc95bd3f44dae97591c9fd20 (diff) | |
| download | rust-24cc38e3b00ff399acc99a57f92bfdef4ab8c949.tar.gz rust-24cc38e3b00ff399acc99a57f92bfdef4ab8c949.zip | |
rustc: Add LLVM `nounwind` with `-C panic=abort`
This informs LLVM that functions can't unwind, which while it should typically have already been inferred when necessary or otherwise not impact codegen is apparently needed on targets like ARM to avoid references to unnecessary symbols. Closes #44992
Diffstat (limited to 'src/test/codegen')
| -rw-r--r-- | src/test/codegen/auxiliary/nounwind.rs | 13 | ||||
| -rw-r--r-- | src/test/codegen/nounwind.rs | 26 | ||||
| -rw-r--r-- | src/test/codegen/panic-abort-windows.rs | 2 |
3 files changed, 40 insertions, 1 deletions
diff --git a/src/test/codegen/auxiliary/nounwind.rs b/src/test/codegen/auxiliary/nounwind.rs new file mode 100644 index 00000000000..5e40e8ede15 --- /dev/null +++ b/src/test/codegen/auxiliary/nounwind.rs @@ -0,0 +1,13 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[no_mangle] +pub fn bar() { +} diff --git a/src/test/codegen/nounwind.rs b/src/test/codegen/nounwind.rs new file mode 100644 index 00000000000..9fea907d3c8 --- /dev/null +++ b/src/test/codegen/nounwind.rs @@ -0,0 +1,26 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:nounwind.rs +// compile-flags: -C no-prepopulate-passes -C panic=abort -C metadata=a +// ignore-windows + +#![crate_type = "lib"] + +extern crate nounwind; + +#[no_mangle] +pub fn foo() { + nounwind::bar(); +// CHECK: @foo() unnamed_addr #0 +// CHECK: @bar() unnamed_addr #0 +// CHECK: attributes #0 = { {{.*}}nounwind{{.*}} } +} + diff --git a/src/test/codegen/panic-abort-windows.rs b/src/test/codegen/panic-abort-windows.rs index 2ab15277084..15688bdc2a1 100644 --- a/src/test/codegen/panic-abort-windows.rs +++ b/src/test/codegen/panic-abort-windows.rs @@ -28,7 +28,7 @@ #![crate_type = "lib"] -// CHECK: Function Attrs: uwtable +// CHECK: Function Attrs: nounwind uwtable // CHECK-NEXT: define void @normal_uwtable() #[no_mangle] pub fn normal_uwtable() { |
