diff options
| author | bors <bors@rust-lang.org> | 2021-01-16 03:10:52 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-01-16 03:10:52 +0000 |
| commit | 635ccfe01c0be19d9fb0a99facbd9e06290f0ab1 (patch) | |
| tree | 278f5200156f523b626bea00183518235a0b9074 /src | |
| parent | 6c869d34ae2d87d21db9892d4dc088639bcbe041 (diff) | |
| parent | cd2580722375671fa2967661f65b7b33570547ec (diff) | |
| download | rust-635ccfe01c0be19d9fb0a99facbd9e06290f0ab1.tar.gz rust-635ccfe01c0be19d9fb0a99facbd9e06290f0ab1.zip | |
Auto merge of #77885 - erikdesjardins:probeasm, r=cuviper
Use probe-stack=inline-asm in LLVM 11+ Fixes (?) #74405, related to #43241 r? `@cuviper`
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/assembly/stack-probes.rs | 42 | ||||
| -rw-r--r-- | src/test/codegen/stack-probes.rs | 3 |
2 files changed, 44 insertions, 1 deletions
diff --git a/src/test/assembly/stack-probes.rs b/src/test/assembly/stack-probes.rs new file mode 100644 index 00000000000..9597e242f1b --- /dev/null +++ b/src/test/assembly/stack-probes.rs @@ -0,0 +1,42 @@ +// min-llvm-version: 11.0.1 +// revisions: x86_64 i686 +// assembly-output: emit-asm +//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu +//[i686] compile-flags: --target i686-unknown-linux-gnu +// compile-flags: -C llvm-args=--x86-asm-syntax=intel + +#![feature(no_core, lang_items)] +#![crate_type = "lib"] +#![no_core] + +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} + +impl Copy for u8 {} + +// Check that inline-asm stack probes are generated correctly. +// To avoid making this test fragile to slight asm changes, +// we only check that the stack pointer is decremented by a page at a time, +// instead of matching the whole probe sequence. + +// CHECK-LABEL: small_stack_probe: +#[no_mangle] +pub fn small_stack_probe(x: u8, f: fn([u8; 8192])) { + // CHECK-NOT: __rust_probestack + // x86_64: sub rsp, 4096 + // i686: sub esp, 4096 + let a = [x; 8192]; + f(a); +} + +// CHECK-LABEL: big_stack_probe: +#[no_mangle] +pub fn big_stack_probe(x: u8, f: fn([u8; 65536])) { + // CHECK-NOT: __rust_probestack + // x86_64: sub rsp, 4096 + // i686: sub esp, 4096 + let a = [x; 65536]; + f(a); +} diff --git a/src/test/codegen/stack-probes.rs b/src/test/codegen/stack-probes.rs index 3e3222d4735..b05787df8e3 100644 --- a/src/test/codegen/stack-probes.rs +++ b/src/test/codegen/stack-probes.rs @@ -13,11 +13,12 @@ // ignore-emscripten // ignore-windows // compile-flags: -C no-prepopulate-passes +// min-llvm-version: 11.0.1 #![crate_type = "lib"] #[no_mangle] pub fn foo() { // CHECK: @foo() unnamed_addr #0 -// CHECK: attributes #0 = { {{.*}}"probe-stack"="__rust_probestack"{{.*}} } +// CHECK: attributes #0 = { {{.*}}"probe-stack"="inline-asm"{{.*}} } } |
