about summary refs log tree commit diff
path: root/tests/codegen-llvm
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2025-08-19 19:42:01 +0800
committerGitHub <noreply@github.com>2025-08-19 19:42:01 +0800
commitdf01a87de2f9cf936e380a3fca637e552f34a31b (patch)
treedbfe8d87097084d253ad89a4a0042067c842c38a /tests/codegen-llvm
parentc1a1222ece507bbf5e931da35c17457be9c5b81e (diff)
parent1a29d9c23ff8df46197f5ebd3df15fe99904d312 (diff)
downloadrust-df01a87de2f9cf936e380a3fca637e552f34a31b.tar.gz
rust-df01a87de2f9cf936e380a3fca637e552f34a31b.zip
Rollup merge of #140740 - ojeda:indirect-branch-cs-prefix, r=davidtwco
Add `-Zindirect-branch-cs-prefix`

Cc: ``@azhogin`` ``@Darksonn``

This goes on top of https://github.com/rust-lang/rust/pull/135927, i.e. please skip the first commit here. Please feel free to inherit it there.

In fact, I am not sure if there is any use case for the flag without `-Zretpoline*`. GCC and Clang allow it, though.

There is a `FIXME` for two `ignore`s in the test that I took from another test I did in the past -- they may be needed or not here since I didn't run the full CI. Either way, it is not critical.

Tracking issue: https://github.com/rust-lang/rust/issues/116852.
MCP: https://github.com/rust-lang/compiler-team/issues/868.
Diffstat (limited to 'tests/codegen-llvm')
-rw-r--r--tests/codegen-llvm/indirect-branch-cs-prefix.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/codegen-llvm/indirect-branch-cs-prefix.rs b/tests/codegen-llvm/indirect-branch-cs-prefix.rs
new file mode 100644
index 00000000000..df25008d5f0
--- /dev/null
+++ b/tests/codegen-llvm/indirect-branch-cs-prefix.rs
@@ -0,0 +1,18 @@
+// Test that the `indirect_branch_cs_prefix` module attribute is (not)
+// emitted when the `-Zindirect-branch-cs-prefix` flag is (not) set.
+
+//@ add-core-stubs
+//@ revisions: unset set
+//@ needs-llvm-components: x86
+//@ compile-flags: --target x86_64-unknown-linux-gnu
+//@ [set] compile-flags: -Zindirect-branch-cs-prefix
+
+#![crate_type = "lib"]
+#![feature(no_core, lang_items)]
+#![no_core]
+
+extern crate minicore;
+use minicore::*;
+
+// unset-NOT: !{{[0-9]+}} = !{i32 4, !"indirect_branch_cs_prefix", i32 1}
+// set: !{{[0-9]+}} = !{i32 4, !"indirect_branch_cs_prefix", i32 1}