about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorOleksii Lozovskyi <me@ilammy.net>2022-10-02 10:55:35 +0900
committerOleksii Lozovskyi <me@ilammy.net>2023-02-09 12:29:40 +0900
commit3561dc948c1a2a24c2b49992099954a96be3c8ee (patch)
tree01b21b307e9a61c64f18d1f447fc7bb50549e8ec /tests
parent8e49c847400b0ec47d501a72e3c0ad95f81b5fe9 (diff)
Emit an error if -Z instrument-xray is not supported
This is somewhat important because LLVM enables the pass based on
target architecture, but support by the target OS also matters.

For example, XRay attributes are processed by codegen for macOS
targets, but Apple linker fails to process relocations in XRay
data sections, so the feature as a whole is not supported there
for the time being.
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/instrument-xray/target-not-supported.rs9
-rw-r--r--tests/ui/instrument-xray/target-not-supported.stderr4
2 files changed, 13 insertions, 0 deletions
diff --git a/tests/ui/instrument-xray/target-not-supported.rs b/tests/ui/instrument-xray/target-not-supported.rs
new file mode 100644
index 00000000000..e6bdd23e8fc
--- /dev/null
+++ b/tests/ui/instrument-xray/target-not-supported.rs
@@ -0,0 +1,9 @@
+// Verifies that `-Z instrument-xray` cannot be used with unsupported targets,
+//
+// needs-llvm-components: x86
+// compile-flags: -Z instrument-xray --target x86_64-apple-darwin
+// error-pattern: error: XRay instrumentation is not supported for this target
+
+#![feature(no_core)]
+#![no_core]
+#![no_main]
diff --git a/tests/ui/instrument-xray/target-not-supported.stderr b/tests/ui/instrument-xray/target-not-supported.stderr
new file mode 100644
index 00000000000..6e3b0c8a380
--- /dev/null
+++ b/tests/ui/instrument-xray/target-not-supported.stderr
@@ -0,0 +1,4 @@
+error: XRay instrumentation is not supported for this target
+
+error: aborting due to previous error
+