| 1 | // Check the presence of interface symbols in the ASan runtime dylib. |
| 2 | // If you're changing this file, please also change |
| 3 | // ../Linux/interface_symbols.c |
| 4 | |
| 5 | // This is needed to run the preprocessor to exclude symbols guarded by platform |
| 6 | // RUN: %clangxx -x c++-header -o - -E %p/../../../../lib/asan/asan_interface.inc \ |
| 7 | // RUN: | sed "s/INTERFACE_FUNCTION/\nINTERFACE_FUNCTION/g" > %t.asan_interface.inc |
| 8 | |
| 9 | // RUN: %clangxx_asan -dead_strip -O2 %s -o %t.exe |
| 10 | // |
| 11 | // note: we can not use -D on Darwin. |
| 12 | // RUN: nm -g `%clang_asan %s -fsanitize=address -### 2>&1 | grep "libclang_rt.asan_osx_dynamic.dylib" | sed -e 's/.*"\(.*libclang_rt.asan_osx_dynamic.dylib\)".*/\1/'` \ |
| 13 | // RUN: | grep " [TU] " \ |
| 14 | // RUN: | grep -o "\(__asan_\|__ubsan_\|__sancov_\|__sanitizer_\)[^ ]*" \ |
| 15 | // RUN: | grep -v "__sanitizer_syscall" \ |
| 16 | // RUN: | grep -v "__sanitizer_weak_hook" \ |
| 17 | // RUN: | grep -v "__sanitizer_mz" \ |
| 18 | // RUN: | grep -v "__sancov_lowest_stack" \ |
| 19 | // RUN: | sed -e "s/__asan_version_mismatch_check_v[0-9]+/__asan_version_mismatch_check/" \ |
| 20 | // RUN: > %t.exports |
| 21 | // |
| 22 | // note: SED differs between GNU and BSD in handling semicolon and the use of |
| 23 | // '\n' in regex patterns. For macOS we must change this GNU syntax: |
| 24 | // sed -e ':a' -e 'N' -e '$!ba' |
| 25 | // to a form that both GNU and BSD can agree upon (below). |
| 26 | // |
| 27 | // RUN: sed -e ':a' -e 'N' -e '$!ba' \ |
| 28 | // RUN: -e 's/ //g' \ |
| 29 | // RUN: -e ':b' -e 's/\n\n/\n/g' -e 'tb' \ |
| 30 | // RUN: -e 's/(\n/(/g' \ |
| 31 | // RUN: %t.asan_interface.inc \ |
| 32 | // RUN: %p/../../../../lib/ubsan/ubsan_interface.inc \ |
| 33 | // RUN: %p/../../../../lib/sanitizer_common/sanitizer_common_interface.inc \ |
| 34 | // RUN: %p/../../../../lib/sanitizer_common/sanitizer_common_interface_posix.inc \ |
| 35 | // RUN: %p/../../../../lib/sanitizer_common/sanitizer_coverage_interface.inc \ |
| 36 | // RUN: | grep -e "INTERFACE_\(WEAK_\)\?FUNCTION" \ |
| 37 | // RUN: | grep -v "__sanitizer_weak_hook" \ |
| 38 | // RUN: | grep -v "__sanitizer_override_function" \ |
| 39 | // RUN: | grep -v "__sanitizer_override_function_by_addr" \ |
| 40 | // RUN: | grep -v "__sanitizer_register_weak_function" \ |
| 41 | // RUN: | sed -e "s/.*(//" -e "s/).*//" > %t.imports |
| 42 | // |
| 43 | // RUN: cat %t.imports | sort | uniq > %t.imports-sorted |
| 44 | // RUN: cat %t.exports | sort | uniq > %t.exports-sorted |
| 45 | // |
| 46 | // RUN: echo |
| 47 | // RUN: echo "=== NOTE === If you see a mismatch below, please update sanitizer_interface.inc files." |
| 48 | // RUN: diff %t.imports-sorted %t.exports-sorted |
| 49 | |
| 50 | // UNSUPPORTED: ios |
| 51 | |
| 52 | int main() { return 0; } |
| 53 | |