about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorIvan Lozano <ivanlozano@google.com>2022-06-17 14:14:58 -0400
committerIvan Lozano <ivanlozano@google.com>2022-07-20 13:43:34 +0000
commitadf61e3b2b72f4a06b3ac5cf90d49deda42da605 (patch)
treecc7b018bca40d9d783f7b707965662da2569624f /src/test/codegen
parenta289cfcfb32593c63d75f113547f63ffe2dde285 (diff)
downloadrust-adf61e3b2b72f4a06b3ac5cf90d49deda42da605.tar.gz
rust-adf61e3b2b72f4a06b3ac5cf90d49deda42da605.zip
Add ShadowCallStack Support
Adds support for the LLVM ShadowCallStack sanitizer.
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/sanitizer_scs_attr_check.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/codegen/sanitizer_scs_attr_check.rs b/src/test/codegen/sanitizer_scs_attr_check.rs
new file mode 100644
index 00000000000..0b53db3b767
--- /dev/null
+++ b/src/test/codegen/sanitizer_scs_attr_check.rs
@@ -0,0 +1,17 @@
+// This tests that the shadowcallstack attribute is
+// applied when enabling the shadow-call-stack sanitizer.
+//
+// needs-sanitizer-shadow-call-stack
+// compile-flags: -Zsanitizer=shadow-call-stack
+
+#![crate_type = "lib"]
+#![feature(no_sanitize)]
+
+// CHECK: ; Function Attrs:{{.*}}shadowcallstack
+// CHECK-NEXT: scs
+pub fn scs() {}
+
+// CHECK-NOT: ; Function Attrs:{{.*}}shadowcallstack
+// CHECK-NEXT: no_scs
+#[no_sanitize(shadow_call_stack)]
+pub fn no_scs() {}