[compiler-rt] r257686 - With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compiling
Alexey Samsonov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 13 16:10:12 PST 2016
On Wed, Jan 13, 2016 at 2:09 PM, Sumanth Gundapaneni via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: sgundapa
> Date: Wed Jan 13 16:09:47 2016
> New Revision: 257686
>
> URL: http://llvm.org/viewvc/llvm-project?rev=257686&view=rev
> Log:
> With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compiling
> environment, the unit tests fail to link. This patch does the following
> changes
>
> >Rename COMPILER_RT_TEST_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS to reflect
> the
> way it's used.
> >Add COMPILER_RT_TEST_COMPILER_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS so
> that
> cross-compiler would be able to build/compile the unit tests
> >Add COMPILER_RT_UNITTEST_LINKFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that
> cross-compiler would be able to link the unit tests (if needed)
>
> Differential Revision:http://reviews.llvm.org/D15082
>
> Modified:
> 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
>
> Modified: compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake?rev=257686&r1=257685&r2=257686&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake (original)
> +++ compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake Wed Jan 13
> 16:09:47 2016
> @@ -165,7 +165,10 @@ function(add_compiler_rt_runtime name ty
> 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})
>
^^
I think you need to enquote ${COMPILER_RT_TEST_COMPILER_CFLAGS} to make
sure it works for empty variable.
> +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 @@ set(COMPILER_RT_GTEST_CFLAGS
> -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)
>
> 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=257686&r1=257685&r2=257686&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/tests/CMakeLists.txt (original)
> +++ compiler-rt/trunk/lib/asan/tests/CMakeLists.txt Wed Jan 13 16:09:47
> 2016
> @@ -21,7 +21,7 @@ set(ASAN_UNITTEST_HEADERS
> 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 @@ set(ASAN_UNITTEST_COMMON_CFLAGS
> -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)
>
> Modified: compiler-rt/trunk/lib/msan/tests/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/tests/CMakeLists.txt?rev=257686&r1=257685&r2=257686&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/msan/tests/CMakeLists.txt (original)
> +++ compiler-rt/trunk/lib/msan/tests/CMakeLists.txt Wed Jan 13 16:09:47
> 2016
> @@ -20,7 +20,7 @@ set(MSAN_UNITTEST_HEADERS
> 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
>
> Modified: compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt?rev=257686&r1=257685&r2=257686&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt Wed Jan 13
> 16:09:47 2016
> @@ -44,7 +44,7 @@ foreach(header ${SANITIZER_HEADERS})
> 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
>
> Modified: compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt?rev=257686&r1=257685&r2=257686&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt (original)
> +++ compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt Wed Jan 13 16:09:47
> 2016
> @@ -6,7 +6,7 @@ set_target_properties(TsanUnitTests PROP
>
> 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
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
--
Alexey Samsonov
vonosmas at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160113/65bae792/attachment.html>
More information about the llvm-commits
mailing list