<div dir="ltr">On Fri, Feb 13, 2015 at 11:02 AM, 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">There is no need to revert it completely, not adding -fno-exceptions if<br>
-funwind-tables is not available should be enough.  This is a workaround<br>
for CMake issue, but is also a correct thing to do by itself.<br>
Specifying one option without another literally breaks libunwind, these<br>
options dependent on each other and should either be both applied or<br>
none of them should be applied.</blockquote><div><br></div><div>How about doing that along with a check that if you are building a DSO aborting the build with an error that it is unsupported?</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 Fri, Feb 13, 2015 at 10:48:14AM -0800, Anton Korobeynikov wrote:<br>
> Since the stuff is heavily broken at this moment, shall we revert the<br>
> detection stuff for a moment?<br>
><br>
> On Fri, Feb 13, 2015 at 7:36 PM, Saleem Abdulrasool<br>
> <<a href="mailto:compnerd@compnerd.org">compnerd@compnerd.org</a>> wrote:<br>
> > On Thu, Feb 12, 2015 at 1:13 PM, Sergey Dmitrouk<br>
> > <<a href="mailto:sdmitrouk@accesssoftek.com">sdmitrouk@accesssoftek.com</a>> wrote:<br>
> >><br>
> >> How about the attached patch?  Seems to work for me (it's trivial, but<br>
> >> syntax is weird, so I wasn't sure).<br>
> ><br>
> ><br>
> > It would prevent building unwind as a DSO without libc++abi linked in, so,<br>
> > this isn't the way to handle this.  I think you need to tweak the detection<br>
> > of the -funwind-tables option.<br>
> ><br>
> >><br>
> >><br>
> >> --<br>
> >> Sergey<br>
> >><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<br>
> >> > "_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>
> >> ><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<br>
> >> > that's<br>
> >> > what is being built).  Now here:<br>
> >> ><br>
> >> >     append_if(LIBUNWIND_COMPILE_FLAGS LIBCXXABI_HAS_NO_EXCEPTIONS_FLAG<br>
> >> > -fno-exceptions)<br>
> >> >     append_if(LIBUNWIND_COMPILE_FLAGS LIBCXXABI_HAS_NO_RTTI_FLAG<br>
> >> > -fno-rtti)<br>
> >> >     append_if(LIBUNWIND_COMPILE_FLAGS LIBCXXABI_HAS_FUNWIND_TABLES<br>
> >> > -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<br>
> >> > seems<br>
> >> > to be reasonable by itself, but will also work around this issue with<br>
> >> > CMake.<br>
> >> ><br>
> >> > --<br>
> >> > Sergey<br>
> ><br>
> > --<br>
> > Saleem Abdulrasool<br>
> > compnerd (at) compnerd (dot) org<br>
> ><br>
> > ____________<br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> --<br>
> With best regards, Anton Korobeynikov<br>
> Faculty of Mathematics and Mechanics, Saint Petersburg State University<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>