<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>I haven’t tested the empty string case which is why this caused a havoc.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>I will fix the patch , test it and push a new one.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>--Sumanth G<o:p></o:p></span></p><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'> Alexey Samsonov [mailto:vonosmas@gmail.com] <br><b>Sent:</b> Wednesday, January 13, 2016 4:10 PM<br><b>To:</b> Sumanth Gundapaneni<br><b>Cc:</b> llvm-commits<br><b>Subject:</b> Re: [compiler-rt] r257686 - With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compiling<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Wed, Jan 13, 2016 at 2:09 PM, Sumanth Gundapaneni via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><p class=MsoNormal>Author: sgundapa<br>Date: Wed Jan 13 16:09:47 2016<br>New Revision: 257686<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=257686&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=257686&view=rev</a><br>Log:<br>With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compiling<br>environment, the unit tests fail to link. This patch does the following changes<br><br>>Rename COMPILER_RT_TEST_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS to reflect the<br>way it's used.<br>>Add COMPILER_RT_TEST_COMPILER_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that<br>cross-compiler would be able to build/compile the unit tests<br>>Add COMPILER_RT_UNITTEST_LINKFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that<br>cross-compiler would be able to link the unit tests (if needed)<br><br>Differential Revision:<a href="http://reviews.llvm.org/D15082" target="_blank">http://reviews.llvm.org/D15082</a><br><br>Modified:<br>    compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake<br>    compiler-rt/trunk/lib/asan/tests/CMakeLists.txt<br>    compiler-rt/trunk/lib/msan/tests/CMakeLists.txt<br>    compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt<br>    compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt<br><br>Modified: compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake<br>URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake?rev=257686&r1=257685&r2=257686&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake?rev=257686&r1=257685&r2=257686&view=diff</a><br>==============================================================================<br>--- compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake (original)<br>+++ compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake Wed Jan 13 16:09:47 2016<br>@@ -165,7 +165,10 @@ function(add_compiler_rt_runtime name ty<br>   endif()<br> endfunction()<br><br>-set(COMPILER_RT_TEST_CFLAGS)<br>+# when cross compiling, COMPILER_RT_TEST_COMPILER_CFLAGS help<br>+# in compilation and linking of unittests.<br>+string(REPLACE " " ";" COMPILER_RT_UNITTEST_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})<o:p></o:p></p></blockquote><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>^^<o:p></o:p></p></div><div><p class=MsoNormal>I think you need to enquote ${COMPILER_RT_TEST_COMPILER_CFLAGS} to make sure it works for empty variable.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><p class=MsoNormal>+set(COMPILER_RT_UNITTEST_LINKFLAGS ${COMPILER_RT_UNITTEST_CFLAGS})<br><br> # Unittests support.<br> set(COMPILER_RT_GTEST_PATH ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest)<br>@@ -177,14 +180,14 @@ set(COMPILER_RT_GTEST_CFLAGS<br>   -I${COMPILER_RT_GTEST_PATH}<br> )<br><br>-append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 COMPILER_RT_TEST_CFLAGS)<br>+append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 COMPILER_RT_UNITTEST_CFLAGS)<br><br> if(MSVC)<br>   # clang doesn't support exceptions on Windows yet.<br>-  list(APPEND COMPILER_RT_TEST_CFLAGS -D_HAS_EXCEPTIONS=0)<br>+  list(APPEND COMPILER_RT_UNITTEST_CFLAGS -D_HAS_EXCEPTIONS=0)<br><br>   # We should teach clang to understand "#pragma intrinsic", see PR19898.<br>-  list(APPEND COMPILER_RT_TEST_CFLAGS -Wno-undefined-inline)<br>+  list(APPEND COMPILER_RT_UNITTEST_CFLAGS -Wno-undefined-inline)<br><br>   # Clang doesn't support SEH on Windows yet.<br>   list(APPEND COMPILER_RT_GTEST_CFLAGS -DGTEST_HAS_SEH=0)<br><br>Modified: compiler-rt/trunk/lib/asan/tests/CMakeLists.txt<br>URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/CMakeLists.txt?rev=257686&r1=257685&r2=257686&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/CMakeLists.txt?rev=257686&r1=257685&r2=257686&view=diff</a><br>==============================================================================<br>--- compiler-rt/trunk/lib/asan/tests/CMakeLists.txt (original)<br>+++ compiler-rt/trunk/lib/asan/tests/CMakeLists.txt Wed Jan 13 16:09:47 2016<br>@@ -21,7 +21,7 @@ set(ASAN_UNITTEST_HEADERS<br>   asan_test_utils.h)<br><br> set(ASAN_UNITTEST_COMMON_CFLAGS<br>-  ${COMPILER_RT_TEST_CFLAGS}<br>+  ${COMPILER_RT_UNITTEST_CFLAGS}<br>   ${COMPILER_RT_GTEST_CFLAGS}<br>   -I${COMPILER_RT_SOURCE_DIR}/include<br>   -I${COMPILER_RT_SOURCE_DIR}/lib<br>@@ -34,6 +34,11 @@ set(ASAN_UNITTEST_COMMON_CFLAGS<br>   -Wno-non-virtual-dtor)<br> append_list_if(COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG -Wno-variadic-macros ASAN_UNITTEST_COMMON_CFLAGS)<br><br>+# This will ensure the target linker is used<br>+# during cross compilation<br>+set(ASAN_UNITTEST_COMMON_LINKFLAGS<br>+  ${COMPILER_RT_UNITTEST_LINKFLAGS})<br>+<br> # -gline-tables-only must be enough for ASan, so use it if possible.<br> if(COMPILER_RT_TEST_COMPILER_ID MATCHES "Clang")<br>   list(APPEND ASAN_UNITTEST_COMMON_CFLAGS -gline-tables-only)<br><br>Modified: compiler-rt/trunk/lib/msan/tests/CMakeLists.txt<br>URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/tests/CMakeLists.txt?rev=257686&r1=257685&r2=257686&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/tests/CMakeLists.txt?rev=257686&r1=257685&r2=257686&view=diff</a><br>==============================================================================<br>--- compiler-rt/trunk/lib/msan/tests/CMakeLists.txt (original)<br>+++ compiler-rt/trunk/lib/msan/tests/CMakeLists.txt Wed Jan 13 16:09:47 2016<br>@@ -20,7 +20,7 @@ set(MSAN_UNITTEST_HEADERS<br> set(MSAN_UNITTEST_COMMON_CFLAGS<br>   -nostdinc++<br>   -isystem ${COMPILER_RT_LIBCXX_PATH}/include<br>-  ${COMPILER_RT_TEST_CFLAGS}<br>+  ${COMPILER_RT_UNITTEST_CFLAGS}<br>   ${COMPILER_RT_GTEST_CFLAGS}<br>   -I${COMPILER_RT_SOURCE_DIR}/include<br>   -I${COMPILER_RT_SOURCE_DIR}/lib<br><br>Modified: compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt<br>URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt?rev=257686&r1=257685&r2=257686&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt?rev=257686&r1=257685&r2=257686&view=diff</a><br>==============================================================================<br>--- compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt (original)<br>+++ compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt Wed Jan 13 16:09:47 2016<br>@@ -44,7 +44,7 @@ foreach(header ${SANITIZER_HEADERS})<br> endforeach()<br><br> set(SANITIZER_TEST_CFLAGS_COMMON<br>-  ${COMPILER_RT_TEST_CFLAGS}<br>+  ${COMPILER_RT_UNITTEST_CFLAGS}<br>   ${COMPILER_RT_GTEST_CFLAGS}<br>   -I${COMPILER_RT_SOURCE_DIR}/include<br>   -I${COMPILER_RT_SOURCE_DIR}/lib<br><br>Modified: compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt<br>URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt?rev=257686&r1=257685&r2=257686&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt?rev=257686&r1=257685&r2=257686&view=diff</a><br>==============================================================================<br>--- compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt (original)<br>+++ compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt Wed Jan 13 16:09:47 2016<br>@@ -6,7 +6,7 @@ set_target_properties(TsanUnitTests PROP<br><br> set(TSAN_UNITTEST_CFLAGS<br>   ${TSAN_CFLAGS}<br>-  ${COMPILER_RT_TEST_CFLAGS}<br>+  ${COMPILER_RT_UNITTEST_CFLAGS}<br>   ${COMPILER_RT_GTEST_CFLAGS}<br>   -I${COMPILER_RT_SOURCE_DIR}/lib<br>   -I${COMPILER_RT_SOURCE_DIR}/lib/tsan/rtl<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><o:p></o:p></p></blockquote></div><p class=MsoNormal><br><br clear=all><o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal>-- <o:p></o:p></p><div><div><p class=MsoNormal>Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a><o:p></o:p></p></div></div></div></div></div></body></html>