diff options
author | Jan Vorlicek <janvorli@microsoft.com> | 2018-03-27 15:27:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-27 15:27:01 +0200 |
commit | 6ecb1ac550ec1876094264cdbdd629c1a832ebee (patch) | |
tree | 17d159ec127b59ee7253be76750bd44d8598b890 /src/pal | |
parent | 4e9206ca403d3c4a86c8611b75dca57655e365ea (diff) | |
download | coreclr-6ecb1ac550ec1876094264cdbdd629c1a832ebee.tar.gz coreclr-6ecb1ac550ec1876094264cdbdd629c1a832ebee.tar.bz2 coreclr-6ecb1ac550ec1876094264cdbdd629c1a832ebee.zip |
Fix build without libunwind installed (#17221)
* Fix build without libunwind installed
I have removed libunwind dependency in a recent commit, but
it turns out that the build was using incorrect include
paths and it was still depending on the libunwind installation
for the libunwind.h header.
This change fixes it.
* Fix clang warning
The libunwind headers contain two empty structs and clang
issues a warning since the size of such structs is
0 in C and 1 in C++.
This is benign for our purposes, since the affected
structs are not directly used by our code.
Diffstat (limited to 'src/pal')
-rw-r--r-- | src/pal/src/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/pal/src/configure.cmake | 47 | ||||
-rw-r--r-- | src/pal/src/exception/remote-unwind.cpp | 6 | ||||
-rw-r--r-- | src/pal/src/exception/seh-unwind.cpp | 6 | ||||
-rw-r--r-- | src/pal/src/libunwind/CMakeLists.txt | 5 |
5 files changed, 41 insertions, 27 deletions
diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt index d185004074..dbff63dc00 100644 --- a/src/pal/src/CMakeLists.txt +++ b/src/pal/src/CMakeLists.txt @@ -11,6 +11,10 @@ add_compile_options(-fPIC) if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND) include_directories(libunwind/include) + include_directories(libunwind/include/tdep) + include_directories(${CMAKE_CURRENT_BINARY_DIR}/libunwind/include) + include_directories(${CMAKE_CURRENT_BINARY_DIR}/libunwind/include/tdep) + add_subdirectory(libunwind) endif(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND) diff --git a/src/pal/src/configure.cmake b/src/pal/src/configure.cmake index a1f8b7414e..8b3fb099a4 100644 --- a/src/pal/src/configure.cmake +++ b/src/pal/src/configure.cmake @@ -100,28 +100,6 @@ check_function_exists(semget HAS_SYSV_SEMAPHORES) check_function_exists(pthread_mutex_init HAS_PTHREAD_MUTEXES) check_function_exists(ttrace HAVE_TTRACE) check_function_exists(pipe2 HAVE_PIPE2) -set(CMAKE_REQUIRED_LIBRARIES unwind unwind-generic) -check_cxx_source_compiles(" -#include <libunwind.h> - -int main(int argc, char **argv) { - unw_cursor_t cursor; - unw_save_loc_t saveLoc; - int reg = UNW_REG_IP; - unw_get_save_loc(&cursor, reg, &saveLoc); - - return 0; -}" HAVE_UNW_GET_SAVE_LOC) -check_cxx_source_compiles(" -#include <libunwind.h> - -int main(int argc, char **argv) { - unw_addr_space_t as; - unw_get_accessors(as); - - return 0; -}" HAVE_UNW_GET_ACCESSORS) -set(CMAKE_REQUIRED_LIBRARIES) check_cxx_source_compiles(" #include <pthread_np.h> @@ -982,6 +960,8 @@ if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND) list(INSERT CMAKE_REQUIRED_INCLUDES 0 ${CMAKE_CURRENT_SOURCE_DIR}/libunwind/include ${CMAKE_CURRENT_BINARY_DIR}/libunwind/include) endif() +set(CMAKE_REQUIRED_FLAGS "-c -Werror=implicit-function-declaration") + check_c_source_compiles(" #include <libunwind.h> #include <ucontext.h> @@ -993,6 +973,29 @@ int main(int argc, char **argv) return 0; }" UNWIND_CONTEXT_IS_UCONTEXT_T) +check_c_source_compiles(" +#include <libunwind.h> + +int main(int argc, char **argv) { + unw_cursor_t cursor; + unw_save_loc_t saveLoc; + int reg = UNW_REG_IP; + unw_get_save_loc(&cursor, reg, &saveLoc); + + return 0; +}" HAVE_UNW_GET_SAVE_LOC) + +check_c_source_compiles(" +#include <libunwind.h> + +int main(int argc, char **argv) { + unw_addr_space_t as; + unw_get_accessors(as); + + return 0; +}" HAVE_UNW_GET_ACCESSORS) + +set(CMAKE_REQUIRED_FLAGS) if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND) list(REMOVE_AT CMAKE_REQUIRED_INCLUDES 0 1) endif() diff --git a/src/pal/src/exception/remote-unwind.cpp b/src/pal/src/exception/remote-unwind.cpp index fa7c66d3a0..c30c463cfd 100644 --- a/src/pal/src/exception/remote-unwind.cpp +++ b/src/pal/src/exception/remote-unwind.cpp @@ -49,7 +49,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <dlfcn.h> #define UNW_LOCAL_ONLY +// Sub-headers included from the libunwind.h contain an empty struct +// and clang issues a warning. Until the libunwind is fixed, disable +// the warning. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wextern-c-compat" #include <libunwind.h> +#pragma clang diagnostic pop SET_DEFAULT_DEBUG_CHANNEL(EXCEPT); diff --git a/src/pal/src/exception/seh-unwind.cpp b/src/pal/src/exception/seh-unwind.cpp index 7cae4a2f36..2b7c9360a6 100644 --- a/src/pal/src/exception/seh-unwind.cpp +++ b/src/pal/src/exception/seh-unwind.cpp @@ -28,7 +28,13 @@ Abstract: #include <dlfcn.h> #define UNW_LOCAL_ONLY +// Sub-headers included from the libunwind.h contain an empty struct +// and clang issues a warning. Until the libunwind is fixed, disable +// the warning. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wextern-c-compat" #include <libunwind.h> +#pragma clang diagnostic pop //---------------------------------------------------------------------- // Virtual Unwinding diff --git a/src/pal/src/libunwind/CMakeLists.txt b/src/pal/src/libunwind/CMakeLists.txt index 532d6fda0d..b33c0ae443 100644 --- a/src/pal/src/libunwind/CMakeLists.txt +++ b/src/pal/src/libunwind/CMakeLists.txt @@ -1,8 +1,3 @@ -include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) -include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/tdep) -include_directories(include) -include_directories(include/tdep) - add_subdirectory(src) # define variables for the configure_file below |