]> git.lizzy.rs Git - rust.git/commitdiff
Adding checks for assembly files in libunwind
authorRaoul Strackx <raoul.strackx@fortanix.com>
Wed, 25 Mar 2020 14:28:34 +0000 (15:28 +0100)
committerRaoul Strackx <raoul.strackx@fortanix.com>
Fri, 25 Sep 2020 13:02:14 +0000 (15:02 +0200)
src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile [new file with mode: 0644]
src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave.rs [new file with mode: 0644]
src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/jumpto.checks [new file with mode: 0644]
src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/unw_getcontext.checks [new file with mode: 0644]

diff --git a/src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile b/src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile
new file mode 100644 (file)
index 0000000..b17f9a1
--- /dev/null
@@ -0,0 +1,17 @@
+-include ../../run-make-fulldeps/tools.mk
+
+#only-x86_64-fortanix-unknown-sgx
+
+OBJDUMP="${S}/build/x86_64-unknown-linux-gnu/llvm/build/bin/llvm-objdump"
+FILECHECK="${S}/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck"
+
+all:
+       $(RUSTC) --target ${TARGET} enclave.rs
+
+       #TODO: re-enable check when newly compiled libunwind is used
+       #${OBJDUMP} --disassemble-symbols=unw_getcontext --demangle $(TMPDIR)/enclave > $(TMPDIR)/unw_getcontext.asm
+       #${FILECHECK} --input-file $(TMPDIR)/unw_getcontext.asm unw_getcontext.checks
+
+       #TODO: re-enable check when newly compiled libunwind is used
+       ${OBJDUMP} --disassemble-symbols="libunwind::Registers_x86_64::jumpto()" --demangle $(TMPDIR)/enclave > $(TMPDIR)/jumpto.asm
+       ${FILECHECK} --input-file $(TMPDIR)/jumpto.asm jumpto.checks
diff --git a/src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave.rs b/src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave.rs
new file mode 100644 (file)
index 0000000..66c8ead
--- /dev/null
@@ -0,0 +1,5 @@
+
+pub fn main() {
+    println!("Hello, World!");
+}
+
diff --git a/src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/jumpto.checks b/src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/jumpto.checks
new file mode 100644 (file)
index 0000000..15211e3
--- /dev/null
@@ -0,0 +1,8 @@
+CHECK: libunwind::Registers_x86_64::jumpto
+CHECK:      lfence
+CHECK:      lfence
+CHECK:      lfence
+CHECK:      lfence
+CHECK:      shlq    $0, (%rsp)
+CHECK-NEXT: lfence
+CHECK-NEXT: retq
diff --git a/src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/unw_getcontext.checks b/src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/unw_getcontext.checks
new file mode 100644 (file)
index 0000000..50b8286
--- /dev/null
@@ -0,0 +1,7 @@
+CHECK: unw_getcontext
+CHECK:      lfence
+CHECK:      lfence
+CHECK:      notq (%rsp)
+CHECK-NEXT: notq (%rsp)
+CHECK-NEXT: lfence
+CHECK-NEXT: retq