[libcxxabi] r228408 - unwind: use -fno-rtti -fno-exceptions -funwind-tables
Sergey Dmitrouk
sdmitrouk at accesssoftek.com
Wed Feb 11 12:21:51 PST 2015
Hi,
Although code compiles and works in most cases, part of this change (namely
addition of `-fno-exceptions` flag) seems to break exception handling on ARM.
E.g. `catch` doesn't work in this example and `std::terminate()` is invoked:
int main(void)
{
try
{
throw 1;
}
catch (int)
{
}
return 0;
}
Is it possible that `-fno-exceptions` makes Clang skip generation of
some auxiliary data, which results in such strange behaviour?
It's not just about `int` type, class types were not caught as well even
with `catch (...)` statement. In fact almost all tests under
test-suite/SingleSource/Regression/C++/EH failed.
Anyone else seeing this? libcxxabi is used with LLVM, Clang, compiler-rt
and libcxx here.
Regards,
Sergey
On Fri, Feb 06, 2015 at 09:47:57AM -0800, Saleem Abdulrasool wrote:
> Author: compnerd
> Date: Fri Feb 6 11:47:57 2015
> New Revision: 228408
>
> URL: http://llvm.org/viewvc/llvm-project?rev=228408&view=rev
> Log:
> unwind: use -fno-rtti -fno-exceptions -funwind-tables
>
> RTTI and exceptions are not needed for the unwinder, the use of C++ there is for
> very specific cases, and does not require dynamic_cast nor does it use
> exceptions. This avoids unnecessary references to type information being
> emitted.
>
> Modified:
> libcxxabi/trunk/cmake/config-ix.cmake
> libcxxabi/trunk/src/Unwind/CMakeLists.txt
>
> Modified: libcxxabi/trunk/cmake/config-ix.cmake
> URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/cmake/config-ix.cmake?rev=228408&r1=228407&r2=228408&view=diff
> ==============================================================================
> --- libcxxabi/trunk/cmake/config-ix.cmake (original)
> +++ libcxxabi/trunk/cmake/config-ix.cmake Fri Feb 6 11:47:57 2015
> @@ -5,6 +5,8 @@ include(CheckCXXCompilerFlag)
> # Check compiler flags
> check_c_compiler_flag(-funwind-tables LIBCXXABI_HAS_FUNWIND_TABLES)
> check_cxx_compiler_flag(-fPIC LIBCXXABI_HAS_FPIC_FLAG)
> +check_cxx_compiler_flag(-fno-exceptions LIBCXXABI_HAS_NO_EXCEPTIONS_FLAG)
> +check_cxx_compiler_flag(-fno-rtti LIBCXXABI_HAS_NO_RTTI_FLAG)
> check_cxx_compiler_flag(-fstrict-aliasing LIBCXXABI_HAS_FSTRICT_ALIASING_FLAG)
> check_cxx_compiler_flag(-nodefaultlibs LIBCXXABI_HAS_NODEFAULTLIBS_FLAG)
> check_cxx_compiler_flag(-nostdinc++ LIBCXXABI_HAS_NOSTDINCXX_FLAG)
>
> Modified: libcxxabi/trunk/src/Unwind/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/CMakeLists.txt?rev=228408&r1=228407&r2=228408&view=diff
> ==============================================================================
> --- libcxxabi/trunk/src/Unwind/CMakeLists.txt (original)
> +++ libcxxabi/trunk/src/Unwind/CMakeLists.txt Fri Feb 6 11:47:57 2015
> @@ -68,6 +68,11 @@ target_link_libraries(unwind ${libraries
> append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_FPIC_FLAG -fPIC)
> append_if(LIBCXXABI_LINK_FLAGS LIBCXXABI_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
>
> +set(LIBUNWIND_COMPILE_FLAGS)
> +append_if(LIBUNWIND_COMPILE_FLAGS LIBCXXABI_HAS_NO_EXCEPTIONS_FLAG -fno-exceptions)
> +append_if(LIBUNWIND_COMPILE_FLAGS LIBCXXABI_HAS_NO_RTTI_FLAG -fno-rtti)
> +append_if(LIBUNWIND_COMPILE_FLAGS LIBCXXABI_HAS_FUNWIND_TABLES -funwind-tables)
> +
> set(LIBCXXABI_UNWINDER_NAME "unwind")
>
> if ( APPLE )
> @@ -86,11 +91,12 @@ if ( APPLE )
> endif()
>
> string(REPLACE ";" " " LIBCXXABI_COMPILE_FLAGS "${LIBCXXABI_COMPILE_FLAGS}")
> +string(REPLACE ";" " " LIBUNWIND_COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}")
> string(REPLACE ";" " " LIBCXXABI_LINK_FLAGS "${LIBCXXABI_LINK_FLAGS}")
>
> set_target_properties(unwind
> PROPERTIES
> - COMPILE_FLAGS "${LIBCXXABI_COMPILE_FLAGS}"
> + COMPILE_FLAGS "${LIBCXXABI_COMPILE_FLAGS} ${LIBUNWIND_COMPILE_FLAGS}"
> LINK_FLAGS "${LIBCXXABI_LINK_FLAGS}"
> OUTPUT_NAME "${LIBCXXABI_UNWINDER_NAME}"
> VERSION "1.0"
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list