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