diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2013-10-25 23:03:34 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2013-10-25 23:03:34 +0000 |
commit | 7e8db745c56f7f9317f0d3472bf01bd48ca3424b (patch) | |
tree | 912fcd40f44d646e0f81ab9ff63231dea1afe0b9 | |
parent | c1a1ed62228288155459d39194995a36aca4a8a6 (diff) | |
download | compiler-rt-7e8db745c56f7f9317f0d3472bf01bd48ca3424b.tar.gz compiler-rt-7e8db745c56f7f9317f0d3472bf01bd48ca3424b.tar.bz2 compiler-rt-7e8db745c56f7f9317f0d3472bf01bd48ca3424b.tar.xz |
Add a CMake option COMPILER_RT_DEBUG for building runtimes with full debug info.
Differential Revision: http://llvm-reviews.chandlerc.com/D1984
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193449 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | CMakeLists.txt | 11 | ||||
-rw-r--r-- | cmake/Modules/CompilerRTUtils.cmake | 10 | ||||
-rw-r--r-- | lib/asan/lit_tests/TestCases/Linux/malloc-in-qsort.cc | 2 | ||||
-rw-r--r-- | lib/asan/lit_tests/TestCases/memcmp_test.cc | 2 | ||||
-rw-r--r-- | lib/asan/lit_tests/TestCases/strncpy-overflow.cc | 2 | ||||
-rw-r--r-- | lib/lit.common.cfg | 4 | ||||
-rw-r--r-- | lib/lit.common.configured.in | 1 |
7 files changed, 30 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 123b60ea..2d968beb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,6 +124,11 @@ function(filter_available_targets out_var) set(${out_var} ${archs} PARENT_SCOPE) endfunction() +option(COMPILER_RT_DEBUG "Build runtimes with full debug info" OFF) + +# COMPILER_RT_DEBUG_PYBOOL is used by lit.common.configured.in. +pythonize_bool(COMPILER_RT_DEBUG) + # Provide some common commmandline flags for Sanitizer runtimes. if (NOT MSVC) set(SANITIZER_COMMON_CFLAGS @@ -134,9 +139,11 @@ if (NOT MSVC) -funwind-tables -fno-stack-protector -Wno-gnu # Variadic macros with 0 arguments for ... - -O3 -fvisibility=hidden ) + if (NOT COMPILER_RT_DEBUG) + list(APPEND SANITIZER_COMMON_CFLAGS -O3) + endif() else() set(SANITIZER_COMMON_CFLAGS /MT @@ -149,7 +156,7 @@ endif() # Build sanitizer runtimes with debug info. (MSVC gets /Zi above) if (NOT MSVC) check_cxx_compiler_flag(-gline-tables-only SUPPORTS_GLINE_TABLES_ONLY_FLAG) - if(SUPPORTS_GLINE_TABLES_ONLY_FLAG) + if(SUPPORTS_GLINE_TABLES_ONLY_FLAG AND NOT COMPILER_RT_DEBUG) list(APPEND SANITIZER_COMMON_CFLAGS -gline-tables-only) else() list(APPEND SANITIZER_COMMON_CFLAGS -g) diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake index f9760f40..fce37e3e 100644 --- a/cmake/Modules/CompilerRTUtils.cmake +++ b/cmake/Modules/CompilerRTUtils.cmake @@ -26,3 +26,13 @@ function(find_flag_in_string flag_string flag out_var) set(${out_var} FALSE PARENT_SCOPE) endif() endfunction() + +# Set the variable var_PYBOOL to True if var holds a true-ish string, +# otherwise set it to False. +macro(pythonize_bool var) + if (${var}) + set(${var}_PYBOOL True) + else() + set(${var}_PYBOOL False) + endif() +endmacro() diff --git a/lib/asan/lit_tests/TestCases/Linux/malloc-in-qsort.cc b/lib/asan/lit_tests/TestCases/Linux/malloc-in-qsort.cc index 73d2bc1e..3251b35e 100644 --- a/lib/asan/lit_tests/TestCases/Linux/malloc-in-qsort.cc +++ b/lib/asan/lit_tests/TestCases/Linux/malloc-in-qsort.cc @@ -9,6 +9,8 @@ // Fast unwinder is only avaliable on x86_64 and i386. // REQUIRES: x86_64-supported-target +// REQUIRES: compiler-rt-optimized + #include <stdlib.h> #include <stdio.h> diff --git a/lib/asan/lit_tests/TestCases/memcmp_test.cc b/lib/asan/lit_tests/TestCases/memcmp_test.cc index 32067a9e..758311dd 100644 --- a/lib/asan/lit_tests/TestCases/memcmp_test.cc +++ b/lib/asan/lit_tests/TestCases/memcmp_test.cc @@ -3,6 +3,8 @@ // RUN: %clangxx_asan -O2 %s -o %t && not %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O3 %s -o %t && not %t 2>&1 | FileCheck %s +// REQUIRES: compiler-rt-optimized + #include <string.h> int main(int argc, char **argv) { char a1[] = {argc, 2, 3, 4}; diff --git a/lib/asan/lit_tests/TestCases/strncpy-overflow.cc b/lib/asan/lit_tests/TestCases/strncpy-overflow.cc index 2b5f5b7c..5b89dadd 100644 --- a/lib/asan/lit_tests/TestCases/strncpy-overflow.cc +++ b/lib/asan/lit_tests/TestCases/strncpy-overflow.cc @@ -7,6 +7,8 @@ // RUN: %clangxx_asan -O3 %s -o %t && not %t 2>%t.out // RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out +// REQUIRES: compiler-rt-optimized + #include <string.h> #include <stdlib.h> int main(int argc, char **argv) { diff --git a/lib/lit.common.cfg b/lib/lit.common.cfg index 4be69215..6c2b4cca 100644 --- a/lib/lit.common.cfg +++ b/lib/lit.common.cfg @@ -56,3 +56,7 @@ compiler_rt_arch = getattr(config, 'compiler_rt_arch', None) if compiler_rt_arch: for arch in compiler_rt_arch.split(";"): config.available_features.add(arch + "-supported-target") + +compiler_rt_debug = getattr(config, 'compiler_rt_debug', False) +if not compiler_rt_debug: + config.available_features.add('compiler-rt-optimized') diff --git a/lib/lit.common.configured.in b/lib/lit.common.configured.in index a1d2002e..558655cb 100644 --- a/lib/lit.common.configured.in +++ b/lib/lit.common.configured.in @@ -13,6 +13,7 @@ config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" config.clang = "@LLVM_BINARY_DIR@/bin/clang" config.compiler_rt_arch = "@COMPILER_RT_SUPPORTED_ARCH@" config.python_executable = "@PYTHON_EXECUTABLE@" +config.compiler_rt_debug = @COMPILER_RT_DEBUG_PYBOOL@ # LLVM tools dir can be passed in lit parameters, so try to # apply substitution. |