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