[PATCH compiler_rt] cmake build fix: lib/tsan/dd doesn't pick up the right flags for $arch
Larry D'Anna
larry at elder-gods.org
Mon Jun 2 17:20:07 PDT 2014
I encountered this issue trying to build a 32 bit llvm/clang on a 64 bit linux
machine. I'm not really familiar enough with cmake to know if this is an
appropriate solution, but it works for me! Please review. Here's now I set up
my build:
export CC=/home/larry/llvm/native/bin/clang
export CXX=/home/larry/llvm/native/bin/clang++
cmake -G Ninja ~/llvm \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CROSSCOMPILING=True \
-DLLVM_TABLEGEN=/home/larry/llvm/native/bin/llvm-tblgen \
-DCLANG_TABLEGEN=/home/larry/llvm/native/bin/clang-tblgen \
-DLLVM_DEFAULT_TARGET_TRIPLE=i686-linux-gnu \
-DLLVM_TARGET_ARCH=X86 \
-DCMAKE_C_FLAGS='-m32' \
-DCMAKE_CXX_FLAGS='-m32'
---
lib/tsan/dd/CMakeLists.txt | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/tsan/dd/CMakeLists.txt b/lib/tsan/dd/CMakeLists.txt
index a21e2dd..1804520 100644
--- a/lib/tsan/dd/CMakeLists.txt
+++ b/lib/tsan/dd/CMakeLists.txt
@@ -35,7 +35,8 @@ if(CAN_TARGET_x86_64 AND UNIX AND NOT APPLE AND NOT ANDROID)
DEFS ${DD_COMMON_DEFINITIONS})
add_library(RTDD OBJECT ${DD_SOURCES})
- set_target_compile_flags(RTDD ${DD_CFLAGS})
+ set_target_compile_flags(RTDD ${DD_CFLAGS} ${TARGET_${arch}_CFLAGS} ${LIB_CFLAGS})
+
set_property(TARGET RTDD APPEND PROPERTY
COMPILE_DEFINITIONS ${DD_COMMON_DEFINITIONS})
set_property(TARGET RTDD APPEND PROPERTY
@@ -47,6 +48,10 @@ if(CAN_TARGET_x86_64 AND UNIX AND NOT APPLE AND NOT ANDROID)
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>)
target_link_libraries(clang_rt.dyndd-${arch} pthread dl)
+
+ set_target_link_flags(clang_rt.dyndd-${arch}
+ ${TARGET_${arch}_CFLAGS} ${LIB_CFLAGS})
+
endif()
add_dependencies(compiler-rt dd)
--
1.8.3.2
More information about the llvm-commits
mailing list