[compiler-rt] r193449 - Add a CMake option COMPILER_RT_DEBUG for building runtimes with full debug info.

Peter Collingbourne peter at pcc.me.uk
Fri Oct 25 16:03:35 PDT 2013


Author: pcc
Date: Fri Oct 25 18:03:34 2013
New Revision: 193449

URL: http://llvm.org/viewvc/llvm-project?rev=193449&view=rev
Log:
Add a CMake option COMPILER_RT_DEBUG for building runtimes with full debug info.

Differential Revision: http://llvm-reviews.chandlerc.com/D1984

Modified:
    compiler-rt/trunk/CMakeLists.txt
    compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake
    compiler-rt/trunk/lib/asan/lit_tests/TestCases/Linux/malloc-in-qsort.cc
    compiler-rt/trunk/lib/asan/lit_tests/TestCases/memcmp_test.cc
    compiler-rt/trunk/lib/asan/lit_tests/TestCases/strncpy-overflow.cc
    compiler-rt/trunk/lib/lit.common.cfg
    compiler-rt/trunk/lib/lit.common.configured.in

Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=193449&r1=193448&r2=193449&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Fri Oct 25 18:03:34 2013
@@ -124,6 +124,11 @@ function(filter_available_targets out_va
   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)

Modified: compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake?rev=193449&r1=193448&r2=193449&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake Fri Oct 25 18:03:34 2013
@@ -26,3 +26,13 @@ function(find_flag_in_string flag_string
     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()

Modified: compiler-rt/trunk/lib/asan/lit_tests/TestCases/Linux/malloc-in-qsort.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/TestCases/Linux/malloc-in-qsort.cc?rev=193449&r1=193448&r2=193449&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/lit_tests/TestCases/Linux/malloc-in-qsort.cc (original)
+++ compiler-rt/trunk/lib/asan/lit_tests/TestCases/Linux/malloc-in-qsort.cc Fri Oct 25 18:03:34 2013
@@ -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>
 

Modified: compiler-rt/trunk/lib/asan/lit_tests/TestCases/memcmp_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/TestCases/memcmp_test.cc?rev=193449&r1=193448&r2=193449&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/lit_tests/TestCases/memcmp_test.cc (original)
+++ compiler-rt/trunk/lib/asan/lit_tests/TestCases/memcmp_test.cc Fri Oct 25 18:03:34 2013
@@ -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};

Modified: compiler-rt/trunk/lib/asan/lit_tests/TestCases/strncpy-overflow.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/TestCases/strncpy-overflow.cc?rev=193449&r1=193448&r2=193449&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/lit_tests/TestCases/strncpy-overflow.cc (original)
+++ compiler-rt/trunk/lib/asan/lit_tests/TestCases/strncpy-overflow.cc Fri Oct 25 18:03:34 2013
@@ -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) {

Modified: compiler-rt/trunk/lib/lit.common.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lit.common.cfg?rev=193449&r1=193448&r2=193449&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lit.common.cfg (original)
+++ compiler-rt/trunk/lib/lit.common.cfg Fri Oct 25 18:03:34 2013
@@ -56,3 +56,7 @@ compiler_rt_arch = getattr(config, 'comp
 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')

Modified: compiler-rt/trunk/lib/lit.common.configured.in
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lit.common.configured.in?rev=193449&r1=193448&r2=193449&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lit.common.configured.in (original)
+++ compiler-rt/trunk/lib/lit.common.configured.in Fri Oct 25 18:03:34 2013
@@ -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.





More information about the llvm-commits mailing list