[Parallel_libs-commits] [parallel-libs] r281347 - [SE] Stop using llvm-config --cxxflags

Jason Henline via Parallel_libs-commits parallel_libs-commits at lists.llvm.org
Tue Sep 13 08:44:18 PDT 2016


Author: jhen
Date: Tue Sep 13 10:44:18 2016
New Revision: 281347

URL: http://llvm.org/viewvc/llvm-project?rev=281347&view=rev
Log:
[SE] Stop using llvm-config --cxxflags

Summary:
Build configuration was adding $(llvm-config --cxxflags) to the
StreamExecutor CXXFLAGS, but this was causing "-O3" to be passed even
for debug builds, and was making debugging difficult.

The llvm-config call was originally introduced to handle the -fno-rtti
flag because an RTTI StreamExecutor could not link with a no-RTTI LLVM.
This patch converts to using LLVM_ENABLE_RTTI and only adding the
`-fno-rtti` flag if needed, not all the rest of the LLVM CXXFLAGS.

I have tested this with clang-4.0 and gcc-4.8 on Ubuntu. Some work will
probably have to be done to support MSVC.

Reviewers: jlebar

Subscribers: beanz, jprice, parallel_libs-commits, mgorny

Differential Revision: https://reviews.llvm.org/D24474

Modified:
    parallel-libs/trunk/streamexecutor/CMakeLists.txt

Modified: parallel-libs/trunk/streamexecutor/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/parallel-libs/trunk/streamexecutor/CMakeLists.txt?rev=281347&r1=281346&r2=281347&view=diff
==============================================================================
--- parallel-libs/trunk/streamexecutor/CMakeLists.txt (original)
+++ parallel-libs/trunk/streamexecutor/CMakeLists.txt Tue Sep 13 10:44:18 2016
@@ -26,17 +26,10 @@ if(STREAM_EXECUTOR_STANDALONE)
     include_directories(${LLVM_INCLUDE_DIRS})
     add_definitions(${LLVM_DEFINITIONS})
 
-    # Get the LLVM cxxflags by using llvm-config.
-    #
-    # This is necessary to get -fno-rtti if LLVM is compiled that way.
-    execute_process(
-        COMMAND
-        "${LLVM_BINARY_DIR}/bin/llvm-config"
-        --cxxflags
-        OUTPUT_VARIABLE
-        LLVM_CXXFLAGS
-        OUTPUT_STRIP_TRAILING_WHITESPACE)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LLVM_CXXFLAGS}")
+    # If LLVM does not have RTTI, don't use it here either.
+    if (NOT LLVM_ENABLE_RTTI)
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
+    endif()
 
     set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
     list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")




More information about the Parallel_libs-commits mailing list