43 lines · cpp
1// Check the presence of interface symbols in compiled file.2// If you're changing this file, please also change3// ../Darwin/interface_symbols_darwin.cpp4 5// RUN: %clangxx -x c++-header -o - -E %p/../../../../lib/asan/asan_interface.inc \6// RUN: | sed "s/INTERFACE_FUNCTION/\nINTERFACE_FUNCTION/g" > %t.asan_interface.inc7// RUN: %clangxx_asan -O2 %s -o %t.exe8// RUN: nm -D %t.exe | grep " [TWw] " \9// RUN: | grep -o "\(__asan_\|__ubsan_\|__sancov_\|__sanitizer_\)[^ ]*" \10// RUN: | grep -v "__sanitizer_syscall" \11// RUN: | grep -v "__sanitizer_weak_hook" \12// RUN: | grep -v "__sancov_lowest_stack" \13// RUN: | sed -e "s/__asan_version_mismatch_check_v[0-9]+/__asan_version_mismatch_check/" \14// RUN: > %t.exports15//16// RUN: sed ':a;N;$!ba;s/([\n ]*/(/g' \17// RUN: %t.asan_interface.inc \18// RUN: %p/../../../../lib/ubsan/ubsan_interface.inc \19// RUN: %p/../../../../lib/sanitizer_common/sanitizer_common_interface.inc \20// RUN: %p/../../../../lib/sanitizer_common/sanitizer_common_interface_posix.inc \21// RUN: %p/../../../../lib/sanitizer_common/sanitizer_coverage_interface.inc \22// RUN: | grep -e "INTERFACE_\(WEAK_\)\?FUNCTION" \23// RUN: | grep -v "__sanitizer_weak_hook" \24// RUN: | grep -v "__sanitizer_override_function" \25// RUN: | grep -v "__sanitizer_override_function_by_addr" \26// RUN: | grep -v "__ubsan_handle_dynamic_type_cache_miss" \27// RUN: | grep -v "__ubsan_handle_dynamic_type_cache_miss_abort" \28// RUN: | grep -v "__sanitizer_register_weak_function" \29// RUN: | sed -e "s/.*(//" -e "s/).*//" > %t.imports30//31// RUN: cat %t.imports | sort | uniq > %t.imports-sorted32// RUN: cat %t.exports | sort | uniq > %t.exports-sorted33//34// RUN: echo35// RUN: echo "=== NOTE === If you see a mismatch below, please update sanitizer_interface.inc files."36// RUN: diff %t.imports-sorted %t.exports-sorted37//38// FIXME: nm -D on powerpc somewhy shows ASan interface symbols residing39// in "initialized data section".40// REQUIRES: x86-target-arch,asan-static-runtime41 42int main() { return 0; }43