diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2019-02-04 16:54:31 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2019-02-04 16:54:31 +0000 |
commit | 64c990ad42e952ac3079d7c86db9c36a5be1ff4b (patch) | |
tree | 1eaff83e8870a253b85483118868eca390242a93 /lib | |
parent | 3e79e4169ef6258bd8428545b8028a4b478ca1fe (diff) |
Import libunwind 7.0.1
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libunwind/CMakeLists.txt | 39 | ||||
-rw-r--r-- | lib/libunwind/LICENSE.TXT | 2 | ||||
-rw-r--r-- | lib/libunwind/cmake/Modules/HandleCompilerRT.cmake | 3 | ||||
-rw-r--r-- | lib/libunwind/src/CMakeLists.txt | 23 | ||||
-rw-r--r-- | lib/libunwind/src/UnwindLevel1-gcc-ext.c | 14 | ||||
-rw-r--r-- | lib/libunwind/src/UnwindLevel1.c | 2 | ||||
-rw-r--r-- | lib/libunwind/src/assembly.h | 11 | ||||
-rw-r--r-- | lib/libunwind/src/config.h | 6 |
8 files changed, 72 insertions, 28 deletions
diff --git a/lib/libunwind/CMakeLists.txt b/lib/libunwind/CMakeLists.txt index 7b5a0919a6e..0e48d713837 100644 --- a/lib/libunwind/CMakeLists.txt +++ b/lib/libunwind/CMakeLists.txt @@ -59,10 +59,11 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) OUTPUT_VARIABLE CONFIG_OUTPUT ERROR_QUIET) if(NOT HAD_ERROR) - string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG) + file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH) else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + 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") endif() else() message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. " @@ -79,7 +80,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) endif() set(PACKAGE_NAME libunwind) - set(PACKAGE_VERSION 6.0.0) + set(PACKAGE_VERSION 7.0.0) set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "llvm-bugs@lists.llvm.org") @@ -118,6 +119,7 @@ endif() #=============================================================================== # Setup CMake Options #=============================================================================== +include(CMakeDependentOption) include(HandleCompilerRT) # Define options. @@ -136,9 +138,19 @@ option(LIBUNWIND_INCLUDE_DOCS "Build the libunwind documentation." ${LLVM_INCLUD set(LIBUNWIND_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING "Define suffix of library directory name (32/64)") option(LIBUNWIND_INSTALL_LIBRARY "Install the libunwind library." ON) +cmake_dependent_option(LIBUNWIND_INSTALL_STATIC_LIBRARY + "Install the static libunwind library." ON + "LIBUNWIND_ENABLE_STATIC;LIBUNWIND_INSTALL_LIBRARY" OFF) +cmake_dependent_option(LIBUNWIND_INSTALL_SHARED_LIBRARY + "Install the shared libunwind library." ON + "LIBUNWIND_ENABLE_SHARED;LIBUNWIND_INSTALL_LIBRARY" OFF) set(LIBUNWIND_TARGET_TRIPLE "" CACHE STRING "Target triple for cross compiling.") set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.") set(LIBUNWIND_SYSROOT "" CACHE PATH "Sysroot for cross compiling.") +set(LIBUNWIND_TEST_LINKER_FLAGS "" CACHE STRING + "Additional linker flags for test programs.") +set(LIBUNWIND_TEST_COMPILER_FLAGS "" CACHE STRING + "Additional compiler flags for test programs.") if (NOT LIBUNWIND_ENABLE_SHARED AND NOT LIBUNWIND_ENABLE_STATIC) message(FATAL_ERROR "libunwind must be built as either a shared or static library.") @@ -165,7 +177,14 @@ set(CMAKE_MODULE_PATH set(LIBUNWIND_COMPILER ${CMAKE_CXX_COMPILER}) set(LIBUNWIND_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(LIBUNWIND_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) -if (LLVM_LIBRARY_OUTPUT_INTDIR) + +string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION + ${PACKAGE_VERSION}) + +if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) + set(DEFAULT_INSTALL_PREFIX lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/) + set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/lib${LIBUNWIND_LIBDIR_SUFFIX}) +elseif(LLVM_LIBRARY_OUTPUT_INTDIR) set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) else() set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX}) @@ -175,13 +194,9 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR}) -set(LIBUNWIND_INSTALL_PREFIX "" CACHE STRING +set(LIBUNWIND_INSTALL_PREFIX ${DEFAULT_INSTALL_PREFIX} CACHE STRING "Define libunwind destination prefix.") -if (NOT LIBUNWIND_INSTALL_PREFIX MATCHES "^$|.*/") - message(FATAL_ERROR "LIBUNWIND_INSTALL_PREFIX has to end with \"/\".") -endif() - set(LIBUNWIND_C_FLAGS "") set(LIBUNWIND_CXX_FLAGS "") set(LIBUNWIND_COMPILE_FLAGS "") @@ -328,8 +343,10 @@ find_path( __libcpp_version PATHS ${LLVM_MAIN_SRC_DIR}/projects/libcxx/include ${LLVM_MAIN_SRC_DIR}/runtimes/libcxx/include + ${LLVM_MAIN_SRC_DIR}/../libcxx/include NO_DEFAULT_PATH -) + NO_CMAKE_FIND_ROOT_PATH + ) if ((NOT LIBUNWIND_STANDALONE_BUILD OR HAVE_LIBCXX) AND IS_DIRECTORY "${LIBUNWIND_LIBCXX_INCLUDES_INTERNAL}") set(LIBUNWIND_CXX_INCLUDE_PATHS_DEFAULT "${LIBUNWIND_LIBCXX_INCLUDES_INTERNAL}") diff --git a/lib/libunwind/LICENSE.TXT b/lib/libunwind/LICENSE.TXT index fb77e1b74a0..9603fbaca22 100644 --- a/lib/libunwind/LICENSE.TXT +++ b/lib/libunwind/LICENSE.TXT @@ -14,7 +14,7 @@ Full text of the relevant licenses is included below. University of Illinois/NCSA Open Source License -Copyright (c) 2009-2017 by the contributors listed in CREDITS.TXT +Copyright (c) 2009-2018 by the contributors listed in CREDITS.TXT All rights reserved. diff --git a/lib/libunwind/cmake/Modules/HandleCompilerRT.cmake b/lib/libunwind/cmake/Modules/HandleCompilerRT.cmake index 9bf88bb4c27..275243a1bc6 100644 --- a/lib/libunwind/cmake/Modules/HandleCompilerRT.cmake +++ b/lib/libunwind/cmake/Modules/HandleCompilerRT.cmake @@ -14,6 +14,7 @@ function(find_compiler_rt_library name dest) 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}") @@ -37,6 +38,7 @@ 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} ${LIBUNWIND_COMPILE_FLAGS} @@ -47,6 +49,7 @@ 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/libunwind/src/CMakeLists.txt b/lib/libunwind/src/CMakeLists.txt index 2d2ec130dfe..937159e2cb8 100644 --- a/lib/libunwind/src/CMakeLists.txt +++ b/lib/libunwind/src/CMakeLists.txt @@ -91,9 +91,9 @@ string(REPLACE ";" " " LIBUNWIND_C_FLAGS "${LIBUNWIND_C_FLAGS}") string(REPLACE ";" " " LIBUNWIND_LINK_FLAGS "${LIBUNWIND_LINK_FLAGS}") set_property(SOURCE ${LIBUNWIND_CXX_SOURCES} - APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_CXX_FLAGS} ${LIBUNWIND_CXX_FLAGS}") + APPEND_STRING PROPERTY COMPILE_FLAGS " ${LIBUNWIND_CXX_FLAGS}") set_property(SOURCE ${LIBUNWIND_C_SOURCES} - APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_C_FLAGS} ${LIBUNWIND_C_FLAGS}") + APPEND_STRING PROPERTY COMPILE_FLAGS " ${LIBUNWIND_C_FLAGS}") # Add a object library that contains the compiled source files. add_library(unwind_objects OBJECT ${LIBUNWIND_SOURCES} ${LIBUNWIND_HEADERS}) @@ -103,11 +103,12 @@ set_target_properties(unwind_objects COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}" POSITION_INDEPENDENT_CODE ON) -set(LIBUNWIND_TARGETS) - # Build the shared library. if (LIBUNWIND_ENABLE_SHARED) add_library(unwind_shared SHARED $<TARGET_OBJECTS:unwind_objects>) + if(COMMAND llvm_setup_rpath) + llvm_setup_rpath(unwind_shared) + endif() target_link_libraries(unwind_shared ${libraries}) set_target_properties(unwind_shared PROPERTIES @@ -115,7 +116,10 @@ if (LIBUNWIND_ENABLE_SHARED) OUTPUT_NAME "unwind" VERSION "1.0" SOVERSION "1") - list(APPEND LIBUNWIND_TARGETS "unwind_shared") + list(APPEND LIBUNWIND_BUILD_TARGETS "unwind_shared") + if (LIBUNWIND_INSTALL_SHARED_LIBRARY) + list(APPEND LIBUNWIND_INSTALL_TARGETS "unwind_shared") + endif() endif() # Build the static library. @@ -126,14 +130,17 @@ if (LIBUNWIND_ENABLE_STATIC) PROPERTIES LINK_FLAGS "${LIBUNWIND_LINK_FLAGS}" OUTPUT_NAME "unwind") - list(APPEND LIBUNWIND_TARGETS "unwind_static") + list(APPEND LIBUNWIND_BUILD_TARGETS "unwind_static") + if (LIBUNWIND_INSTALL_STATIC_LIBRARY) + list(APPEND LIBUNWIND_INSTALL_TARGETS "unwind_static") + endif() endif() # Add a meta-target for both libraries. -add_custom_target(unwind DEPENDS ${LIBUNWIND_TARGETS}) +add_custom_target(unwind DEPENDS ${LIBUNWIND_BUILD_TARGETS}) if (LIBUNWIND_INSTALL_LIBRARY) - install(TARGETS ${LIBUNWIND_TARGETS} + install(TARGETS ${LIBUNWIND_INSTALL_TARGETS} LIBRARY DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind) endif() diff --git a/lib/libunwind/src/UnwindLevel1-gcc-ext.c b/lib/libunwind/src/UnwindLevel1-gcc-ext.c index 10619ba431d..38f141e381d 100644 --- a/lib/libunwind/src/UnwindLevel1-gcc-ext.c +++ b/lib/libunwind/src/UnwindLevel1-gcc-ext.c @@ -33,9 +33,9 @@ _Unwind_Resume_or_Rethrow(_Unwind_Exception *exception_object) { (void *)exception_object, (long)exception_object->unwinder_cache.reserved1); #else - _LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%ld", + _LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%" PRIdPTR, (void *)exception_object, - (long)exception_object->private_1); + (intptr_t)exception_object->private_1); #endif #if defined(_LIBUNWIND_ARM_EHABI) @@ -92,9 +92,9 @@ _LIBUNWIND_EXPORT void *_Unwind_FindEnclosingFunction(void *pc) { unw_proc_info_t info; unw_getcontext(&uc); unw_init_local(&cursor, &uc); - unw_set_reg(&cursor, UNW_REG_IP, (unw_word_t)(long) pc); + unw_set_reg(&cursor, UNW_REG_IP, (unw_word_t)(intptr_t) pc); if (unw_get_proc_info(&cursor, &info) == UNW_ESUCCESS) - return (void *)(long) info.start_ip; + return (void *)(intptr_t) info.start_ip; else return NULL; } @@ -190,14 +190,14 @@ _LIBUNWIND_EXPORT const void *_Unwind_Find_FDE(const void *pc, unw_proc_info_t info; unw_getcontext(&uc); unw_init_local(&cursor, &uc); - unw_set_reg(&cursor, UNW_REG_IP, (unw_word_t)(long) pc); + unw_set_reg(&cursor, UNW_REG_IP, (unw_word_t)(intptr_t) pc); unw_get_proc_info(&cursor, &info); bases->tbase = (uintptr_t)info.extra; bases->dbase = 0; // dbase not used on Mac OS X bases->func = (uintptr_t)info.start_ip; _LIBUNWIND_TRACE_API("_Unwind_Find_FDE(pc=%p) => %p", pc, - (void *)(long) info.unwind_info); - return (void *)(long) info.unwind_info; + (void *)(intptr_t) info.unwind_info); + return (void *)(intptr_t) info.unwind_info; } /// Returns the CFA (call frame area, or stack pointer at start of function) diff --git a/lib/libunwind/src/UnwindLevel1.c b/lib/libunwind/src/UnwindLevel1.c index 518577b1d50..04d62b8950f 100644 --- a/lib/libunwind/src/UnwindLevel1.c +++ b/lib/libunwind/src/UnwindLevel1.c @@ -287,7 +287,7 @@ unwind_phase2_forced(unw_context_t *uc, unw_cursor_t *cursor, // If there is a personality routine, tell it we are unwinding. if (frameInfo.handler != 0) { __personality_routine p = - (__personality_routine)(long)(frameInfo.handler); + (__personality_routine)(intptr_t)(frameInfo.handler); _LIBUNWIND_TRACE_UNWINDING( "unwind_phase2_forced(ex_ojb=%p): calling personality function %p", (void *)exception_object, (void *)(uintptr_t)p); diff --git a/lib/libunwind/src/assembly.h b/lib/libunwind/src/assembly.h index ba099cbe809..07b08f94bd8 100644 --- a/lib/libunwind/src/assembly.h +++ b/lib/libunwind/src/assembly.h @@ -18,6 +18,17 @@ #if defined(__powerpc64__) #define SEPARATOR ; +#define PPC64_OFFS_SRR0 0 +#define PPC64_OFFS_CR 272 +#define PPC64_OFFS_XER 280 +#define PPC64_OFFS_LR 288 +#define PPC64_OFFS_CTR 296 +#define PPC64_OFFS_VRSAVE 304 +#define PPC64_OFFS_FP 312 +#define PPC64_OFFS_V 824 +#ifdef _ARCH_PWR8 +#define PPC64_HAS_VMX +#endif #elif defined(__POWERPC__) || defined(__powerpc__) || defined(__ppc__) #define SEPARATOR @ #elif defined(__arm64__) diff --git a/lib/libunwind/src/config.h b/lib/libunwind/src/config.h index 2a2b5cf9265..1a7a30665dd 100644 --- a/lib/libunwind/src/config.h +++ b/lib/libunwind/src/config.h @@ -72,8 +72,14 @@ (!defined(__APPLE__) && defined(__arm__)) || \ (defined(__arm64__) || defined(__aarch64__)) || \ defined(__mips__) +#if !defined(_LIBUNWIND_BUILD_SJLJ_APIS) #define _LIBUNWIND_BUILD_ZERO_COST_APIS #endif +#endif + +#if defined(__powerpc64__) && defined(_ARCH_PWR8) +#define PPC64_HAS_VMX +#endif #if defined(NDEBUG) && defined(_LIBUNWIND_IS_BAREMETAL) #define _LIBUNWIND_ABORT(msg) \ |