1673dc3d4SNico Weber // Check that the interface exported by asan static lib matches the list of 2673dc3d4SNico Weber // functions mentioned in sanitizer_interface.inc. 3673dc3d4SNico Weber // 4673dc3d4SNico Weber // Just make sure we can compile this. 5673dc3d4SNico Weber // RUN: %clang_cl_asan -Od %s -Fe%t 6673dc3d4SNico Weber // 7673dc3d4SNico Weber // note: The mangling decoration (i.e. @4 )is removed because calling convention 8673dc3d4SNico Weber // differ from 32-bit and 64-bit. 9673dc3d4SNico Weber // 10673dc3d4SNico Weber // RUN: dumpbin /EXPORTS %t | sed "s/=.*//" \ 11673dc3d4SNico Weber // RUN: | grep -o "\(__asan_\|__ubsan_\|__sanitizer_\|__sancov_\)[^ ]*" \ 12673dc3d4SNico Weber // RUN: | grep -v "__asan_wrap" \ 13673dc3d4SNico Weber // RUN: | sed -e s/@.*// > %t.exports 14673dc3d4SNico Weber // 15673dc3d4SNico Weber // [BEWARE: be really careful with the sed commands, as this test can be run 16a1e7e401SKazuaki Ishizaki // from different environments with different shells and seds] 17673dc3d4SNico Weber // 18*76d3d078SKirill Stoimenov // RUN: grep -e "^INTERFACE_FUNCTION" \ 19673dc3d4SNico Weber // RUN: %p/../../../../lib/asan/asan_interface.inc \ 20673dc3d4SNico Weber // RUN: %p/../../../../lib/ubsan/ubsan_interface.inc \ 21673dc3d4SNico Weber // RUN: %p/../../../../lib/sanitizer_common/sanitizer_common_interface.inc \ 22673dc3d4SNico Weber // RUN: %p/../../../../lib/sanitizer_common/sanitizer_coverage_interface.inc \ 23673dc3d4SNico Weber // RUN: | sed -e "s/.*(//" -e "s/).*//" > %t.imports1 24673dc3d4SNico Weber // 25*76d3d078SKirill Stoimenov // RUN: grep -e "^INTERFACE_WEAK_FUNCTION" \ 26673dc3d4SNico Weber // RUN: %p/../../../../lib/asan/asan_interface.inc \ 27673dc3d4SNico Weber // RUN: %p/../../../../lib/ubsan/ubsan_interface.inc \ 28673dc3d4SNico Weber // RUN: %p/../../../../lib/sanitizer_common/sanitizer_common_interface.inc \ 29673dc3d4SNico Weber // RUN: %p/../../../../lib/sanitizer_common/sanitizer_coverage_interface.inc \ 30673dc3d4SNico Weber // RUN: | sed -e "s/.*(//" -e "s/).*/__dll/" > %t.imports2 31673dc3d4SNico Weber // 32673dc3d4SNico Weber // Add functions not included in the interface lists: 33673dc3d4SNico Weber // RUN: grep '[I]MPORT:' %s | sed -e 's/.*[I]MPORT: //' > %t.imports3 34673dc3d4SNico Weber // IMPORT: __asan_shadow_memory_dynamic_address 35673dc3d4SNico Weber // IMPORT: __asan_get_shadow_memory_dynamic_address 36673dc3d4SNico Weber // IMPORT: __asan_option_detect_stack_use_after_return 37673dc3d4SNico Weber // IMPORT: __asan_should_detect_stack_use_after_return 38673dc3d4SNico Weber // IMPORT: __asan_set_seh_filter 39673dc3d4SNico Weber // IMPORT: __asan_unhandled_exception_filter 40673dc3d4SNico Weber // IMPORT: __asan_test_only_reported_buggy_pointer 41673dc3d4SNico Weber // IMPORT: __sancov_lowest_stack 42673dc3d4SNico Weber // IMPORT: __ubsan_vptr_type_cache 43673dc3d4SNico Weber // 44673dc3d4SNico Weber // RUN: cat %t.imports1 %t.imports2 %t.imports3 | sort | uniq > %t.imports-sorted 45673dc3d4SNico Weber // RUN: cat %t.exports | sort | uniq > %t.exports-sorted 46673dc3d4SNico Weber // 47673dc3d4SNico Weber // Now make sure the DLL thunk imports everything: 48673dc3d4SNico Weber // RUN: echo 49673dc3d4SNico Weber // RUN: echo "=== NOTE === If you see a mismatch below, please update interface.inc files." 50673dc3d4SNico Weber // RUN: diff %t.imports-sorted %t.exports-sorted 51673dc3d4SNico Weber // REQUIRES: asan-static-runtime 52673dc3d4SNico Weber main()53673dc3d4SNico Weberint main() { return 0; } 54