<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 20, 2017 at 2:06 PM, Chris Bieneman via Phabricator <span dir="ltr"><<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">beanz added a comment.<br>
<br>
@davidxl, do you recall how the failure that caused you to make the policy change exhibited itself? It seems to me like we were working around the behavior of the old policy setting by passing the linker options through manually. I wonder if the reason for the error was CMake masking those liker flags under the new policy.<br>
<br>
Thoughts?<br></blockquote><div><br></div><div>Unfortunately I don't remember the details -- only the information in the comments.</div><div><br></div><div>I think this is a good time to get to the bottom of it.</div><div><br></div><div>David</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<br>
================<br>
Comment at: CMakeLists.txt:17<br>
<span class=""> cmake_minimum_required(VERSION 3.4.3)<br>
-# FIXME:<br>
-# The OLD behavior (pre 3.2) for this policy is to not set the value of the<br>
-# CMAKE_EXE_LINKER_FLAGS variable in the generated test project. The NEW behavior<br>
-# for this policy is to set the value of the CMAKE_EXE_LINKER_FLAGS variable<br>
-# in the test project to the same as it is in the calling project. The new<br>
-# behavior cause the compiler_rt test to fail during try_compile: see<br>
-# projects/compiler-rt/cmake/<wbr>Modules/CompilerRTUtils.cmake:<wbr>121 such that<br>
-# CAN_TARGET_${arch} is not set properly. This results in COMPILER_RT_SUPPORTED_ARCH<br>
-# not being updated properly leading to poblems.<br>
-cmake_policy(SET CMP0056 OLD)<br>
+cmake_policy(SET CMP0056 NEW)<br>
<br>
</span>----------------<br>
You shouldn't need to set this to NEW, it should default to NEW based on the `cmake_minimum_version` being set above.<br>
<br>
<br>
================<br>
Comment at: cmake/Modules/CompilerRTUtils.<wbr>cmake:129<br>
<span class="">+  set(SAVED_CMAKE_EXE_LINKER_<wbr>FLAGS ${CMAKE_EXE_LINKER_FLAGS})<br>
+  set(CMAKE_EXE_LINKER_FLAGS "")<br>
   set(TARGET_${arch}_CFLAGS ${ARGN})<br>
</span>----------------<br>
Pretty sure this will actually change behavior. Look down below, we were reading this value and passing it through to the `try_compile` call.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D31098" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D31098</a><br>
<br>
<br>
<br>
</blockquote></div><br></div></div>