[Parallel_libs-commits] [PATCH] D24474: [SE] Stop using llvm-config --cxxflags
Jason Henline via Parallel_libs-commits
parallel_libs-commits at lists.llvm.org
Mon Sep 12 14:40:37 PDT 2016
jhen created this revision.
jhen added a reviewer: jlebar.
jhen added subscribers: parallel_libs-commits, jprice.
Herald added subscribers: mgorny, beanz.
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 the `--has-rtti` flag to `llvm-config` 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.
https://reviews.llvm.org/D24474
Files:
streamexecutor/CMakeLists.txt
Index: streamexecutor/CMakeLists.txt
===================================================================
--- streamexecutor/CMakeLists.txt
+++ streamexecutor/CMakeLists.txt
@@ -26,17 +26,17 @@
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.
+ # If LLVM does not have RTTI, don't use it here either.
execute_process(
COMMAND
"${LLVM_BINARY_DIR}/bin/llvm-config"
- --cxxflags
+ --has-rtti
OUTPUT_VARIABLE
- LLVM_CXXFLAGS
+ STREAM_EXECUTOR_LLVM_HAS_RTTI
OUTPUT_STRIP_TRAILING_WHITESPACE)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LLVM_CXXFLAGS}")
+ if (NOT STREAM_EXECUTOR_LLVM_HAS_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}")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24474.71057.patch
Type: text/x-patch
Size: 1054 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/parallel_libs-commits/attachments/20160912/55edaeef/attachment-0001.bin>
More information about the Parallel_libs-commits
mailing list