]> git.proxmox.com Git - rustc.git/blob - src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / src / test / run-make / x86_64-fortanix-unknown-sgx-lvi / script.sh
1 set -exuo pipefail
2
3 function build {
4 CRATE=enclave
5
6 mkdir -p $WORK_DIR
7 pushd $WORK_DIR
8 rm -rf $CRATE
9 cp -a $TEST_DIR/enclave .
10 pushd $CRATE
11 echo ${WORK_DIR}
12 # HACK(eddyb) sets `RUSTC_BOOTSTRAP=1` so Cargo can accept nightly features.
13 # These come from the top-level Rust workspace, that this crate is not a
14 # member of, but Cargo tries to load the workspace `Cargo.toml` anyway.
15 env RUSTC_BOOTSTRAP=1
16 cargo -v run --target $TARGET
17 popd
18 popd
19 }
20
21 function check {
22 local func=$1
23 local checks="${TEST_DIR}/$2"
24 local asm=$(mktemp)
25 local objdump="${BUILD_DIR}/x86_64-unknown-linux-gnu/llvm/build/bin/llvm-objdump"
26 local filecheck="${BUILD_DIR}/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck"
27
28 ${objdump} --disassemble-symbols=${func} --demangle \
29 ${WORK_DIR}/enclave/target/x86_64-fortanix-unknown-sgx/debug/enclave > ${asm}
30 ${filecheck} --input-file ${asm} ${checks}
31 }
32
33 build
34
35 check unw_getcontext unw_getcontext.checks
36 check "libunwind::Registers_x86_64::jumpto()" jumpto.checks
37 check "std::io::stdio::_print::h87f0c238421c45bc" print.checks
38 check rust_plus_one_global_asm rust_plus_one_global_asm.checks \
39 || echo "warning: module level assembly currently not hardened"
40
41 check cc_plus_one_c cc_plus_one_c.checks
42 check cc_plus_one_c_asm cc_plus_one_c_asm.checks
43 check cc_plus_one_cxx cc_plus_one_cxx.checks
44 check cc_plus_one_cxx_asm cc_plus_one_cxx_asm.checks
45 check cc_plus_one_asm cc_plus_one_asm.checks \
46 || echo "warning: the cc crate forwards assembly files to the CC compiler." \
47 "Clang uses its own intergrated assembler, which does not include the LVI passes."
48
49 check cmake_plus_one_c cmake_plus_one_c.checks
50 check cmake_plus_one_c_asm cmake_plus_one_c_asm.checks
51 check cmake_plus_one_c_global_asm cmake_plus_one_c_global_asm.checks \
52 || echo "warning: module level assembly currently not hardened"
53 check cmake_plus_one_cxx cmake_plus_one_cxx.checks
54 check cmake_plus_one_cxx_asm cmake_plus_one_cxx_asm.checks
55 check cmake_plus_one_cxx_global_asm cmake_plus_one_cxx_global_asm.checks \
56 || echo "warning: module level assembly currently not hardened"
57 check cmake_plus_one_asm cmake_plus_one_asm.checks