1// Check the presence of interface symbols in compiled file.
2// If you're changing this file, please also change
3// ../Darwin/interface_symbols_darwin.cpp
4
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.inc
7// RUN: %clangxx_asan -O2 %s -o %t.exe
8// 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.exports
15//
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: | sed -e "s/.*(//" -e "s/).*//" > %t.imports
25//
26// RUN: cat %t.imports | sort | uniq > %t.imports-sorted
27// RUN: cat %t.exports | sort | uniq > %t.exports-sorted
28//
29// RUN: echo
30// RUN: echo "=== NOTE === If you see a mismatch below, please update sanitizer_interface.inc files."
31// RUN: diff %t.imports-sorted %t.exports-sorted
32//
33// FIXME: nm -D on powerpc somewhy shows ASan interface symbols residing
34// in "initialized data section".
35// REQUIRES: x86-target-arch,asan-static-runtime
36
37int main() { return 0; }
38

source code of compiler-rt/test/asan/TestCases/Linux/interface_symbols_linux.cpp