diff options
author | MyungJoo Ham <myungjoo.ham@samsung.com> | 2016-02-29 17:11:10 +0900 |
---|---|---|
committer | MyungJoo Ham <myungjoo.ham@samsung.com> | 2016-03-04 00:28:11 +0900 |
commit | 3c0d5e85c59107a4710317f445bec0528cbe232b (patch) | |
tree | 936edbba0d1770bcde7cc58361ad25275fac48a2 /src/pal | |
parent | 5c0095268e19e5a5fcf035c4c591ed03e552f072 (diff) | |
download | coreclr-3c0d5e85c59107a4710317f445bec0528cbe232b.tar.gz coreclr-3c0d5e85c59107a4710317f445bec0528cbe232b.tar.bz2 coreclr-3c0d5e85c59107a4710317f445bec0528cbe232b.zip |
Fix CMake Script for libunwind Feature Check
Check the availability correctly for Linux.
The cmake configuration script has been trying to find out
the availability of functions directly with check_function_exists,
which depends on the symbol names in .so files.
However, the libunwind implementation uses macros to
redefine functions names for each architecture making it
impossible to directly look up symbol tables of .so files.
In order to allow the script to use the information in
header files, check_function_exists should be replaced
with check_cxx_source_compiles.
Besides config.h.in had missing declarations for the
CMAKE variables
Fix #3372
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Diffstat (limited to 'src/pal')
-rw-r--r-- | src/pal/src/config.h.in | 2 | ||||
-rw-r--r-- | src/pal/src/configure.cmake | 24 |
2 files changed, 24 insertions, 2 deletions
diff --git a/src/pal/src/config.h.in b/src/pal/src/config.h.in index 68cb81ba67..784383f8dd 100644 --- a/src/pal/src/config.h.in +++ b/src/pal/src/config.h.in @@ -53,6 +53,8 @@ #cmakedefine01 HAS_SYSV_SEMAPHORES #cmakedefine01 HAS_PTHREAD_MUTEXES #cmakedefine01 HAVE_TTRACE +#cmakedefine HAVE_UNW_GET_SAVE_LOC +#cmakedefine HAVE_UNW_GET_ACCESSORS #cmakedefine01 HAVE_STAT_TIMESPEC #cmakedefine01 HAVE_STAT_NSEC diff --git a/src/pal/src/configure.cmake b/src/pal/src/configure.cmake index be6114d48c..daa99622fe 100644 --- a/src/pal/src/configure.cmake +++ b/src/pal/src/configure.cmake @@ -73,8 +73,28 @@ check_function_exists(directio HAVE_DIRECTIO) 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(unw_get_save_loc HAVE_UNW_GET_SAVE_LOC) -check_function_exists(unw_get_accessors HAVE_UNW_GET_ACCESSORS) +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_struct_has_member ("struct stat" st_atimespec "sys/types.h;sys/stat.h" HAVE_STAT_TIMESPEC) check_struct_has_member ("struct stat" st_atimensec "sys/types.h;sys/stat.h" HAVE_STAT_NSEC) |