[libcxxabi] r228408 - unwind: use -fno-rtti -fno-exceptions -funwind-tables

Sergey Dmitrouk sdmitrouk at accesssoftek.com
Fri Feb 13 14:12:08 PST 2015


On Fri, Feb 13, 2015 at 01:40:58PM -0800, Saleem Abdulrasool wrote:
>    On Fri, Feb 13, 2015 at 11:02 AM, Sergey Dmitrouk
>    <sdmitrouk at accesssoftek.com> wrote:
>
>      There is no need to revert it completely, not adding -fno-exceptions if
>      -funwind-tables is not available should be enough.A  This is a
>      workaround
>      for CMake issue, but is also a correct thing to do by itself.
>      Specifying one option without another literally breaks libunwind, these
>      options dependent on each other and should either be both applied or
>      none of them should be applied.
>
>    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?

Sounds fine to me.

As for -funwind-table flag check, it seems to require changes in CMake or
doing the check manually via custom macro.  No easy way around it.

-- 
Sergey

>      --
>      Sergey
>      On Fri, Feb 13, 2015 at 10:48:14AM -0800, Anton Korobeynikov wrote:
>      > Since the stuff is heavily broken at this moment, shall we revert the
>      > detection stuff for a moment?
>      >
>      > On Fri, Feb 13, 2015 at 7:36 PM, Saleem Abdulrasool
>      > <compnerd at compnerd.org> wrote:
>      > > On Thu, Feb 12, 2015 at 1:13 PM, Sergey Dmitrouk
>      > > <sdmitrouk at accesssoftek.com> wrote:
>      > >>
>      > >> How about the attached patch?A  Seems to work for me (it's trivial,
>      but
>      > >> syntax is weird, so I wasn't sure).
>      > >
>      > >
>      > > It would prevent building unwind as a DSO without libc++abi linked
>      in, so,
>      > > this isn't the way to handle this.A  I think you need to tweak the
>      detection
>      > > of the -funwind-tables option.
>      > >
>      > >>
>      > >>
>      > >> --
>      > >> Sergey
>      > >>
>      > >> On Thu, Feb 12, 2015 at 07:36:14AM -0800, Sergey Dmitrouk wrote:
>      > >> > On Thu, Feb 12, 2015 at 07:13:09AM -0800, Saleem Abdulrasool
>      wrote:
>      > >> > >A  A  I've been successful with clang as well.
>      > >> > >A  A  Reproduction steps would help in identifying what is
>      happening.
>      > >> >
>      > >> > Looks like I found the culprit, it's CMake.A  I'm cross compiling
>      > >> > libcxxabi for ARM on x86_64 host, compiler targets ARM only (so
>      ARM is
>      > >> > also the default target).A  cmake/config-ix.cmake contains (also
>      note
>      > >> > "_c_"
>      > >> > instead of "_cxx_", but it doesn't affect results):
>      > >> >
>      > >> >A  A  A check_c_compiler_flag(-funwind-tables
>      LIBCXXABI_HAS_FUNWIND_TABLES)
>      > >> >
>      > >> > This test fails on linking stage:
>      > >> >
>      > >> >
>      > >> >
>      CMakeFiles/cmTryCompileExec3829915952.dir/src.cxx.o:(.ARM.exidx+0x0):
>      > >> >A  A  A undefined reference to `__aeabi_unwind_cpp_pr0'
>      > >> >
>      > >> > because successful linking requires symbol defined in libunwind
>      (and
>      > >> > that's
>      > >> > what is being built).A  Now here:
>      > >> >
>      > >> >A  A  A append_if(LIBUNWIND_COMPILE_FLAGS
>      LIBCXXABI_HAS_NO_EXCEPTIONS_FLAG
>      > >> > -fno-exceptions)
>      > >> >A  A  A append_if(LIBUNWIND_COMPILE_FLAGS
>      LIBCXXABI_HAS_NO_RTTI_FLAG
>      > >> > -fno-rtti)
>      > >> >A  A  A append_if(LIBUNWIND_COMPILE_FLAGS
>      LIBCXXABI_HAS_FUNWIND_TABLES
>      > >> > -funwind-tables)
>      > >> >
>      > >> > `-fno-exceptions` is added, but not `-funwind-tables`.A  As a
>      result
>      > >> > libunwind sees "can't unwind" marker in exidx records and gives
>      up.
>      > >> >
>      > >> > I found this bug report, which seems to be related:
>      > >> >A  A  A http://www.cmake.org/Bug/view.php?id=15264
>      > >> >
>      > >> > Not adding `-fno-exceptions` flag if `-funwind-tables` isn't
>      available
>      > >> > seems
>      > >> > to be reasonable by itself, but will also work around this issue
>      with
>      > >> > CMake.
>      > >> >
>      > >> > --
>      > >> > Sergey
>      > >
>      > > --
>      > > Saleem Abdulrasool
>      > > compnerd (at) compnerd (dot) org
>      > >
>      > > ____________
>      >
>      > --
>      > With best regards, Anton Korobeynikov
>      > Faculty of Mathematics and Mechanics, Saint Petersburg State
>      University
>
>    --
>    Saleem Abdulrasool
>    compnerd (at) compnerd (dot) org



More information about the cfe-commits mailing list