<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 27, 2016 at 11:27 AM, Carsten Mattner <span dir="ltr"><<a href="mailto:carstenmattner@gmail.com" target="_blank">carstenmattner@gmail.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 class="gmail-">On Tue, Sep 27, 2016 at 6:33 PM, Teresa Johnson <<a href="mailto:tejohnson@google.com">tejohnson@google.com</a>> wrote:<br>
><br>
> I can't reproduce the failure. I am building with a clang built<br>
>    Release from recent source as my stage-1 bootstrap compiler:<br>
>    clang version 4.0.0 (trunk 282322) (llvm/trunk 282341)<br>
<br>
</span>The clang I use was built from the 3.9 release branch:<br>
clang version 3.9.1 (branches/release_39 281767)<br>
<br>
Is that too old for it to build itself with ThinLTO?<br></blockquote><div><br></div><div>I wonder if there is a bug that was fixed. I have bootstrapped with ThinLTO with the 3.9 compiler, but not with LLDB and not with SHARED_LIBS=ON. I can try with an older 3.9 version.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class="gmail-"><br>
> I am configuring the stage-2 bootstrap compiler with the following<br>
> command, which largely is copied from your earlier email with your<br>
> cmake command (changes noted below):<br>
><br>
>   lto=Thin<br>
>   type=Release<br>
>   cflgs=-w<br>
>   INSTALL_PREFIX=$HOME/llvm/${<wbr>build_dir_name}/clang-install<br>
>   BUILD_COMPILER=$HOME/llvm/<wbr>llvm_10_release_build<br>
>   SRC=$HOME/llvm/llvm_head<br>
>   BINUTILS=$HOME/binutils/<wbr>binutils<br>
>   env DYLD_LIBRARY_PATH=$BUILD_<wbr>COMPILER/lib/ \<br>
>   cmake \<br>
>     -G Ninja \<br>
>     -DCMAKE_BUILD_TYPE=${type} \<br>
>     -DLLVM_BINUTILS_INCDIR=$<wbr>BINUTILS/include \<br>
</span>[...]<br>
<span class="gmail-">>     -DCMAKE_C_FLAGS=${cflgs} \<br>
>     -DCMAKE_CXX_FLAGS=${cflgs} \<br>
>     -DCMAKE_EXE_LINKER_FLAGS=${<wbr>linkflgs} \<br>
>     $SRC<br>
<br>
</span>Is BUILD_COMPILER/bin the result of a previous non-LTO build of trunk?<br></blockquote><div><br></div><div>Yes. The version mentioned at the top: clang version 3.9.1 (branches/release_39 281767)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
If any of you have suggestions what to omit from the above flags, I'm<br>
open to suggestions. This is the culmination of trying to replicate<br>
the previous autoconf flags. It's not an exact mapping, but almost.<br>
<span class="gmail-"><br>
> The changes from your config:<br>
> 1) Used llvm-ar and llvm-nm from the build compiler. I noticed that<br>
> you are specifying those as coming from the same directory used for<br>
> CMAKE_INSTALL_PREFIX, which seems wrong - that is where the compiler<br>
> built here will be installed.<br>
<br>
</span>That's because I'm reusing the previous built 3.9_release (without<br>
LTO) and I move it away after the build before running ninja install<br>
to the same location after extending PATH with the locally moved tree<br>
of the previously installed PREFIX for llvm.<br>
<br>
Is that a problem?<br></blockquote><div><br></div><div>Not sure I followed that, but in essence you just want to make sure that llvm-ranlib and llvm-ar match the build compiler.</div><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 class="gmail-"><br>
> 2) Used my own binutils checkout as I don't have plugin-api.h<br>
> installed in /usr/include<br>
<br>
</span>Curious, is your host binutils too old for that to exist in<br>
/usr/include?<br></blockquote><div><br></div><div>I guess - I always use my own version of binutils.</div><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 class="gmail-"><br>
> 3) Set BUILD_SHARED_LIBS=ON (which I don't see in your earlier<br>
> config, did you add that later?)<br>
<br>
</span>What I emailed earlier was the full set of flags passed to cmake, and<br>
I had just added SHARED_LIBS=OFF as suggested for the next rebuild.<br>
<br>
Should I use ON or OFF?<br></blockquote><div><br></div><div>I used ON to try to reproduce your issue, the OFF was a suggestion to avoid it as a workaround. I'm surprised your build defaults this to ON, according to <a href="http://llvm.org/docs/CMake.html">http://llvm.org/docs/CMake.html</a> it defaults to OFF.</div><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 class="gmail-"><br>
> 4) Set LLVM_PARALLEL_LINK_JOBS=1 (probably not needed)<br>
<br>
</span>I'll try this next time, just to see how much of a difference it makes<br>
when I run with with -j4.<br>
<span class="gmail-"><br>
> 5) Build with -w, to avoid occasional issues with warnings only<br>
> emitted by clang (probably not needed)<br>
> 6) Specified CMAKE_C_COMPILER and CMAKE_CXX_COMPILER explicitly (you<br>
> might have had the right versions in your path?)<br>
<br>
</span>I've exported CXX and CC to clang++ and clang, which happen to be the<br>
locally build 3.9 release branch versions (non-LTO variant).<br></blockquote><div><br></div><div>Ok</div><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 class="gmail-"><br>
> I did an nm on the .so libraries to see where __morestack was<br>
> referenced and its linkage. No surprise, it is coming from<br>
> libLLVMRuntimeDyld.so, and I do see it as weak as expected:<br>
><br>
> $ nm lib/libLLVMRuntimeDyld.so | grep morestack<br>
>                  w __morestack<br>
><br>
> Can you do the above nm on your lib/libLLVMRuntimeDyld.so and send<br>
> me the output?<br>
<br>
</span>In the unfinished build dir I only have lib/libLLVMRuntimedyld.a.<br></blockquote><div><br></div><div>This is from your SHARED_LIBS=OFF build I assume? With the build containing the DSO error I'm assuming BUILD_SHARED_LIBS=ON, which would mean this should be a .so. </div><div><br></div><div>If this archive is from the build getting the DSO error then I'm confused about which DSO is giving the error. In that case what does the link line look like?</div><div><br></div><div>Teresa</div><div><br></div></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><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)"> 408-460-2413</td></tr></tbody></table></span></div>
</div></div>