<div dir="ltr">On Thu, Feb 12, 2015 at 1:13 PM, Sergey Dmitrouk <span dir="ltr"><<a href="mailto:sdmitrouk@accesssoftek.com" target="_blank">sdmitrouk@accesssoftek.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">How about the attached patch?  Seems to work for me (it's trivial, but<br>
syntax is weird, so I wasn't sure).</blockquote><div><br></div><div>It would prevent building unwind as a DSO without libc++abi linked in, so, this isn't the way to handle this.  I think you need to tweak the detection of the -funwind-tables option.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888"><br>
--<br>
Sergey<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Thu, Feb 12, 2015 at 07:36:14AM -0800, Sergey Dmitrouk wrote:<br>
> On Thu, Feb 12, 2015 at 07:13:09AM -0800, Saleem Abdulrasool wrote:<br>
> >    I've been successful with clang as well.<br>
> >    Reproduction steps would help in identifying what is happening.<br>
><br>
> Looks like I found the culprit, it's CMake.  I'm cross compiling<br>
> libcxxabi for ARM on x86_64 host, compiler targets ARM only (so ARM is<br>
> also the default target).  cmake/config-ix.cmake contains (also note "_c_"<br>
> instead of "_cxx_", but it doesn't affect results):<br>
><br>
>     check_c_compiler_flag(-funwind-tables LIBCXXABI_HAS_FUNWIND_TABLES)<br>
><br>
> This test fails on linking stage:<br>
><br>
>     CMakeFiles/cmTryCompileExec3829915952.dir/src.cxx.o:(.ARM.exidx+0x0):<br>
>     undefined reference to `__aeabi_unwind_cpp_pr0'<br>
><br>
> because successful linking requires symbol defined in libunwind (and that's<br>
> what is being built).  Now here:<br>
><br>
>     append_if(LIBUNWIND_COMPILE_FLAGS LIBCXXABI_HAS_NO_EXCEPTIONS_FLAG -fno-exceptions)<br>
>     append_if(LIBUNWIND_COMPILE_FLAGS LIBCXXABI_HAS_NO_RTTI_FLAG -fno-rtti)<br>
>     append_if(LIBUNWIND_COMPILE_FLAGS LIBCXXABI_HAS_FUNWIND_TABLES -funwind-tables)<br>
><br>
> `-fno-exceptions` is added, but not `-funwind-tables`.  As a result<br>
> libunwind sees "can't unwind" marker in exidx records and gives up.<br>
><br>
> I found this bug report, which seems to be related:<br>
>     <a href="http://www.cmake.org/Bug/view.php?id=15264" target="_blank">http://www.cmake.org/Bug/view.php?id=15264</a><br>
><br>
> Not adding `-fno-exceptions` flag if `-funwind-tables` isn't available seems<br>
> to be reasonable by itself, but will also work around this issue with CMake.<br>
><br>
> --<br>
> Sergey<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Saleem Abdulrasool<br>compnerd (at) compnerd (dot) org</div>
</div></div>