summaryrefslogtreecommitdiffstats
path: root/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/src
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/src')
-rw-r--r--tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/src/main.rs49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/src/main.rs b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/src/main.rs
new file mode 100644
index 000000000..cde38aacf
--- /dev/null
+++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/src/main.rs
@@ -0,0 +1,49 @@
+std::arch::global_asm!(
+ r#"
+ .text
+ .global rust_plus_one_global_asm
+ .type rust_plus_one_global_asm, @function
+rust_plus_one_global_asm:
+ movl (%rdi), %eax
+ inc %eax
+ retq
+"#,
+ options(att_syntax)
+);
+
+extern "C" {
+ fn cc_plus_one_c(arg: &u32) -> u32;
+ fn cc_plus_one_c_asm(arg: &u32) -> u32;
+ fn cc_plus_one_cxx(arg: &u32) -> u32;
+ fn cc_plus_one_cxx_asm(arg: &u32) -> u32;
+ fn cc_plus_one_asm(arg: &u32) -> u32;
+ fn cmake_plus_one_c(arg: &u32) -> u32;
+ fn cmake_plus_one_c_asm(arg: &u32) -> u32;
+ fn cmake_plus_one_cxx(arg: &u32) -> u32;
+ fn cmake_plus_one_cxx_asm(arg: &u32) -> u32;
+ fn cmake_plus_one_c_global_asm(arg: &u32) -> u32;
+ fn cmake_plus_one_cxx_global_asm(arg: &u32) -> u32;
+ fn cmake_plus_one_asm(arg: &u32) -> u32;
+ fn rust_plus_one_global_asm(arg: &u32) -> u32;
+}
+
+fn main() {
+ let value: u32 = 41;
+ let question = "Answer to the Ultimate Question of Life, the Universe, and Everything:";
+
+ unsafe {
+ println!("{}: {}!", question, rust_plus_one_global_asm(&value));
+ println!("{}: {}!", question, cc_plus_one_c(&value));
+ println!("{}: {}!", question, cc_plus_one_c_asm(&value));
+ println!("{}: {}!", question, cc_plus_one_cxx(&value));
+ println!("{}: {}!", question, cc_plus_one_cxx_asm(&value));
+ println!("{}: {}!", question, cc_plus_one_asm(&value));
+ println!("{}: {}!", question, cmake_plus_one_c(&value));
+ println!("{}: {}!", question, cmake_plus_one_c_asm(&value));
+ println!("{}: {}!", question, cmake_plus_one_cxx(&value));
+ println!("{}: {}!", question, cmake_plus_one_cxx_asm(&value));
+ println!("{}: {}!", question, cmake_plus_one_c_global_asm(&value));
+ println!("{}: {}!", question, cmake_plus_one_cxx_global_asm(&value));
+ println!("{}: {}!", question, cmake_plus_one_asm(&value));
+ }
+}