diff --git a/compiler-rt/lib/asan/lit_tests/CMakeLists.txt b/compiler-rt/lib/asan/lit_tests/CMakeLists.txt index c230ff52c490..afe76a98d7b2 100644 --- a/compiler-rt/lib/asan/lit_tests/CMakeLists.txt +++ b/compiler-rt/lib/asan/lit_tests/CMakeLists.txt @@ -15,12 +15,9 @@ if("${CMAKE_HOST_SYSTEM}" STREQUAL "${CMAKE_SYSTEM}") # Run ASan output tests only if we're not cross-compiling, # and can be sure that clang would produce working binaries. set(ASAN_TEST_DEPS - clang clang-headers FileCheck count not llvm-nm + clang clang-headers FileCheck count not llvm-nm llvm-symbolizer ${ASAN_RUNTIME_LIBRARIES} ) - if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") - list(APPEND ASAN_TEST_DEPS llvm-symbolizer) - endif() set(ASAN_TEST_PARAMS asan_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg ) diff --git a/compiler-rt/lib/asan/lit_tests/global-overflow.cc b/compiler-rt/lib/asan/lit_tests/global-overflow.cc index 9a0cd1d4338a..fec3ce8340e3 100644 --- a/compiler-rt/lib/asan/lit_tests/global-overflow.cc +++ b/compiler-rt/lib/asan/lit_tests/global-overflow.cc @@ -17,7 +17,7 @@ int main(int argc, char **argv) { memset(ZZZ, 0, 10); int res = YYY[argc * 10]; // BOOOM // CHECK: {{READ of size 1 at 0x.* thread T0}} - // CHECK: {{ #0 0x.* in main .*global-overflow.cc:18}} + // CHECK: {{ #0 0x.* in _?main .*global-overflow.cc:18}} // CHECK: {{0x.* is located 0 bytes to the right of global variable}} // CHECK: {{.*YYY.* of size 10}} res += XXX[argc] + ZZZ[argc]; diff --git a/compiler-rt/lib/asan/lit_tests/heap-overflow.cc b/compiler-rt/lib/asan/lit_tests/heap-overflow.cc index 345d0b994c5a..2cd6d03eea22 100644 --- a/compiler-rt/lib/asan/lit_tests/heap-overflow.cc +++ b/compiler-rt/lib/asan/lit_tests/heap-overflow.cc @@ -22,7 +22,7 @@ int main(int argc, char **argv) { memset(x, 0, 10); int res = x[argc * 10]; // BOOOM // CHECK: {{READ of size 1 at 0x.* thread T0}} - // CHECK: {{ #0 0x.* in main .*heap-overflow.cc:23}} + // CHECK: {{ #0 0x.* in _?main .*heap-overflow.cc:23}} // CHECK: {{0x.* is located 0 bytes to the right of 10-byte region}} // CHECK: {{allocated by thread T0 here:}} @@ -32,7 +32,7 @@ int main(int argc, char **argv) { // CHECK-Darwin: {{ #0 0x.* in .*mz_malloc.*}} // CHECK-Darwin: {{ #1 0x.* in malloc_zone_malloc.*}} // CHECK-Darwin: {{ #2 0x.* in malloc.*}} - // CHECK-Darwin: {{ #3 0x.* in main heap-overflow.cc:21}} + // CHECK-Darwin: {{ #3 0x.* in _?main .*heap-overflow.cc:21}} free(x); return res; } diff --git a/compiler-rt/lib/asan/lit_tests/large_func_test.cc b/compiler-rt/lib/asan/lit_tests/large_func_test.cc index a1119e90c47b..d54ad767e63b 100644 --- a/compiler-rt/lib/asan/lit_tests/large_func_test.cc +++ b/compiler-rt/lib/asan/lit_tests/large_func_test.cc @@ -58,8 +58,8 @@ int main(int argc, char **argv) { // CHECK-Linux: {{ #0 0x.* in LargeFunction.*large_func_test.cc:32}} // CHECK-Darwin: {{ #0 0x.* in .*LargeFunction.*large_func_test.cc:32}} -// CHECK: {{ #1 0x.* in main .*large_func_test.cc:48}} +// CHECK: {{ #1 0x.* in _?main .*large_func_test.cc:48}} // CHECK: {{0x.* is located 44 bytes to the right of 400-byte region}} // CHECK: {{allocated by thread T0 here:}} // CHECK: {{ #0 0x.* in operator new.*}} -// CHECK: {{ #1 0x.* in main .*large_func_test.cc:47}} +// CHECK: {{ #1 0x.* in _?main .*large_func_test.cc:47}} diff --git a/compiler-rt/lib/asan/lit_tests/lit.cfg b/compiler-rt/lib/asan/lit_tests/lit.cfg index 0ab424e049fd..96a8f148869d 100644 --- a/compiler-rt/lib/asan/lit_tests/lit.cfg +++ b/compiler-rt/lib/asan/lit_tests/lit.cfg @@ -69,13 +69,11 @@ config.substitutions.append( ("%clangxx_asan ", (" " + config.clang + " " + clang_asan_cxxflags + " ")) ) # Setup path to external LLVM symbolizer to run AddressSanitizer output tests. -# Currently llvm-symbolizer is supported on Linux only. -if config.host_os == 'Linux': - llvm_obj_root = getattr(config, 'llvm_obj_root', None) - if llvm_obj_root: - config.environment['LLVM_SYMBOLIZER_PATH'] = os.path.join( - config.llvm_obj_root, "projects", "compiler-rt", "utils", - "llvm-symbolizer", "llvm-symbolizer") +llvm_obj_root = getattr(config, 'llvm_obj_root', None) +if llvm_obj_root: + config.environment['LLVM_SYMBOLIZER_PATH'] = os.path.join( + config.llvm_obj_root, "projects", "compiler-rt", "utils", + "llvm-symbolizer", "llvm-symbolizer") # Setup path to symbolizer script. # FIXME: Instead we should copy this script to the build tree and point diff --git a/compiler-rt/lib/asan/lit_tests/null_deref.cc b/compiler-rt/lib/asan/lit_tests/null_deref.cc index 259e6ec62c00..7ebf71ab1886 100644 --- a/compiler-rt/lib/asan/lit_tests/null_deref.cc +++ b/compiler-rt/lib/asan/lit_tests/null_deref.cc @@ -31,4 +31,4 @@ int main() { // CHECK-Linux: {{ #0 0x.* in NullDeref.*null_deref.cc:20}} // CHECK-Darwin: {{ #0 0x.* in .*NullDeref.*null_deref.cc:20}} -// CHECK: {{ #1 0x.* in main.*null_deref.cc:23}} +// CHECK: {{ #1 0x.* in _?main.*null_deref.cc:23}} diff --git a/compiler-rt/lib/asan/lit_tests/shared-lib-test.cc b/compiler-rt/lib/asan/lit_tests/shared-lib-test.cc index f77e1375e256..28a4e63c70f0 100644 --- a/compiler-rt/lib/asan/lit_tests/shared-lib-test.cc +++ b/compiler-rt/lib/asan/lit_tests/shared-lib-test.cc @@ -49,6 +49,6 @@ int main(int argc, char *argv[]) { // CHECK: {{.*ERROR: AddressSanitizer global-buffer-overflow}} // CHECK: {{READ of size 4 at 0x.* thread T0}} // CHECK: {{ #0 0x.*}} - // CHECK: {{ #1 0x.* in main .*shared-lib-test.cc:48}} + // CHECK: {{ #1 0x.* in _?main .*shared-lib-test.cc:48}} return 0; } diff --git a/compiler-rt/lib/asan/lit_tests/stack-overflow.cc b/compiler-rt/lib/asan/lit_tests/stack-overflow.cc index 2c64ec6635d6..0caa7df3bf51 100644 --- a/compiler-rt/lib/asan/lit_tests/stack-overflow.cc +++ b/compiler-rt/lib/asan/lit_tests/stack-overflow.cc @@ -13,7 +13,7 @@ int main(int argc, char **argv) { memset(x, 0, 10); int res = x[argc * 10]; // BOOOM // CHECK: {{READ of size 1 at 0x.* thread T0}} - // CHECK: {{ #0 0x.* in main .*stack-overflow.cc:14}} + // CHECK: {{ #0 0x.* in _?main .*stack-overflow.cc:14}} // CHECK: {{Address 0x.* is .* frame
}} return res; } diff --git a/compiler-rt/lib/asan/lit_tests/strncpy-overflow.cc b/compiler-rt/lib/asan/lit_tests/strncpy-overflow.cc index a0dd8c1821d5..d3c66daa7a53 100644 --- a/compiler-rt/lib/asan/lit_tests/strncpy-overflow.cc +++ b/compiler-rt/lib/asan/lit_tests/strncpy-overflow.cc @@ -25,7 +25,7 @@ int main(int argc, char **argv) { // CHECK: {{WRITE of size 1 at 0x.* thread T0}} // CHECK-Linux: {{ #0 0x.* in .*strncpy}} // CHECK-Darwin: {{ #0 0x.* in wrap_strncpy}} - // CHECK: {{ #1 0x.* in main .*strncpy-overflow.cc:24}} + // CHECK: {{ #1 0x.* in _?main .*strncpy-overflow.cc:24}} // CHECK: {{0x.* is located 0 bytes to the right of 9-byte region}} // CHECK: {{allocated by thread T0 here:}} @@ -35,6 +35,6 @@ int main(int argc, char **argv) { // CHECK-Darwin: {{ #0 0x.* in .*mz_malloc.*}} // CHECK-Darwin: {{ #1 0x.* in malloc_zone_malloc.*}} // CHECK-Darwin: {{ #2 0x.* in malloc.*}} - // CHECK-Darwin: {{ #3 0x.* in main .*strncpy-overflow.cc:23}} + // CHECK-Darwin: {{ #3 0x.* in _?main .*strncpy-overflow.cc:23}} return short_buffer[8]; } diff --git a/compiler-rt/lib/asan/lit_tests/use-after-free.cc b/compiler-rt/lib/asan/lit_tests/use-after-free.cc index 9d8e8ac384e6..841d7d3af305 100644 --- a/compiler-rt/lib/asan/lit_tests/use-after-free.cc +++ b/compiler-rt/lib/asan/lit_tests/use-after-free.cc @@ -23,7 +23,7 @@ int main() { // CHECK: {{.*ERROR: AddressSanitizer heap-use-after-free on address}} // CHECK: {{0x.* at pc 0x.* bp 0x.* sp 0x.*}} // CHECK: {{READ of size 1 at 0x.* thread T0}} - // CHECK: {{ #0 0x.* in main .*use-after-free.cc:22}} + // CHECK: {{ #0 0x.* in _?main .*use-after-free.cc:22}} // CHECK: {{0x.* is located 5 bytes inside of 10-byte region .0x.*,0x.*}} // CHECK: {{freed by thread T0 here:}} @@ -33,7 +33,7 @@ int main() { // CHECK-Darwin: {{ #0 0x.* in .*mz_free.*}} // We override free() on Darwin, thus no malloc_zone_free // CHECK-Darwin: {{ #1 0x.* in wrap_free}} - // CHECK-Darwin: {{ #2 0x.* in main .*use-after-free.cc:21}} + // CHECK-Darwin: {{ #2 0x.* in _?main .*use-after-free.cc:21}} // CHECK: {{previously allocated by thread T0 here:}} @@ -43,5 +43,5 @@ int main() { // CHECK-Darwin: {{ #0 0x.* in .*mz_malloc.*}} // CHECK-Darwin: {{ #1 0x.* in malloc_zone_malloc.*}} // CHECK-Darwin: {{ #2 0x.* in malloc.*}} - // CHECK-Darwin: {{ #3 0x.* in main .*use-after-free.cc:20}} + // CHECK-Darwin: {{ #3 0x.* in _?main .*use-after-free.cc:20}} } diff --git a/compiler-rt/lib/asan/scripts/asan_symbolize.py b/compiler-rt/lib/asan/scripts/asan_symbolize.py index 789104195714..7b30bb55914e 100755 --- a/compiler-rt/lib/asan/scripts/asan_symbolize.py +++ b/compiler-rt/lib/asan/scripts/asan_symbolize.py @@ -97,13 +97,11 @@ class LLVMSymbolizer(Symbolizer): def LLVMSymbolizerFactory(system): - if system == 'Linux': - symbolizer_path = os.getenv('LLVM_SYMBOLIZER_PATH') - if not symbolizer_path: - # Assume llvm-symbolizer is in PATH. - symbolizer_path = 'llvm-symbolizer' - return LLVMSymbolizer(symbolizer_path) - return None + symbolizer_path = os.getenv('LLVM_SYMBOLIZER_PATH') + if not symbolizer_path: + # Assume llvm-symbolizer is in PATH. + symbolizer_path = 'llvm-symbolizer' + return LLVMSymbolizer(symbolizer_path) class Addr2LineSymbolizer(Symbolizer):