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 | b667153cf65e66dd5e14e6a715fb33e6200e91de (patch) | |
| tree | cebdd739193eb68d301c7bfeb2dfc26e9926b882 /llvm | |
| parent | fd31bf95c1479e26d77c9000c238ffa36929747f (diff) | |
| download | bcm5719-llvm-b667153cf65e66dd5e14e6a715fb33e6200e91de.tar.gz bcm5719-llvm-b667153cf65e66dd5e14e6a715fb33e6200e91de.zip | |
[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
llvm-svn: 352341
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/runtimes/CMakeLists.txt | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt index 42842409dca..49fbe6ae4ac 100644 --- a/llvm/runtimes/CMakeLists.txt +++ b/llvm/runtimes/CMakeLists.txt @@ -98,7 +98,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) include(CheckLibraryExists) include(CheckCCompilerFlag) - check_library_exists(c fopen "" LLVM_HAS_C_LIB) + check_library_exists(c __libc_start_main "" LLVM_HAS_C_LIB) check_c_compiler_flag(-nodefaultlibs LLVM_HAS_NODEFAULTLIBS_FLAG) if(LLVM_HAS_NODEFAULTLIBS_FLAG) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs") |

