@@ -20,39 +20,38 @@ function build {
2020}
2121
2222function check {
23- local func= $1
23+ local func_re= " $1 "
2424 local checks=" ${TEST_DIR} /$2 "
2525 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}
26+ local objdump=" ${LLVM_BIN_DIR} /llvm-objdump"
27+ local filecheck=" ${LLVM_BIN_DIR} /FileCheck"
28+ local enclave=${WORK_DIR} /enclave/target/x86_64-fortanix-unknown-sgx/debug/enclave
29+
30+ func=" $( ${objdump} --syms --demangle ${enclave} | \
31+ grep --only-matching -E " [[:blank:]]+${func_re} \$ " | \
32+ sed -e ' s/^[[:space:]]*//' ) "
33+ ${objdump} --disassemble-symbols=" ${func} " --demangle \
34+ ${enclave} > ${asm}
3135 ${filecheck} --input-file ${asm} ${checks}
3236}
3337
3438build
3539
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"
40+ check " unw_getcontext" unw_getcontext.checks
41+ check " __libunwind_Registers_x86_64_jumpto" jumpto.checks
42+ check ' std::io::stdio::_print::[[:alnum:]]+' print.checks
43+ check rust_plus_one_global_asm rust_plus_one_global_asm.checks
4144
4245check cc_plus_one_c cc_plus_one_c.checks
4346check cc_plus_one_c_asm cc_plus_one_c_asm.checks
4447check cc_plus_one_cxx cc_plus_one_cxx.checks
4548check 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+ check cc_plus_one_asm cc_plus_one_asm.checks
4950
5051check cmake_plus_one_c cmake_plus_one_c.checks
5152check 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"
53+ check cmake_plus_one_c_global_asm cmake_plus_one_c_global_asm.checks
5454check cmake_plus_one_cxx cmake_plus_one_cxx.checks
5555check 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"
56+ check cmake_plus_one_cxx_global_asm cmake_plus_one_cxx_global_asm.checks
5857check cmake_plus_one_asm cmake_plus_one_asm.checks
0 commit comments