Skip to content

Commit

Permalink
Fix bad configure tests (#42756)
Browse files Browse the repository at this point in the history
There was an extra -c in the CMAKE_REQUIRED_FLAGS set for testing
HAVE_UNW_GET_ACCESSORS and HAVE_UNW_GET_SAVE_LOC that was breaking
build of coreclr under homebrew. The option was somehow making
these checks behave on ARM Linux, eveb though it is not clear to
me why, as it was just causing this option to be passed to the
compiler twice at different positions of the command line of
the cmake tests.
This change fixes it by using check_symbol_exists instead of
check_c_source_compiles, since just removing the duplicite -c
was resulting in the check failing on ARM / ARM64 Linux due
to a missing symbol from libunwind during linking.
  • Loading branch information
janvorli authored Sep 29, 2020
1 parent 855e296 commit 3d5351d
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions src/coreclr/src/pal/src/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1049,8 +1049,6 @@ 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>
Expand All @@ -1062,29 +1060,9 @@ 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)
check_symbol_exists(unw_get_save_loc libunwind.h HAVE_UNW_GET_SAVE_LOC)
check_symbol_exists(unw_get_accessors libunwind.h HAVE_UNW_GET_ACCESSORS)

set(CMAKE_REQUIRED_FLAGS)
if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND)
list(REMOVE_AT CMAKE_REQUIRED_INCLUDES 0 1)
endif()
Expand Down

0 comments on commit 3d5351d

Please sign in to comment.