From 2d9899b2cee703d102dcaa79887e46692f15162d Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Fri, 28 Sep 2012 11:05:41 +0000 Subject: [PATCH] [ASan] use llvm-symbolizer (in offline mode) in ASan output tests on Linux llvm-svn: 164819 --- compiler-rt/lib/asan/lit_tests/CMakeLists.txt | 3 +++ compiler-rt/lib/asan/lit_tests/lit.cfg | 9 +++++++++ compiler-rt/lib/asan/lit_tests/lit.site.cfg.in | 1 + 3 files changed, 13 insertions(+) diff --git a/compiler-rt/lib/asan/lit_tests/CMakeLists.txt b/compiler-rt/lib/asan/lit_tests/CMakeLists.txt index e08a84a..c230ff5 100644 --- a/compiler-rt/lib/asan/lit_tests/CMakeLists.txt +++ b/compiler-rt/lib/asan/lit_tests/CMakeLists.txt @@ -18,6 +18,9 @@ if("${CMAKE_HOST_SYSTEM}" STREQUAL "${CMAKE_SYSTEM}") clang clang-headers FileCheck count not llvm-nm ${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/lit.cfg b/compiler-rt/lib/asan/lit_tests/lit.cfg index 54ad92e..0ab424e 100644 --- a/compiler-rt/lib/asan/lit_tests/lit.cfg +++ b/compiler-rt/lib/asan/lit_tests/lit.cfg @@ -68,6 +68,15 @@ clang_asan_cxxflags = ("-ccc-clang-cxx " 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") + # Setup path to symbolizer script. # FIXME: Instead we should copy this script to the build tree and point # at it there. diff --git a/compiler-rt/lib/asan/lit_tests/lit.site.cfg.in b/compiler-rt/lib/asan/lit_tests/lit.site.cfg.in index 89956e6..cf43930 100644 --- a/compiler-rt/lib/asan/lit_tests/lit.site.cfg.in +++ b/compiler-rt/lib/asan/lit_tests/lit.site.cfg.in @@ -4,6 +4,7 @@ config.target_triple = "@TARGET_TRIPLE@" config.host_os = "@HOST_OS@" config.llvm_src_root = "@LLVM_SOURCE_DIR@" +config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" config.clang = "@LLVM_BINARY_DIR@/bin/clang" -- 2.7.4