1 // Check the presence of interface symbols in compiled file.
2 
3 // RUN: %clangxx_asan -O2 %s -o %t.exe
4 // RUN: nm -D %t.exe | grep " [TWw] "                                          \
5 // RUN:  | grep -o "\(__asan_\|__ubsan_\|__sancov_\|__sanitizer_\)[^ ]*"       \
6 // RUN:  | grep -v "__sanitizer_syscall"                                       \
7 // RUN:  | grep -v "__sanitizer_weak_hook"                                     \
8 // RUN:  | grep -v "__sancov_lowest_stack"                                     \
9 // RUN:  | sed -e "s/__asan_version_mismatch_check_v[0-9]+/__asan_version_mismatch_check/" \
10 // RUN:  > %t.exports
11 //
12 // RUN: grep -e "INTERFACE_\(WEAK_\)\?FUNCTION"                                \
13 // RUN:  %p/../../../../lib/asan/asan_interface.inc                            \
14 // RUN:  %p/../../../../lib/ubsan/ubsan_interface.inc                          \
15 // RUN:  %p/../../../../lib/sanitizer_common/sanitizer_common_interface.inc    \
16 // RUN:  %p/../../../../lib/sanitizer_common/sanitizer_common_interface_posix.inc \
17 // RUN:  %p/../../../../lib/sanitizer_common/sanitizer_coverage_interface.inc  \
18 // RUN:  | grep -v "__sanitizer_weak_hook"                                     \
19 // RUN:  | sed -e "s/.*(//" -e "s/).*//" > %t.imports
20 //
21 // RUN: cat %t.imports | sort | uniq > %t.imports-sorted
22 // RUN: cat %t.exports | sort | uniq > %t.exports-sorted
23 //
24 // RUN: echo
25 // RUN: echo "=== NOTE === If you see a mismatch below, please update sanitizer_interface.inc files."
26 // RUN: diff %t.imports-sorted %t.exports-sorted
27 //
28 // FIXME: nm -D on powerpc somewhy shows ASan interface symbols residing
29 // in "initialized data section".
30 // REQUIRES: x86-target-arch,asan-static-runtime
31 
32 int main() { return 0; }
33