brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · ddf9388 Raw
57 lines · cpp
1// Check the presence of interface symbols in the ASan runtime dylib.2// If you're changing this file, please also change3// ../Linux/interface_symbols.c4 5// This is needed to run the preprocessor to exclude symbols guarded by platform6// 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.inc8 9// RUN: %clangxx_asan -dead_strip -O2 %s -o %t.exe10//11// note: we can not use -D on Darwin.12// RUN: %clang_asan %s -fsanitize=address -### 2>&1                       \13// RUN:   | grep "libclang_rt.asan_osx_dynamic.dylib"                     \14// RUN:   | sed -e 's/.*"\(.*libclang_rt.asan_osx_dynamic.dylib\)".*/\1/' \15// RUN:   | tr -d '\n' > %t.compiler_runtime_path16// RUN: nm -g %{readfile:%t.compiler_runtime_path}                                         \17// RUN:  | grep " [TU] "                                                                   \18// RUN:  | grep -o "\(__asan_\|__ubsan_\|__sancov_\|__sanitizer_\)[^ ]*"                   \19// RUN:  | grep -v "__sanitizer_syscall"                                                   \20// RUN:  | grep -v "__sanitizer_weak_hook"                                                 \21// RUN:  | grep -v "__sanitizer_mz"                                                        \22// RUN:  | grep -v "__sancov_lowest_stack"                                                 \23// RUN:  | sed -e "s/__asan_version_mismatch_check_v[0-9]+/__asan_version_mismatch_check/" \24// RUN:  > %t.exports25//26// note: SED differs between GNU and BSD in handling semicolon and the use of27//       '\n' in regex patterns. For macOS we must change this GNU syntax:28//           sed -e ':a' -e 'N' -e '$!ba'29//       to a form that both GNU and BSD can agree upon (below).30//31// RUN:  sed -e ':a' -e 'N' -e '$!ba'                                             \32// RUN:      -e 's/ //g'                                                          \33// RUN:      -e ':b' -e 's/\n\n/\n/g' -e 'tb'                                     \34// RUN:      -e 's/(\n/(/g'                                                       \35// RUN:  %t.asan_interface.inc                                                    \36// RUN:  %p/../../../../lib/ubsan/ubsan_interface.inc                             \37// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_common_interface.inc       \38// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_common_interface_posix.inc \39// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_coverage_interface.inc     \40// RUN:  | grep -e "INTERFACE_\(WEAK_\)\?FUNCTION"                                \41// RUN:  | grep -v "__sanitizer_weak_hook"                                        \42// RUN:  | grep -v "__sanitizer_override_function"                                \43// RUN:  | grep -v "__sanitizer_override_function_by_addr"                        \44// RUN:  | grep -v "__sanitizer_register_weak_function"                           \45// RUN:  | sed -e "s/.*(//" -e "s/).*//" > %t.imports46//47// RUN: cat %t.imports | sort | uniq > %t.imports-sorted48// RUN: cat %t.exports | sort | uniq > %t.exports-sorted49//50// RUN: echo51// RUN: echo "=== NOTE === If you see a mismatch below, please update sanitizer_interface.inc files."52// RUN: diff %t.imports-sorted %t.exports-sorted53 54// UNSUPPORTED: ios55 56int main() { return 0; }57