[PATCH] D15082: Fix the cross compilation of unit tests. NFC
Sumanth Gundapaneni via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 13 14:13:33 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL257686: With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compiling (authored by sgundapa).
Changed prior to commit:
http://reviews.llvm.org/D15082?vs=44667&id=44789#toc
Repository:
rL LLVM
http://reviews.llvm.org/D15082
Files:
compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
compiler-rt/trunk/lib/msan/tests/CMakeLists.txt
compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt
Index: compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt
+++ compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt
@@ -6,7 +6,7 @@
set(TSAN_UNITTEST_CFLAGS
${TSAN_CFLAGS}
- ${COMPILER_RT_TEST_CFLAGS}
+ ${COMPILER_RT_UNITTEST_CFLAGS}
${COMPILER_RT_GTEST_CFLAGS}
-I${COMPILER_RT_SOURCE_DIR}/lib
-I${COMPILER_RT_SOURCE_DIR}/lib/tsan/rtl
Index: compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
+++ compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
@@ -21,7 +21,7 @@
asan_test_utils.h)
set(ASAN_UNITTEST_COMMON_CFLAGS
- ${COMPILER_RT_TEST_CFLAGS}
+ ${COMPILER_RT_UNITTEST_CFLAGS}
${COMPILER_RT_GTEST_CFLAGS}
-I${COMPILER_RT_SOURCE_DIR}/include
-I${COMPILER_RT_SOURCE_DIR}/lib
@@ -34,6 +34,11 @@
-Wno-non-virtual-dtor)
append_list_if(COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG -Wno-variadic-macros ASAN_UNITTEST_COMMON_CFLAGS)
+# This will ensure the target linker is used
+# during cross compilation
+set(ASAN_UNITTEST_COMMON_LINKFLAGS
+ ${COMPILER_RT_UNITTEST_LINKFLAGS})
+
# -gline-tables-only must be enough for ASan, so use it if possible.
if(COMPILER_RT_TEST_COMPILER_ID MATCHES "Clang")
list(APPEND ASAN_UNITTEST_COMMON_CFLAGS -gline-tables-only)
Index: compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
+++ compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
@@ -44,7 +44,7 @@
endforeach()
set(SANITIZER_TEST_CFLAGS_COMMON
- ${COMPILER_RT_TEST_CFLAGS}
+ ${COMPILER_RT_UNITTEST_CFLAGS}
${COMPILER_RT_GTEST_CFLAGS}
-I${COMPILER_RT_SOURCE_DIR}/include
-I${COMPILER_RT_SOURCE_DIR}/lib
Index: compiler-rt/trunk/lib/msan/tests/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/lib/msan/tests/CMakeLists.txt
+++ compiler-rt/trunk/lib/msan/tests/CMakeLists.txt
@@ -20,7 +20,7 @@
set(MSAN_UNITTEST_COMMON_CFLAGS
-nostdinc++
-isystem ${COMPILER_RT_LIBCXX_PATH}/include
- ${COMPILER_RT_TEST_CFLAGS}
+ ${COMPILER_RT_UNITTEST_CFLAGS}
${COMPILER_RT_GTEST_CFLAGS}
-I${COMPILER_RT_SOURCE_DIR}/include
-I${COMPILER_RT_SOURCE_DIR}/lib
Index: compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
===================================================================
--- compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
+++ compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
@@ -165,7 +165,10 @@
endif()
endfunction()
-set(COMPILER_RT_TEST_CFLAGS)
+# when cross compiling, COMPILER_RT_TEST_COMPILER_CFLAGS help
+# in compilation and linking of unittests.
+string(REPLACE " " ";" COMPILER_RT_UNITTEST_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})
+set(COMPILER_RT_UNITTEST_LINKFLAGS ${COMPILER_RT_UNITTEST_CFLAGS})
# Unittests support.
set(COMPILER_RT_GTEST_PATH ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest)
@@ -177,14 +180,14 @@
-I${COMPILER_RT_GTEST_PATH}
)
-append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 COMPILER_RT_TEST_CFLAGS)
+append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 COMPILER_RT_UNITTEST_CFLAGS)
if(MSVC)
# clang doesn't support exceptions on Windows yet.
- list(APPEND COMPILER_RT_TEST_CFLAGS -D_HAS_EXCEPTIONS=0)
+ list(APPEND COMPILER_RT_UNITTEST_CFLAGS -D_HAS_EXCEPTIONS=0)
# We should teach clang to understand "#pragma intrinsic", see PR19898.
- list(APPEND COMPILER_RT_TEST_CFLAGS -Wno-undefined-inline)
+ list(APPEND COMPILER_RT_UNITTEST_CFLAGS -Wno-undefined-inline)
# Clang doesn't support SEH on Windows yet.
list(APPEND COMPILER_RT_GTEST_CFLAGS -DGTEST_HAS_SEH=0)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15082.44789.patch
Type: text/x-patch
Size: 3832 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160113/0aae27ba/attachment.bin>
More information about the llvm-commits
mailing list