summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Nagy <robert@cvs.openbsd.org>2018-09-11 18:06:34 +0000
committerRobert Nagy <robert@cvs.openbsd.org>2018-09-11 18:06:34 +0000
commit8fd983382461d4a630dd0ae5d97eac0316f5d3e6 (patch)
tree7da434cc4416d3051aa213fbbeccfabed43403a9 /lib
parent62f72299364d95956e8c0b43fef08e0865f164e5 (diff)
import of libc++abi 6.0.0
Diffstat (limited to 'lib')
-rw-r--r--lib/libcxxabi/cmake/Modules/HandleCompilerRT.cmake6
-rw-r--r--lib/libcxxabi/cmake/Modules/HandleOutOfTreeLLVM.cmake29
-rw-r--r--lib/libcxxabi/src/fallback_malloc.cpp7
-rw-r--r--lib/libcxxabi/src/include/refstring.h9
-rw-r--r--lib/libcxxabi/src/stdlib_exception.cpp31
-rw-r--r--lib/libcxxabi/src/stdlib_new_delete.cpp5
6 files changed, 50 insertions, 37 deletions
diff --git a/lib/libcxxabi/cmake/Modules/HandleCompilerRT.cmake b/lib/libcxxabi/cmake/Modules/HandleCompilerRT.cmake
index 1f953276df0..395c21ace66 100644
--- a/lib/libcxxabi/cmake/Modules/HandleCompilerRT.cmake
+++ b/lib/libcxxabi/cmake/Modules/HandleCompilerRT.cmake
@@ -8,16 +8,12 @@ function(find_compiler_rt_library name dest)
if (CMAKE_CXX_COMPILER_ID MATCHES Clang AND CMAKE_CXX_COMPILER_TARGET)
list(APPEND CLANG_COMMAND "--target=${CMAKE_CXX_COMPILER_TARGET}")
endif()
- get_property(LIBCXXABI_CXX_FLAGS CACHE CMAKE_CXX_FLAGS PROPERTY VALUE)
- string(REPLACE " " ";" LIBCXXABI_CXX_FLAGS "${LIBCXXABI_CXX_FLAGS}")
- list(APPEND CLANG_COMMAND ${LIBCXXABI_CXX_FLAGS})
execute_process(
COMMAND ${CLANG_COMMAND}
RESULT_VARIABLE HAD_ERROR
OUTPUT_VARIABLE LIBRARY_FILE
)
string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE)
- file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE)
string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}")
if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}")
message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}")
@@ -41,7 +37,6 @@ function(find_compiler_rt_dir dest)
OUTPUT_VARIABLE LIBRARY_DIR
)
string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR)
- file(TO_CMAKE_PATH "${LIBRARY_DIR}" LIBRARY_DIR)
set(LIBRARY_DIR "${LIBRARY_DIR}/darwin")
else()
set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXXABI_COMPILE_FLAGS}
@@ -52,7 +47,6 @@ function(find_compiler_rt_dir dest)
OUTPUT_VARIABLE LIBRARY_FILE
)
string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE)
- file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE)
get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY)
endif()
if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}")
diff --git a/lib/libcxxabi/cmake/Modules/HandleOutOfTreeLLVM.cmake b/lib/libcxxabi/cmake/Modules/HandleOutOfTreeLLVM.cmake
index 0283a59ac1d..8e742088978 100644
--- a/lib/libcxxabi/cmake/Modules/HandleOutOfTreeLLVM.cmake
+++ b/lib/libcxxabi/cmake/Modules/HandleOutOfTreeLLVM.cmake
@@ -46,11 +46,10 @@ macro(find_llvm_parts)
OUTPUT_VARIABLE CONFIG_OUTPUT
ERROR_QUIET)
if(NOT HAD_ERROR)
- string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG)
- file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH)
+ string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH)
else()
- file(TO_CMAKE_PATH "${LLVM_BINARY_DIR}" LLVM_BINARY_DIR_CMAKE_STYLE)
- set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+ set(LLVM_CMAKE_PATH
+ "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
endif()
else()
set(LLVM_FOUND OFF)
@@ -108,22 +107,14 @@ macro(configure_out_of_tree_llvm)
set(LLVM_ENABLE_SPHINX OFF)
endif()
- # In a standalone build, we don't have llvm to automatically generate the
- # llvm-lit script for us. So we need to provide an explicit directory that
- # the configurator should write the script into.
- set(LLVM_LIT_OUTPUT_DIR "${libcxxabi_BINARY_DIR}/bin")
-
- if (LLVM_INCLUDE_TESTS)
- # Required LIT Configuration ------------------------------------------------
- # Define the default arguments to use with 'lit', and an option for the user
- # to override.
- set(LLVM_DEFAULT_EXTERNAL_LIT "${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py")
- set(LIT_ARGS_DEFAULT "-sv --show-xfail --show-unsupported")
- if (MSVC OR XCODE)
- set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
- endif()
- set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
+ # Required LIT Configuration ------------------------------------------------
+ # Define the default arguments to use with 'lit', and an option for the user
+ # to override.
+ set(LIT_ARGS_DEFAULT "-sv --show-xfail --show-unsupported")
+ if (MSVC OR XCODE)
+ set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
endif()
+ set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
# Required doc configuration
if (LLVM_ENABLE_SPHINX)
diff --git a/lib/libcxxabi/src/fallback_malloc.cpp b/lib/libcxxabi/src/fallback_malloc.cpp
index 202a46732a3..336ad31b017 100644
--- a/lib/libcxxabi/src/fallback_malloc.cpp
+++ b/lib/libcxxabi/src/fallback_malloc.cpp
@@ -7,9 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// Define _LIBCPP_BUILDING_LIBRARY to ensure _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
-// is only defined when libc aligned allocation is not available.
-#define _LIBCPP_BUILDING_LIBRARY
#include "fallback_malloc.h"
#include <__threading_support>
@@ -209,14 +206,14 @@ void* __aligned_malloc_with_fallback(size_t size) {
#if defined(_WIN32)
if (void* dest = _aligned_malloc(size, alignof(__aligned_type)))
return dest;
-#elif defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION)
+#elif defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
if (void* dest = std::malloc(size))
return dest;
#else
if (size == 0)
size = 1;
void* dest;
- if (::posix_memalign(&dest, __alignof(__aligned_type), size) == 0)
+ if (::posix_memalign(&dest, alignof(__aligned_type), size) == 0)
return dest;
#endif
return fallback_malloc(size);
diff --git a/lib/libcxxabi/src/include/refstring.h b/lib/libcxxabi/src/include/refstring.h
index 69f6747e125..bc131aeb5ae 100644
--- a/lib/libcxxabi/src/include/refstring.h
+++ b/lib/libcxxabi/src/include/refstring.h
@@ -22,7 +22,6 @@
#include <dlfcn.h>
#include <mach-o/dyld.h>
#endif
-#include "atomic_support.h"
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -88,7 +87,7 @@ __libcpp_refstring::__libcpp_refstring(const __libcpp_refstring &s) _NOEXCEPT
: __imp_(s.__imp_)
{
if (__uses_refcount())
- __libcpp_atomic_add(&rep_from_data(__imp_)->count, 1);
+ __sync_add_and_fetch(&rep_from_data(__imp_)->count, 1);
}
inline
@@ -97,10 +96,10 @@ __libcpp_refstring& __libcpp_refstring::operator=(__libcpp_refstring const& s) _
struct _Rep_base *old_rep = rep_from_data(__imp_);
__imp_ = s.__imp_;
if (__uses_refcount())
- __libcpp_atomic_add(&rep_from_data(__imp_)->count, 1);
+ __sync_add_and_fetch(&rep_from_data(__imp_)->count, 1);
if (adjust_old_count)
{
- if (__libcpp_atomic_add(&old_rep->count, count_t(-1)) < 0)
+ if (__sync_add_and_fetch(&old_rep->count, count_t(-1)) < 0)
{
::operator delete(old_rep);
}
@@ -112,7 +111,7 @@ inline
__libcpp_refstring::~__libcpp_refstring() {
if (__uses_refcount()) {
_Rep_base* rep = rep_from_data(__imp_);
- if (__libcpp_atomic_add(&rep->count, count_t(-1)) < 0) {
+ if (__sync_add_and_fetch(&rep->count, count_t(-1)) < 0) {
::operator delete(rep);
}
}
diff --git a/lib/libcxxabi/src/stdlib_exception.cpp b/lib/libcxxabi/src/stdlib_exception.cpp
index 0308e169a83..a8f71ab0ecc 100644
--- a/lib/libcxxabi/src/stdlib_exception.cpp
+++ b/lib/libcxxabi/src/stdlib_exception.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#define _LIBCPP_BUILDING_LIBRARY
+#define _LIBCPP_BUILDING_NEW
#include <new>
#include <exception>
@@ -69,4 +70,34 @@ bad_array_new_length::what() const _NOEXCEPT
return "bad_array_new_length";
}
+// bad_array_length
+
+#ifndef _LIBCPP_BAD_ARRAY_LENGTH_DEFINED
+
+class _LIBCPP_EXCEPTION_ABI bad_array_length
+ : public bad_alloc
+{
+public:
+ bad_array_length() _NOEXCEPT;
+ virtual ~bad_array_length() _NOEXCEPT;
+ virtual const char* what() const _NOEXCEPT;
+};
+
+#endif // _LIBCPP_BAD_ARRAY_LENGTH_DEFINED
+
+bad_array_length::bad_array_length() _NOEXCEPT
+{
+}
+
+bad_array_length::~bad_array_length() _NOEXCEPT
+{
+}
+
+const char*
+bad_array_length::what() const _NOEXCEPT
+{
+ return "bad_array_length";
+}
+
+
} // std
diff --git a/lib/libcxxabi/src/stdlib_new_delete.cpp b/lib/libcxxabi/src/stdlib_new_delete.cpp
index bbd90a5b26d..0e85f6ad299 100644
--- a/lib/libcxxabi/src/stdlib_new_delete.cpp
+++ b/lib/libcxxabi/src/stdlib_new_delete.cpp
@@ -9,6 +9,7 @@
// This file implements the new and delete operators.
//===----------------------------------------------------------------------===//
+#define _LIBCPP_BUILDING_NEW
#define _LIBCPP_BUILDING_LIBRARY
#include "__cxxabi_config.h"
#include <new>
@@ -134,7 +135,7 @@ operator delete[] (void* ptr, size_t) _NOEXCEPT
::operator delete[](ptr);
}
-#if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION)
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
_LIBCXXABI_WEAK
void *
@@ -260,4 +261,4 @@ operator delete[] (void* ptr, size_t, std::align_val_t alignment) _NOEXCEPT
::operator delete[](ptr, alignment);
}
-#endif // !_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
+#endif // !_LIBCPP_HAS_NO_ALIGNED_ALLOCATION