diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 09:25:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 09:25:56 +0000 |
commit | 018c4950b9406055dec02ef0fb52f132e2bb1e2c (patch) | |
tree | a835ebdf2088ef88fa681f8fad45f09922c1ae9a /tests/assembly | |
parent | Adding debian version 1.75.0+dfsg1-5. (diff) | |
download | rustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.tar.xz rustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.zip |
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/assembly')
-rw-r--r-- | tests/assembly/asm/loongarch-type.rs | 3 | ||||
-rw-r--r-- | tests/assembly/dwarf4.rs | 24 | ||||
-rw-r--r-- | tests/assembly/dwarf5.rs | 1 | ||||
-rw-r--r-- | tests/assembly/stack-probes.rs (renamed from tests/assembly/x86-stack-probes.rs) | 13 | ||||
-rw-r--r-- | tests/assembly/stack-protector/stack-protector-target-support.rs | 7 | ||||
-rw-r--r-- | tests/assembly/thin-lto.rs | 8 | ||||
-rw-r--r-- | tests/assembly/x86_64-function-return.rs | 30 |
7 files changed, 75 insertions, 11 deletions
diff --git a/tests/assembly/asm/loongarch-type.rs b/tests/assembly/asm/loongarch-type.rs index 4e296f3ad..4aeecf92d 100644 --- a/tests/assembly/asm/loongarch-type.rs +++ b/tests/assembly/asm/loongarch-type.rs @@ -1,4 +1,3 @@ -// min-llvm-version: 16.0 // assembly-output: emit-asm // compile-flags: --target loongarch64-unknown-linux-gnu // needs-llvm-components: loongarch @@ -42,7 +41,7 @@ extern "C" { // Hack to avoid function merging extern "Rust" { - fn dont_merge(s: &str); + fn dont_merge(s: &str); } // CHECK-LABEL: sym_fn: diff --git a/tests/assembly/dwarf4.rs b/tests/assembly/dwarf4.rs new file mode 100644 index 000000000..6e1584458 --- /dev/null +++ b/tests/assembly/dwarf4.rs @@ -0,0 +1,24 @@ +// Makes sure that `-Z dwarf-version=4` causes `rustc` to emit DWARF version 4. +// assembly-output: emit-asm +// compile-flags: -g --target x86_64-unknown-linux-gnu -Z dwarf-version=4 -Copt-level=0 +// needs-llvm-components: x86 + +#![feature(no_core, lang_items)] +#![crate_type = "rlib"] +#![no_core] + +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} + +pub fn wibble() {} + +pub struct X; + +// CHECK: .section .debug_info +// CHECK-NOT: .short 2 +// CHECK-NOT: .short 5 +// CHECK: .short 4 +// CHECK-NOT: .section .debug_pubnames +// CHECK-NOT: .section .debug_pubtypes diff --git a/tests/assembly/dwarf5.rs b/tests/assembly/dwarf5.rs index 253baafb8..46d4e84b4 100644 --- a/tests/assembly/dwarf5.rs +++ b/tests/assembly/dwarf5.rs @@ -18,3 +18,4 @@ pub fn wibble() {} // CHECK-NOT: .short 2 // CHECK-NOT: .short 4 // CHECK: .short 5 +// CHECK: .section .debug_names diff --git a/tests/assembly/x86-stack-probes.rs b/tests/assembly/stack-probes.rs index c7141fb20..6466df3ff 100644 --- a/tests/assembly/x86-stack-probes.rs +++ b/tests/assembly/stack-probes.rs @@ -1,11 +1,12 @@ -// min-llvm-version: 16 -// revisions: x86_64 i686 +// revisions: x86_64 i686 aarch64 // assembly-output: emit-asm -//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu +//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //[x86_64] needs-llvm-components: x86 -//[i686] compile-flags: --target i686-unknown-linux-gnu +//[i686] compile-flags: --target i686-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //[i686] needs-llvm-components: x86 -// compile-flags: -C llvm-args=-x86-asm-syntax=intel +//[aarch64] compile-flags: --target aarch64-unknown-linux-gnu +//[aarch64] needs-llvm-components: aarch64 +//[aarch64] min-llvm-version: 18 #![feature(no_core, lang_items)] #![crate_type = "lib"] @@ -29,6 +30,7 @@ pub fn small_stack_probe(x: u8, f: fn(&mut [u8; 8192])) { // CHECK-NOT: __rust_probestack // x86_64: sub rsp, 4096 // i686: sub esp, 4096 + // aarch64: sub sp, sp, #1, lsl #12 f(&mut [x; 8192]); } @@ -38,5 +40,6 @@ pub fn big_stack_probe(x: u8, f: fn(&[u8; 65536])) { // CHECK-NOT: __rust_probestack // x86_64: sub rsp, 4096 // i686: sub esp, 4096 + // aarch64: sub sp, sp, #1, lsl #12 f(&mut [x; 65536]); } diff --git a/tests/assembly/stack-protector/stack-protector-target-support.rs b/tests/assembly/stack-protector/stack-protector-target-support.rs index e5cbace80..6d87fd191 100644 --- a/tests/assembly/stack-protector/stack-protector-target-support.rs +++ b/tests/assembly/stack-protector/stack-protector-target-support.rs @@ -2,7 +2,7 @@ // targets, with the exception of nvptx64-nvidia-cuda // // revisions: r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 -// revisions: r24 r25 r26 r27 r28 r29 r30 r31 r32 r33 r34 r35 r36 r37 r38 r39 r40 r41 r42 r43 r44 +// revisions: r24 r25 r26 r27 r28 r29 r30 r31 r32 r33 r35 r36 r37 r38 r39 r40 r41 r42 r43 r44 // revisions: r45 r46 r47 r48 r49 r50 r51 r52 r53 r54 r55 r56 r57 r58 r59 r60 r61 r62 r63 r64 r65 // revisions: r66 r67 r68 r69 r70 r71 r72 r73 r74 r75 r76 r77 r78 r79 r80 r81 r82 r83 r84 // assembly-output: emit-asm @@ -72,8 +72,7 @@ // [r32] needs-llvm-components: arm // [r33] compile-flags: --target armv7-unknown-linux-musleabihf // [r33] needs-llvm-components: arm -// [r34] compile-flags: --target asmjs-unknown-emscripten -// [r34] needs-llvm-components: webassembly + // [r35] compile-flags: --target i586-pc-windows-msvc // [r35] needs-llvm-components: x86 // [r36] compile-flags: --target i586-unknown-linux-gnu @@ -162,7 +161,7 @@ // [r77] needs-llvm-components: x86 // [r78] compile-flags:--target x86_64-linux-android // [r78] needs-llvm-components: x86 -// [r79] compile-flags:--target x86_64-sun-solaris +// [r79] compile-flags:--target x86_64-pc-solaris // [r79] needs-llvm-components: x86 // [r80] compile-flags:--target x86_64-unknown-freebsd // [r80] needs-llvm-components: x86 diff --git a/tests/assembly/thin-lto.rs b/tests/assembly/thin-lto.rs new file mode 100644 index 000000000..deb8fd21d --- /dev/null +++ b/tests/assembly/thin-lto.rs @@ -0,0 +1,8 @@ +// compile-flags: -O -C lto=thin -C prefer-dynamic=no +// only-x86_64-unknown-linux-gnu +// assembly-output: emit-asm + +// CHECK: main + +pub fn main() { +} diff --git a/tests/assembly/x86_64-function-return.rs b/tests/assembly/x86_64-function-return.rs new file mode 100644 index 000000000..0fcaca2d4 --- /dev/null +++ b/tests/assembly/x86_64-function-return.rs @@ -0,0 +1,30 @@ +// Test that the function return is (not) converted into a jump to the thunk +// when the `-Zfunction-return={keep,thunk-extern}` flag is (not) set. + +// revisions: unset keep thunk-extern keep-thunk-extern thunk-extern-keep +// assembly-output: emit-asm +// compile-flags: -O +// [keep] compile-flags: -Zfunction-return=keep +// [thunk-extern] compile-flags: -Zfunction-return=thunk-extern +// [keep-thunk-extern] compile-flags: -Zfunction-return=keep -Zfunction-return=thunk-extern +// [thunk-extern-keep] compile-flags: -Zfunction-return=thunk-extern -Zfunction-return=keep +// only-x86_64 +// ignore-x86_64-apple-darwin Symbol is called `___x86_return_thunk` (Darwin's extra underscore) +// ignore-sgx Tests incompatible with LVI mitigations + +#![crate_type = "lib"] + +// CHECK-LABEL: foo: +#[no_mangle] +pub unsafe fn foo() { + // unset: ret + // unset-NOT: jmp __x86_return_thunk + // keep: ret + // keep-NOT: jmp __x86_return_thunk + // thunk-extern: jmp __x86_return_thunk + // thunk-extern-NOT: ret + // keep-thunk-extern: jmp __x86_return_thunk + // keep-thunk-extern-NOT: ret + // thunk-extern-keep: ret + // thunk-extern-keep-NOT: jmp __x86_return_thunk +} |