[llvm-commits] [compiler-rt] r162809 - in /compiler-rt/trunk: CMakeLists.txt lib/asan/CMakeLists.txt lib/asan/tests/CMakeLists.txt lib/interception/CMakeLists.txt lib/sanitizer_common/CMakeLists.txt

Chandler Carruth chandlerc at gmail.com
Tue Aug 28 17:13:11 PDT 2012


Author: chandlerc
Date: Tue Aug 28 19:13:11 2012
New Revision: 162809

URL: http://llvm.org/viewvc/llvm-project?rev=162809&view=rev
Log:
Some flag cleanup for the sanitizer runtimes.

This hoists most of the CFLAGS into a common variable. It also adds
detection for -Wno-c99-extensions and uses it to silence a pile of
warnings.

Finally, it switches to the proper flag -rdynamic.

With this, the cmake build is warning free on my bootstrap Linux build.

Modified:
    compiler-rt/trunk/CMakeLists.txt
    compiler-rt/trunk/lib/asan/CMakeLists.txt
    compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
    compiler-rt/trunk/lib/interception/CMakeLists.txt
    compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt

Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=162809&r1=162808&r2=162809&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Tue Aug 28 19:13:11 2012
@@ -74,6 +74,22 @@
   set(${out_var} ${archs} PARENT_SCOPE)
 endfunction()
 
+# Provide some common commmandline flags for Sanitizer runtimes.
+set(SANITIZER_COMMON_CFLAGS
+  -fPIC
+  -fno-exceptions
+  -funwind-tables
+  -fvisibility=hidden
+  )
+if(SUPPORTS_NO_VARIADIC_MACROS_FLAG)
+  list(APPEND SANITIZER_COMMON_CFLAGS -Wno-variadic-macros)
+endif()
+check_cxx_compiler_flag(-Wno-c99-extensions
+  SUPPORTS_NO_C99_EXTENSIONS_FLAG)
+if(SUPPORTS_NO_C99_EXTENSIONS_FLAG)
+  list(APPEND SANITIZER_COMMON_CFLAGS -Wno-c99-extensions)
+endif()
+
 # Because compiler-rt spends a lot of time setting up custom compile flags,
 # define a handy helper function for it. The compile flags setting in CMake
 # has serious issues that make its syntax challenging at best.

Modified: compiler-rt/trunk/lib/asan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/CMakeLists.txt?rev=162809&r1=162808&r2=162809&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/asan/CMakeLists.txt Tue Aug 28 19:13:11 2012
@@ -29,10 +29,7 @@
 include_directories(..)
 
 set(ASAN_CFLAGS
-  -fPIC
-  -fno-exceptions
-  -funwind-tables
-  -fvisibility=hidden
+  ${SANITIZER_COMMON_CFLAGS}
   -fno-builtin
   -fomit-frame-pointer
   -O3
@@ -43,10 +40,6 @@
   MAC_INTERPOSE_FUNCTIONS=1
   )
 
-if (SUPPORTS_NO_VARIADIC_MACROS_FLAG)
-  list(APPEND ASAN_CFLAGS -Wno-variadic-macros)
-endif ()
-
 if (APPLE)
   list(APPEND ASAN_CFLAGS -mmacosx-version-min=10.5)
 endif()

Modified: compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/CMakeLists.txt?rev=162809&r1=162808&r2=162809&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/asan/tests/CMakeLists.txt Tue Aug 28 19:13:11 2012
@@ -60,7 +60,7 @@
   elseif (UNIX)
     # Linux-specific linker flags.
     set_property(TARGET ${testname} APPEND PROPERTY
-                 LINK_FLAGS "-lpthread -ldl -export-dynamic")
+                 LINK_FLAGS "-lpthread -ldl -rdynamic")
     if(LLVM_BUILD_32_BITS)
       target_link_libraries(${testname} clang_rt.asan-i386)
     else()

Modified: compiler-rt/trunk/lib/interception/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/interception/CMakeLists.txt?rev=162809&r1=162808&r2=162809&view=diff
==============================================================================
--- compiler-rt/trunk/lib/interception/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/interception/CMakeLists.txt Tue Aug 28 19:13:11 2012
@@ -13,16 +13,7 @@
   list(APPEND INTERCEPTION_SOURCES mach_override/mach_override.c)
 endif ()
 
-set(INTERCEPTION_CFLAGS
-  -O3
-  -fPIC
-  -fno-exceptions
-  -funwind-tables
-  -fvisibility=hidden
-  )
-if(SUPPORTS_NO_VARIADIC_MACROS_FLAG)
-  list(APPEND INTERCEPTION_CFLAGS -Wno-variadic-macros)
-endif()
+set(INTERCEPTION_CFLAGS -O3 ${SANITIZER_COMMON_CFLAGS})
 
 if(APPLE)
   # Build universal binary on APPLE.

Modified: compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt?rev=162809&r1=162808&r2=162809&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt Tue Aug 28 19:13:11 2012
@@ -18,13 +18,7 @@
   sanitizer_win.cc
   )
 
-set(SANITIZER_CFLAGS
-  -O3
-  -fPIC
-  -fno-exceptions
-  -funwind-tables
-  -fvisibility=hidden
-  )
+set(SANITIZER_CFLAGS -O3 ${SANITIZER_COMMON_CFLAGS})
 
 set(SANITIZER_COMMON_DEFINITIONS)
 





More information about the llvm-commits mailing list