[compiler-rt] r313551 - [ubsan] Fix interface_symbols_windows test

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 18 11:46:20 PDT 2017


Author: vitalybuka
Date: Mon Sep 18 11:46:19 2017
New Revision: 313551

URL: http://llvm.org/viewvc/llvm-project?rev=313551&view=rev
Log:
[ubsan] Fix interface_symbols_windows test

Summary:
1. Update ubsan_interface.inc to make the test happy.
2. Switch interface_symbols_linux and interface_symbols_darwin to C++ to import __ubsan_handle_dynamic_type_cache_miss
3. Switch interface_symbols_windows to C++ for consistency.

Reviewers: rnk, zturner

Subscribers: llvm-commits, kubamracek

Differential Revision: https://reviews.llvm.org/D37986

Added:
    compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.cc
    compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.cc
    compiler-rt/trunk/test/asan/TestCases/Windows/interface_symbols_windows.cc
Removed:
    compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.c
    compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.c
    compiler-rt/trunk/test/asan/TestCases/Windows/interface_symbols_windows.c
Modified:
    compiler-rt/trunk/lib/ubsan/ubsan_interface.inc

Modified: compiler-rt/trunk/lib/ubsan/ubsan_interface.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_interface.inc?rev=313551&r1=313550&r2=313551&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/ubsan_interface.inc (original)
+++ compiler-rt/trunk/lib/ubsan/ubsan_interface.inc Mon Sep 18 11:46:19 2017
@@ -16,6 +16,8 @@ INTERFACE_FUNCTION(__ubsan_handle_cfi_ch
 INTERFACE_FUNCTION(__ubsan_handle_cfi_check_fail_abort)
 INTERFACE_FUNCTION(__ubsan_handle_divrem_overflow)
 INTERFACE_FUNCTION(__ubsan_handle_divrem_overflow_abort)
+INTERFACE_FUNCTION(__ubsan_handle_dynamic_type_cache_miss)
+INTERFACE_FUNCTION(__ubsan_handle_dynamic_type_cache_miss_abort)
 INTERFACE_FUNCTION(__ubsan_handle_float_cast_overflow)
 INTERFACE_FUNCTION(__ubsan_handle_float_cast_overflow_abort)
 INTERFACE_FUNCTION(__ubsan_handle_function_type_mismatch)

Removed: compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.c?rev=313550&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.c (original)
+++ compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.c (removed)
@@ -1,37 +0,0 @@
-// Check the presence of interface symbols in the ASan runtime dylib.
-// If you're changing this file, please also change
-// ../Linux/interface_symbols.c
-
-// RUN: %clang_asan -dead_strip -O2 %s -o %t.exe
-//
-// note: we can not use -D on Darwin.
-// 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/'` \
-// RUN:  | grep " [TU] "                                                       \
-// RUN:  | grep -o "\(__asan_\|__ubsan_\|__sancov_\|__sanitizer_\)[^ ]*"       \
-// RUN:  | grep -v "__sanitizer_syscall"                                       \
-// RUN:  | grep -v "__sanitizer_weak_hook"                                     \
-// RUN:  | grep -v "__sanitizer_mz"                                            \
-// RUN:  | grep -v "__ubsan_handle_dynamic_type_cache_miss"                    \
-// RUN:  | grep -v "__sancov_lowest_stack"                                     \
-// RUN:  | sed -e "s/__asan_version_mismatch_check_v[0-9]+/__asan_version_mismatch_check/" \
-// RUN:  > %t.exports
-//
-// RUN: grep -e "INTERFACE_\(WEAK_\)\?FUNCTION"                                \
-// RUN:  %p/../../../../lib/asan/asan_interface.inc                            \
-// RUN:  %p/../../../../lib/ubsan/ubsan_interface.inc                          \
-// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_common_interface.inc    \
-// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_common_interface_posix.inc \
-// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_coverage_interface.inc  \
-// RUN:  | grep -v "__sanitizer_weak_hook"                                     \
-// RUN:  | sed -e "s/.*(//" -e "s/).*//" > %t.imports
-//
-// RUN: cat %t.imports | sort | uniq > %t.imports-sorted
-// RUN: cat %t.exports | sort | uniq > %t.exports-sorted
-//
-// RUN: echo
-// RUN: echo "=== NOTE === If you see a mismatch below, please update sanitizer_interface.inc files."
-// RUN: diff %t.imports-sorted %t.exports-sorted
-
-// UNSUPPORTED: ios
-
-int main() { return 0; }

Added: compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.cc?rev=313551&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.cc (added)
+++ compiler-rt/trunk/test/asan/TestCases/Darwin/interface_symbols_darwin.cc Mon Sep 18 11:46:19 2017
@@ -0,0 +1,36 @@
+// Check the presence of interface symbols in the ASan runtime dylib.
+// If you're changing this file, please also change
+// ../Linux/interface_symbols.c
+
+// RUN: %clangxx_asan -dead_strip -O2 %s -o %t.exe
+//
+// note: we can not use -D on Darwin.
+// 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/'` \
+// RUN:  | grep " [TU] "                                                       \
+// RUN:  | grep -o "\(__asan_\|__ubsan_\|__sancov_\|__sanitizer_\)[^ ]*"       \
+// RUN:  | grep -v "__sanitizer_syscall"                                       \
+// RUN:  | grep -v "__sanitizer_weak_hook"                                     \
+// RUN:  | grep -v "__sanitizer_mz"                                            \
+// RUN:  | grep -v "__sancov_lowest_stack"                                     \
+// RUN:  | sed -e "s/__asan_version_mismatch_check_v[0-9]+/__asan_version_mismatch_check/" \
+// RUN:  > %t.exports
+//
+// RUN: grep -e "INTERFACE_\(WEAK_\)\?FUNCTION"                                \
+// RUN:  %p/../../../../lib/asan/asan_interface.inc                            \
+// RUN:  %p/../../../../lib/ubsan/ubsan_interface.inc                          \
+// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_common_interface.inc    \
+// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_common_interface_posix.inc \
+// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_coverage_interface.inc  \
+// RUN:  | grep -v "__sanitizer_weak_hook"                                     \
+// RUN:  | sed -e "s/.*(//" -e "s/).*//" > %t.imports
+//
+// RUN: cat %t.imports | sort | uniq > %t.imports-sorted
+// RUN: cat %t.exports | sort | uniq > %t.exports-sorted
+//
+// RUN: echo
+// RUN: echo "=== NOTE === If you see a mismatch below, please update sanitizer_interface.inc files."
+// RUN: diff %t.imports-sorted %t.exports-sorted
+
+// UNSUPPORTED: ios
+
+int main() { return 0; }

Removed: compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.c?rev=313550&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.c (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.c (removed)
@@ -1,33 +0,0 @@
-// Check the presence of interface symbols in compiled file.
-
-// RUN: %clang_asan -O2 %s -o %t.exe
-// RUN: nm -D %t.exe | grep " [TWw] "                                          \
-// RUN:  | grep -o "\(__asan_\|__ubsan_\|__sancov_\|__sanitizer_\)[^ ]*"       \
-// RUN:  | grep -v "__sanitizer_syscall"                                       \
-// RUN:  | grep -v "__sanitizer_weak_hook"                                     \
-// RUN:  | grep -v "__ubsan_handle_dynamic_type_cache_miss"                    \
-// RUN:  | grep -v "__sancov_lowest_stack"                                     \
-// RUN:  | sed -e "s/__asan_version_mismatch_check_v[0-9]+/__asan_version_mismatch_check/" \
-// RUN:  > %t.exports
-//
-// RUN: grep -e "INTERFACE_\(WEAK_\)\?FUNCTION"                                \
-// RUN:  %p/../../../../lib/asan/asan_interface.inc                            \
-// RUN:  %p/../../../../lib/ubsan/ubsan_interface.inc                          \
-// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_common_interface.inc    \
-// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_common_interface_posix.inc \
-// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_coverage_interface.inc  \
-// RUN:  | grep -v "__sanitizer_weak_hook"                                     \
-// RUN:  | sed -e "s/.*(//" -e "s/).*//" > %t.imports
-//
-// RUN: cat %t.imports | sort | uniq > %t.imports-sorted
-// RUN: cat %t.exports | sort | uniq > %t.exports-sorted
-//
-// RUN: echo
-// RUN: echo "=== NOTE === If you see a mismatch below, please update sanitizer_interface.inc files."
-// RUN: diff %t.imports-sorted %t.exports-sorted
-//
-// FIXME: nm -D on powerpc somewhy shows ASan interface symbols residing
-// in "initialized data section".
-// REQUIRES: x86-target-arch,asan-static-runtime
-
-int main() { return 0; }

Added: compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.cc?rev=313551&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.cc (added)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/interface_symbols_linux.cc Mon Sep 18 11:46:19 2017
@@ -0,0 +1,32 @@
+// Check the presence of interface symbols in compiled file.
+
+// RUN: %clangxx_asan -O2 %s -o %t.exe
+// RUN: nm -D %t.exe | grep " [TWw] "                                          \
+// RUN:  | grep -o "\(__asan_\|__ubsan_\|__sancov_\|__sanitizer_\)[^ ]*"       \
+// RUN:  | grep -v "__sanitizer_syscall"                                       \
+// RUN:  | grep -v "__sanitizer_weak_hook"                                     \
+// RUN:  | grep -v "__sancov_lowest_stack"                                     \
+// RUN:  | sed -e "s/__asan_version_mismatch_check_v[0-9]+/__asan_version_mismatch_check/" \
+// RUN:  > %t.exports
+//
+// RUN: grep -e "INTERFACE_\(WEAK_\)\?FUNCTION"                                \
+// RUN:  %p/../../../../lib/asan/asan_interface.inc                            \
+// RUN:  %p/../../../../lib/ubsan/ubsan_interface.inc                          \
+// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_common_interface.inc    \
+// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_common_interface_posix.inc \
+// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_coverage_interface.inc  \
+// RUN:  | grep -v "__sanitizer_weak_hook"                                     \
+// RUN:  | sed -e "s/.*(//" -e "s/).*//" > %t.imports
+//
+// RUN: cat %t.imports | sort | uniq > %t.imports-sorted
+// RUN: cat %t.exports | sort | uniq > %t.exports-sorted
+//
+// RUN: echo
+// RUN: echo "=== NOTE === If you see a mismatch below, please update sanitizer_interface.inc files."
+// RUN: diff %t.imports-sorted %t.exports-sorted
+//
+// FIXME: nm -D on powerpc somewhy shows ASan interface symbols residing
+// in "initialized data section".
+// REQUIRES: x86-target-arch,asan-static-runtime
+
+int main() { return 0; }

Removed: compiler-rt/trunk/test/asan/TestCases/Windows/interface_symbols_windows.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/interface_symbols_windows.c?rev=313550&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/interface_symbols_windows.c (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/interface_symbols_windows.c (removed)
@@ -1,52 +0,0 @@
-// Check that the interface exported by asan static lib matches the list of
-// functions mentioned in sanitizer_interface.inc.
-//
-// Just make sure we can compile this.
-// RUN: %clang_cl_asan -O0 %s -Fe%t
-//
-// note: The mangling decoration (i.e. @4 )is removed because calling convention
-//       differ from 32-bit and 64-bit.
-//
-// RUN: dumpbin /EXPORTS %t | sed "s/=.*//"                                    \
-// RUN:   | grep -o "\(__asan_\|__ubsan_\|__sanitizer_\|__sancov_\)[^ ]*"      \
-// RUN:   | grep -v "__asan_wrap"                                              \
-// RUN:   | sed -e s/@.*// > %t.exports
-//
-// [BEWARE: be really careful with the sed commands, as this test can be run
-//  from different environemnts with different shells and seds]
-//
-// RUN: grep -e "INTERFACE_FUNCTION"                                           \
-// RUN:  %p/../../../../lib/asan/asan_interface.inc                            \
-// RUN:  %p/../../../../lib/ubsan/ubsan_interface.inc                          \
-// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_common_interface.inc    \
-// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_coverage_interface.inc  \
-// RUN:  | sed -e "s/.*(//" -e "s/).*//" > %t.imports1
-//
-// RUN: grep -e "INTERFACE_WEAK_FUNCTION"                                      \
-// RUN:  %p/../../../../lib/asan/asan_interface.inc                            \
-// RUN:  %p/../../../../lib/ubsan/ubsan_interface.inc                          \
-// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_common_interface.inc    \
-// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_coverage_interface.inc  \
-// RUN:  | sed -e "s/.*(//" -e "s/).*/__dll/" > %t.imports2
-//
-// Add functions not included in the interface lists:
-// RUN: grep '[I]MPORT:' %s | sed -e 's/.*[I]MPORT: //' > %t.imports3
-// IMPORT: __asan_shadow_memory_dynamic_address
-// IMPORT: __asan_get_shadow_memory_dynamic_address
-// IMPORT: __asan_option_detect_stack_use_after_return
-// IMPORT: __asan_should_detect_stack_use_after_return
-// IMPORT: __asan_set_seh_filter
-// IMPORT: __asan_unhandled_exception_filter
-// IMPORT: __asan_test_only_reported_buggy_pointer
-// IMPORT: __sancov_lowest_stack
-//
-// RUN: cat %t.imports1 %t.imports2 %t.imports3 | sort | uniq > %t.imports-sorted
-// RUN: cat %t.exports | sort | uniq > %t.exports-sorted
-//
-// Now make sure the DLL thunk imports everything:
-// RUN: echo
-// RUN: echo "=== NOTE === If you see a mismatch below, please update interface.inc files."
-// RUN: diff %t.imports-sorted %t.exports-sorted
-// REQUIRES: asan-static-runtime
-
-int main() { return 0; }

Added: compiler-rt/trunk/test/asan/TestCases/Windows/interface_symbols_windows.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/interface_symbols_windows.cc?rev=313551&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/interface_symbols_windows.cc (added)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/interface_symbols_windows.cc Mon Sep 18 11:46:19 2017
@@ -0,0 +1,53 @@
+// Check that the interface exported by asan static lib matches the list of
+// functions mentioned in sanitizer_interface.inc.
+//
+// Just make sure we can compile this.
+// RUN: %clang_cl_asan -O0 %s -Fe%t
+//
+// note: The mangling decoration (i.e. @4 )is removed because calling convention
+//       differ from 32-bit and 64-bit.
+//
+// RUN: dumpbin /EXPORTS %t | sed "s/=.*//"                                    \
+// RUN:   | grep -o "\(__asan_\|__ubsan_\|__sanitizer_\|__sancov_\)[^ ]*"      \
+// RUN:   | grep -v "__asan_wrap"                                              \
+// RUN:   | sed -e s/@.*// > %t.exports
+//
+// [BEWARE: be really careful with the sed commands, as this test can be run
+//  from different environemnts with different shells and seds]
+//
+// RUN: grep -e "INTERFACE_FUNCTION"                                           \
+// RUN:  %p/../../../../lib/asan/asan_interface.inc                            \
+// RUN:  %p/../../../../lib/ubsan/ubsan_interface.inc                          \
+// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_common_interface.inc    \
+// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_coverage_interface.inc  \
+// RUN:  | sed -e "s/.*(//" -e "s/).*//" > %t.imports1
+//
+// RUN: grep -e "INTERFACE_WEAK_FUNCTION"                                      \
+// RUN:  %p/../../../../lib/asan/asan_interface.inc                            \
+// RUN:  %p/../../../../lib/ubsan/ubsan_interface.inc                          \
+// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_common_interface.inc    \
+// RUN:  %p/../../../../lib/sanitizer_common/sanitizer_coverage_interface.inc  \
+// RUN:  | sed -e "s/.*(//" -e "s/).*/__dll/" > %t.imports2
+//
+// Add functions not included in the interface lists:
+// RUN: grep '[I]MPORT:' %s | sed -e 's/.*[I]MPORT: //' > %t.imports3
+// IMPORT: __asan_shadow_memory_dynamic_address
+// IMPORT: __asan_get_shadow_memory_dynamic_address
+// IMPORT: __asan_option_detect_stack_use_after_return
+// IMPORT: __asan_should_detect_stack_use_after_return
+// IMPORT: __asan_set_seh_filter
+// IMPORT: __asan_unhandled_exception_filter
+// IMPORT: __asan_test_only_reported_buggy_pointer
+// IMPORT: __sancov_lowest_stack
+// IMPORT: __ubsan_vptr_type_cache
+//
+// RUN: cat %t.imports1 %t.imports2 %t.imports3 | sort | uniq > %t.imports-sorted
+// RUN: cat %t.exports | sort | uniq > %t.exports-sorted
+//
+// Now make sure the DLL thunk imports everything:
+// RUN: echo
+// RUN: echo "=== NOTE === If you see a mismatch below, please update interface.inc files."
+// RUN: diff %t.imports-sorted %t.exports-sorted
+// REQUIRES: asan-static-runtime
+
+int main() { return 0; }




More information about the llvm-commits mailing list