diff options
author | Petr Hosek <phosek@chromium.org> | 2019-01-28 04:12:54 +0000 |
---|---|---|
committer | Petr Hosek <phosek@chromium.org> | 2019-01-28 04:12:54 +0000 |
commit | f056fba8cde5d711c8394fe8b1ae6a73d4545e7e (patch) | |
tree | 507624e20b1184b885d3636cb582af757056d73b /cmake/config-ix.cmake | |
parent | 083c480e6862709c8fc6bba5d33668931ad0f85f (diff) |
[CMake] Use __libc_start_main rather than fopen when checking for C library
The check_library_exists CMake uses a custom symbol definition. This
is a problem when checking for C library symbols because Clang
recognizes many of them as builtins, and returns the
-Wbuiltin-requires-header (or -Wincompatible-library-redeclaration)
error. When building with -Werror which is the default, this causes
the check_library_exists check fail making the build think that C
library isn't available.
To avoid this issue, we should use a symbol that isn't recognized by
Clang and wouldn't cause the same issue. __libc_start_main seems like
reasonable choice that fits the bill.
Differential Revision: https://reviews.llvm.org/D57142
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@352341 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake/config-ix.cmake')
-rw-r--r-- | cmake/config-ix.cmake | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index ec5288266..9aaf90bbc 100644 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -12,7 +12,7 @@ function(check_linker_flag flag out_var) cmake_pop_check_state() endfunction() -check_library_exists(c fopen "" COMPILER_RT_HAS_LIBC) +check_library_exists(c __libc_start_main "" COMPILER_RT_HAS_LIBC) if (COMPILER_RT_USE_BUILTINS_LIBRARY) include(HandleCompilerRT) find_compiler_rt_library(builtins COMPILER_RT_BUILTINS_LIBRARY) |