<div dir="ltr">If you have recent host binutils (e.g, under /usr/bin), you can create a symlink to LLVMgold.so in /usr/lib/bfd-plugins dir. With that setup, the host ar/ranlib/nm can be used for thinLTO/LTO build without the need to set CMAKE_RANLIB etc.<div><br></div><div>David</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 27, 2016 at 9:33 AM, Teresa Johnson via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I can't reproduce the failure. I am building with a clang built Release from recent source as my stage-1 bootstrap compiler:<div>   clang version 4.0.0 (trunk 282322) (llvm/trunk 282341)</div><div><br></div><div>I am configuring the stage-2 bootstrap compiler with the following command, which largely is copied from your earlier email with your cmake command (changes noted below):</div><div><br></div><div>  lto=Thin</div><div>  type=Release</div><div>  cflgs=-w</div><div><div>  INSTALL_PREFIX=$HOME/llvm/${<wbr>build_dir_name}/clang-install</div><div>  BUILD_COMPILER=$HOME/llvm/<wbr>llvm_10_release_build</div><div>  SRC=$HOME/llvm/llvm_head</div><div>  BINUTILS=$HOME/binutils/<wbr>binutils</div><div>  env DYLD_LIBRARY_PATH=$BUILD_<wbr>COMPILER/lib/ \</div><div>  cmake \</div><div>    -G Ninja \</div><div>    -DCMAKE_BUILD_TYPE=${type} \</div><div>    -DLLVM_BINUTILS_INCDIR=$<wbr>BINUTILS/include \</div><div>    -DCMAKE_INSTALL_PREFIX=$<wbr>INSTALL_PREFIX \</div><span class=""><div>    -DLLVM_TARGETS_TO_BUILD="X86" \</div><div>    -DLLVM_ENABLE_BACKTRACES=OFF \</div><div>    -DLLVM_BUILD_EXAMPLES=OFF \</div><div>    -DLLVM_INCLUDE_EXAMPLES=OFF \</div><div>    -DLLVM_BUILD_TESTS=OFF \</div><div>    -DLLVM_INCLUDE_TESTS=OFF \</div><div>    -DLLVM_BUILD_DOCS=OFF \</div><div>    -DLLVM_INCLUDE_DOCS=OFF \</div><div>    -DLLVM_ENABLE_DOXYGEN=OFF \</div><div>    -DLLVM_ENABLE_SPHINX=OFF \</div><div>    -DLLDB_DISABLE_PYTHON=ON \</div><div>    -DCLANG_PLUGIN_SUPPORT=OFF \</div></span><div>    -DLLVM_ENABLE_LTO=${lto} \</div><div>    -DCMAKE_C_COMPILER=$BUILD_<wbr>COMPILER/bin/clang \</div><div>    -DCMAKE_CXX_COMPILER=$BUILD_<wbr>COMPILER/bin/clang++ \</div><div>    -DCMAKE_AR=$BUILD_COMPILER/<wbr>bin/llvm-ar \</div><div>    -DCMAKE_RANLIB=$BUILD_<wbr>COMPILER/bin/llvm-ranlib \</div><div>    -DLLVM_PARALLEL_LINK_JOBS=1 \</div><div>    -DBUILD_SHARED_LIBS=ON \</div><div>    -DCMAKE_C_FLAGS=${cflgs} \</div><div>    -DCMAKE_CXX_FLAGS=${cflgs} \</div><div>    -DCMAKE_EXE_LINKER_FLAGS=${<wbr>linkflgs} \</div><div>    $SRC</div><div><br></div><div>The changes from your config:</div><div>1) Used llvm-ar and llvm-nm from the build compiler. I noticed that you are specifying those as coming from the same directory used for CMAKE_INSTALL_PREFIX, which seems wrong - that is where the compiler built here will be installed.</div><div>2) Used my own binutils checkout as I don't have plugin-api.h installed in /usr/include</div><div>3) Set BUILD_SHARED_LIBS=ON (which I don't see in your earlier config, did you add that later?)</div><div>4) Set LLVM_PARALLEL_LINK_JOBS=1 (probably not needed)</div><div>5) Build with -w, to avoid occasional issues with warnings only emitted by clang (probably not needed)</div><div>6) Specified CMAKE_C_COMPILER and CMAKE_CXX_COMPILER explicitly (you might have had the right versions in your path?)</div><div><br></div><div>I did an nm on the .so libraries to see where __morestack was referenced and its linkage. No surprise, it is coming from libLLVMRuntimeDyld.so, and I do see it as weak as expected:</div><div><br></div><div><div><div>$ nm lib/libLLVMRuntimeDyld.so | grep morestack</div></div><div>                 w __morestack</div></div><div><br></div><div>Can you do the above nm on your lib/libLLVMRuntimeDyld.so and send me the output?</div><div><br></div><div>Thanks,</div><div>Teresa</div><div><div class="h5"><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 27, 2016 at 7:00 AM, Teresa Johnson <span dir="ltr"><<a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Tue, Sep 27, 2016 at 6:53 AM, Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span><br>
<br>
> On Sep 27, 2016, at 2:18 AM, Carsten Mattner <<a href="mailto:carstenmattner@gmail.com" target="_blank">carstenmattner@gmail.com</a>> wrote:<br>
><br>
>> On Mon, Sep 26, 2016 at 11:02 PM, Teresa Johnson <<a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a>> wrote:<br>
>> I'll either need to get a reproducer from you and/or try to repro it myself.<br>
><br>
> Assuming I run into this with BUILD_SHARED_LIBS=OFF, which seems unlikely,<br>
> what kind of reproducer data would you need from me?<br></span></blockquote><div><br></div></span><div>Let me see if I can reproduce it first. Probably a zip of all the inputs to the link and the link command line. Another option would be to save the temp files, but it would require some work to find the one producing the error and I might need all the inputs anyway...</div><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span>
><br>
>> I usually don't check out and build lldb, so perhaps I will start with that.<br>
><br>
> I must say I'm surprised a ThinLTO build of all of LLVM svn isn't part of<br>
> the periodic builders.<br>
<br>
<br>
</span>I have one, it just does include LLDB.<br></blockquote><div><br></div></span><div>Great, I was going to ask how to get one set up. Is it an official build bot? And I assume you meant it just does "not" include LLDB?</div><div><br></div><div>Working getting a shared build of LLDB right now...<span><font color="#888888"><br></font></span></div><span><font color="#888888"><div><br></div><div>Teresa</div></font></span><span><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span><font color="#888888"><br>
Mehdi<br>
</font></span><div><div>><br>
>> As a workaround you could try -DBUILD_SHARED_LIBS=OFF.<br>
><br>
> Thanks, will do, but probably not before Wednesday because it looks like<br>
> this requires a full rebuild, if my interpretation of the cmake warning/error<br>
> is correct.<br>
</div></div></blockquote></span></div><br><br clear="all"><span><div><br></div>-- <br><div><span style="font-family:times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top:2px solid rgb(213,15,37)">Teresa Johnson |</td><td nowrap style="border-top:2px solid rgb(51,105,232)"> Software Engineer |</td><td nowrap style="border-top:2px solid rgb(0,153,57)"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top:2px solid rgb(238,178,17)"> <a href="tel:408-460-2413" value="+14084602413" target="_blank">408-460-2413</a></td></tr></tbody></table></span></div>
</span></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div><span style="font-family:times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top:2px solid rgb(213,15,37)">Teresa Johnson |</td><td nowrap style="border-top:2px solid rgb(51,105,232)"> Software Engineer |</td><td nowrap style="border-top:2px solid rgb(0,153,57)"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top:2px solid rgb(238,178,17)"> <a href="tel:408-460-2413" value="+14084602413" target="_blank">408-460-2413</a></td></tr></tbody></table></span></div>
</div></div></div></div></div></div>
<br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>