1 // Check that the interface exported by asan static lib matches the list of 2 // functions mentioned in sanitizer_interface.inc. 3 // 4 // Just make sure we can compile this. 5 // RUN: %clang_cl_asan -Od %s -Fe%t 6 // 7 // note: The mangling decoration (i.e. @4 )is removed because calling convention 8 // differ from 32-bit and 64-bit. 9 // 10 // RUN: dumpbin /EXPORTS %t | sed "s/=.*//" \ 11 // RUN: | grep -o "\(__asan_\|__ubsan_\|__sanitizer_\|__sancov_\)[^ ]*" \ 12 // RUN: | grep -v "__asan_wrap" \ 13 // RUN: | sed -e s/@.*// > %t.exports 14 // 15 // [BEWARE: be really careful with the sed commands, as this test can be run 16 // from different environments with different shells and seds] 17 // 18 // RUN: grep -e "^INTERFACE_FUNCTION" \ 19 // RUN: %p/../../../../lib/asan/asan_interface.inc \ 20 // RUN: %p/../../../../lib/ubsan/ubsan_interface.inc \ 21 // RUN: %p/../../../../lib/sanitizer_common/sanitizer_common_interface.inc \ 22 // RUN: %p/../../../../lib/sanitizer_common/sanitizer_coverage_interface.inc \ 23 // RUN: | sed -e "s/.*(//" -e "s/).*//" > %t.imports1 24 // 25 // RUN: grep -e "^INTERFACE_WEAK_FUNCTION" \ 26 // RUN: %p/../../../../lib/asan/asan_interface.inc \ 27 // RUN: %p/../../../../lib/ubsan/ubsan_interface.inc \ 28 // RUN: %p/../../../../lib/sanitizer_common/sanitizer_common_interface.inc \ 29 // RUN: %p/../../../../lib/sanitizer_common/sanitizer_coverage_interface.inc \ 30 // RUN: | sed -e "s/.*(//" -e "s/).*/__dll/" > %t.imports2 31 // 32 // Add functions not included in the interface lists: 33 // RUN: grep '[I]MPORT:' %s | sed -e 's/.*[I]MPORT: //' > %t.imports3 34 // IMPORT: __asan_shadow_memory_dynamic_address 35 // IMPORT: __asan_get_shadow_memory_dynamic_address 36 // IMPORT: __asan_option_detect_stack_use_after_return 37 // IMPORT: __asan_should_detect_stack_use_after_return 38 // IMPORT: __asan_set_seh_filter 39 // IMPORT: __asan_unhandled_exception_filter 40 // IMPORT: __asan_test_only_reported_buggy_pointer 41 // IMPORT: __sancov_lowest_stack 42 // IMPORT: __ubsan_vptr_type_cache 43 // 44 // RUN: cat %t.imports1 %t.imports2 %t.imports3 | sort | uniq > %t.imports-sorted 45 // RUN: cat %t.exports | sort | uniq > %t.exports-sorted 46 // 47 // Now make sure the DLL thunk imports everything: 48 // RUN: echo 49 // RUN: echo "=== NOTE === If you see a mismatch below, please update interface.inc files." 50 // RUN: diff %t.imports-sorted %t.exports-sorted 51 // REQUIRES: asan-static-runtime 52 53 int main() { return 0; } 54