<div dir="ltr"><div>I'm glad to see more interest in using the runtimes build support. I'd be happy to review all the remaining changes and land them for you. Feel free to add me as a reviewer.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 17, 2020 at 12:58 PM Nagurne, James via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US">
<div class="gmail-m_3976265820975791880WordSection1">
<p class="MsoNormal">I work for a team that is productizing an LLVM compiler toolchain focused on embedded ARM devices.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">We are converting from standalone runtimes builds to using lvm/runtimes and LLVM_ENABLE_RUNTIMES.<u></u><u></u></p>
<p class="MsoNormal">In our development, a few issues arose due to cross-compilation and the embedded nature of the targets.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="gmail-m_3976265820975791880MsoListParagraph"><u></u><span style="font-family:Symbol"><span>·<span style="font:7pt "Times New Roman"">
</span></span></span><u></u>When utilizing LLVM_RUNTIME_MULTILIBS, it is ill-defined whether the multilib option override or the default option override takes precedence. Instead, it is up to whatever order cmake decides to list the variables in the CMakeCache.txt
file. This change has been reviewed, but is awaiting a committer (or me getting commit access,
<span style="font-family:Wingdings">J</span> )<u></u><u></u></p>
<p class="gmail-m_3976265820975791880MsoListParagraph" style="margin-left:1in">
<u></u><span style="font-family:"Courier New""><span>o<span style="font:7pt "Times New Roman"">
</span></span></span><u></u><a href="https://reviews.llvm.org/D71570" target="_blank">https://reviews.llvm.org/D71570</a><u></u><u></u></p>
<p class="gmail-m_3976265820975791880MsoListParagraph"><u></u><span style="font-family:Symbol"><span>·<span style="font:7pt "Times New Roman"">
</span></span></span><u></u>In runtimes which utilize the LLVM configuration, variables found in LLVMConfig.cmake override the runtimes’ configuration. Specifically, LLVM_ENABLE_PIC is set to the value used to build the toolchain. This is undesirable, because
the value used to build the toolchain is not necessarily the same value that should be used to build the runtimes, especially when the target being built for is completely different.<u></u><u></u></p>
<p class="gmail-m_3976265820975791880MsoListParagraph" style="margin-left:1in">
<u></u><span style="font-family:"Courier New""><span>o<span style="font:7pt "Times New Roman"">
</span></span></span><u></u><a href="https://reviews.llvm.org/D72947" target="_blank">https://reviews.llvm.org/D72947</a><u></u><u></u></p>
<p class="gmail-m_3976265820975791880MsoListParagraph"><u></u><span style="font-family:Symbol"><span>·<span style="font:7pt "Times New Roman"">
</span></span></span><u></u> In compiler-rt’s builtins, -fPIC is added to the command line unconditionally in a standalone build, citing that the LLVM cmake step would have added it too. However, the LLVM cmake step checks LLVM_ENABLE_PIC before doing so.
I’ve added a COMPILER_RT_BUILTINS_ENABLE_PIC options to guard this option’s addition in a standlone build.<u></u><u></u></p>
<p class="gmail-m_3976265820975791880MsoListParagraph" style="margin-left:1in">
<u></u><span style="font-family:"Courier New""><span>o<span style="font:7pt "Times New Roman"">
</span></span></span><u></u><a href="https://reviews.llvm.org/D72950" target="_blank">https://reviews.llvm.org/D72950</a><u></u><u></u></p>
<p class="gmail-m_3976265820975791880MsoListParagraph"><u></u><span style="font-family:Symbol"><span>·<span style="font:7pt "Times New Roman"">
</span></span></span><u></u>libcxx, libcxxabi, and libunwind utilize HandleLLVMOptions. This cmake configuration file contains a block which sets LLVM_ON_WIN32, LLVM_ON_UNIX, and LLVM_HAVE_LINK_VERSION_SCRIPT. This block errors out if one of WIN32, UNIX,
or FUCSHIA is not set. Our embedded ARM target has the CMAKE_SYSTEM_NAME ‘Generic’, so that none of these variables are set, causing an error. I believe that this block of code can safely set all 3 of these variables to 0 for the 3 projects I’ve mentioned.
Doing so has allowed me to build functional runtimes for a Generic system.<u></u><u></u></p>
<p class="gmail-m_3976265820975791880MsoListParagraph" style="margin-left:1in">
<u></u><span style="font-family:"Courier New""><span>o<span style="font:7pt "Times New Roman"">
</span></span></span><u></u><a href="https://reviews.llvm.org/D72951" target="_blank">https://reviews.llvm.org/D72951</a><u></u><u></u></p>
<p class="gmail-m_3976265820975791880MsoListParagraph"><u></u><span style="font-family:Symbol"><span>·<span style="font:7pt "Times New Roman"">
</span></span></span><u></u>CMAKE_ASM_OPTIONS doesn’t work for the assembly source in libunwind because those files are marked with ‘C’ language properties. I believe there’s some history that necessitated this behavior that has since been made defunct.<u></u><u></u></p>
<p class="gmail-m_3976265820975791880MsoListParagraph" style="margin-left:1in">
<u></u><span style="font-family:"Courier New""><span>o<span style="font:7pt "Times New Roman"">
</span></span></span><u></u><a href="https://reviews.llvm.org/D72952" target="_blank">https://reviews.llvm.org/D72952</a><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I see that Chandler Carruth is responsible for CMake in CODE_OWNERS, so I’ll add him to these revisions initially unless others step in.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
<p class="MsoNormal">J.B. Nagurne<u></u><u></u></p>
<p class="MsoNormal">Code Generation<u></u><u></u></p>
<p class="MsoNormal">Texas Instruments<u></u><u></u></p>
</div>
</div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>