[libcxxabi] Introduce a -fno-exceptions libc++abi libary variant

Currently there is only support for a -fno-exceptions libc++ build. This is
problematic for functions such as std::terminate() which are defined in
libc++abi and using any of those functions throws away most of the benefits
of using -fno-exceptions (code-size). This patch introduces a -fno-exceptions
libc++abi build to address this issue.

This new variant of libc++abi cannot be linked against any with-exceptions
code as some symbols necessary for handling exceptions are missing in this
library.

Differential revision: http://reviews.llvm.org/D20677

Reviewers: EricWF, mclow.lists, bcraig

git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@271267 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/src/cxa_aux_runtime.cpp b/src/cxa_aux_runtime.cpp
index a455fad..bb7c9f1 100644
--- a/src/cxa_aux_runtime.cpp
+++ b/src/cxa_aux_runtime.cpp
@@ -17,16 +17,28 @@
 namespace __cxxabiv1 {
 extern "C" {
 _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_cast(void) {
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
   throw std::bad_cast();
+#else
+  std::terminate();
+#endif
 }
 
 _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_typeid(void) {
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
   throw std::bad_typeid();
+#else
+  std::terminate();
+#endif
 }
 
 _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void
 __cxa_throw_bad_array_new_length(void) {
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
   throw std::bad_array_new_length();
+#else
+  std::terminate();
+#endif
 }
 } // extern "C"
 } // abi